Questions tagged [static-libraries]
A static library is an archive of object files. Used as a linker input, the linker extracts the object files it needs to carry on the linkage.
4,361
questions
0
votes
0
answers
20
views
In case of a growing project, it is better to keep a single static library or create more than one, each for a single source code group?
I have the following doubt on how to proceed with my project. Let's suppose my project is structured in this way:
project/
├── src/
│ ├── group_1/
│ │ ├── class_1
│ │ ├── class_2
│ │ ├── ...
0
votes
1
answer
44
views
Script to create a static library from all .c file in my working directory
I am trying to write a script that create a static library call libwork.a in the working directory from all the .c files in the directory:
#!/bin/bash
gcc -c *.c | ar cr libwork.a *.o
But as I run my ...
0
votes
1
answer
18
views
pyenv: how to install python dynamic/shared library
When I compile python from source manually (with --enable-shared), I get a dynamic library in the lib directory. For example:
$ ls $PYTHON_INSTALLATION_DIRECTORY/lib
libpython3.9.so libpython3.9.so.1....
0
votes
1
answer
52
views
why is Separating my code into Static Library have much code size than within the main in C in terms of .bin or .out file or an executable?
I had a code inside the "main" that could be detached into a static library, so I separated this part into a new static library folder and included it with my main script.
as follows I had ...
-1
votes
1
answer
24
views
Cannot compile PHP statically when adding `--with-readline`
I compiled php 8.1.7 statically in Alpine Linux latest version, and I made it with following command.
./configure LDFLAGS=-static --disable-all --enable-cli --enable-mbstring --enable-static=yes
sed -...
0
votes
0
answers
22
views
How to include static library on esp32 idf?
I am trying to include a static library that I wrote in another project but I couldn't. Is there anyone who knows how to do it on esp32 idf?
0
votes
0
answers
20
views
Accessing Static Library wrapped in XCFramework
We have Static library (*.a) wrapped in XCFramework distributed by a third-party SDK. Attached is screenshot of the SDK's directory structure and info.plist.
Our project structure -> Main App - ...
0
votes
0
answers
30
views
CMake: Linking to locally built static libraries outside of project directory
I'm in the process of converting several projects to use CMake as the build system. These projects have some shared libraries between them that I would like to maintain separately from the projects, ...
0
votes
0
answers
21
views
React native modules and how to include my local iOS SDK in the module
I have managed to build a react native module using react-native-create-library and added a few stub methods for testing.
This module was then imported into a test project and worked OK.
How do I now ...
2
votes
0
answers
23
views
Can Visual C++ output a static link tree?
I have a project that links to a fairly large number of both static (.lib) and dynamic libraries (.dll), and many of those libraries include other libraries etc.
We've just found a problem where a ...
0
votes
1
answer
64
views
Correct way of installing postgresql extension with custom library
TL;DR
One has to compile their custom library as shared library:
gcc -c -fPIC warp_client.c -o warp_client.o
gcc -shared warp_client.o libwarp-client.so
Include the shared library and additional ...
0
votes
1
answer
23
views
Trouble by including a static library in makefile
I have some troubles by including a static library in our handwritten makefile.
We want include the lib: STL_lib.a which is in the directory: Library/STM32_Safety_STL/Lib
So I wrote this line into the ...
0
votes
0
answers
19
views
How to deploy SwiftPM on Objective-c static and dynamic Library along with Cocoapods
finally after very long time I have stuck in a situation where I am working on a static library which is already developed in Objective-c and now as per customer demand I got an task that I need to ...
0
votes
0
answers
41
views
Has anyone tried to statically link the Postgres client libs into a project?
I'm using Embarcadero® C++Builder 11 Version 28.0.44940.9541. Windows 11.
I am building a 32 bit client, using FireDac, for a customer that is using Postgres. I've tried dropping the actual PG 32 ...
1
vote
1
answer
40
views
Setting RPATH of Static Library in Executable
I have the following setup for my CMake project:
add_executable(exeA ${SOURCES})
target_link_libraries(exeA PRIVATE libB)
libB is a static library built separately in a different project and depends ...
1
vote
0
answers
70
views
Using static C++ library from within go-code using SWIG
How can I use C++-code that uses static C++-libraries from within a go file using SWIG (Simplified Wrapper and Interface Generator)?
(Note: The following post already describes the answer and a ...
0
votes
0
answers
10
views
Duplicate symbols in windows binary (DUMPBIN /SYMBOLS)
I am looking into a binary that I compiled. I see that the following symbol has multiple definitions, with one in a SECT___ and the others UNDEF. Is this expected/standard for library binaries, and if ...
0
votes
0
answers
45
views
R CMD SHLIB External Library Linking Issue (on Ubuntu/Linux)
I have a C file that I am trying to turn into a shared object to be read into R. I want to link that SO with OpenBLAS. I am compiling R from source (and linking it to OpenBLAS) since I have read that ...
0
votes
0
answers
30
views
Building tensorflow lite using bazel didnt produce external static libs in linux
I've added a custom op code to tensorflow lite and trying to compile the c api version using bazel. Now with macos/ios/windows in addition to the shared lib (.dylib/.dll) it'll also create static ...
0
votes
0
answers
26
views
After linking libcryto libssl statically, the executable file becomes very large.Is this normal?
I am writing an example of AES encryption and decryption using openssl EVP function.After linking libcryto and libssl statically, the executable file becomes very large.Executable file changed from 5K ...
0
votes
0
answers
34
views
Strange behaviour of including Qt static library
I'm using Qt 5.15.2 mingw 64 bit.
I compile a very simple static library and then include it to another qt app.
The strange thing is while compiling the app qt call MOC for every included header from ...
0
votes
1
answer
51
views
Are homebrew packages static libraries or dynamic?
I was using the SDL2 library I installed with homebrew. I was just wondering if the libraries I linked were statistic or dynamic and how to tell with these package managers.
1
vote
1
answer
75
views
Do static libraries behave like dynamic libraries in terms of ABI compatibility?
I have learned that you cannot use shared libraries compiled with different compilers together because their ABIs are usually incompatible. The exception is of course if you have a pure C interface, ...
0
votes
0
answers
24
views
linkage error when compiling with openssl as static library
Trying to compile my program with openssl as static library with the following :
gcc -g -Ifolder1/include -Iopenssl/include -Ifolder2_include -c main.c folder1/lib/utils.c folder1/lib/plus.c ...
0
votes
1
answer
96
views
C++ member variables are not initialized when using a debug version static library
Environment: Windows10, cpp17, visual studio 2019, debug version static library
Recently I tried to use Cesium-Native to read 3DTiles files in my project, but there was a confusing problem that some ...
0
votes
0
answers
27
views
Recompiling necessary after updating Red Hat Developer Toolset
I built a large C++application (64Bit, C++17) on CentOS7 (Linux release 7.7) with the devtoolset-9-gcc.x86_64 (9.3.1-2.el7) enabled. The many static libs, which are always linked to it, were also ...
0
votes
1
answer
27
views
Errors when statically linking libsndfile with vcpkg and running sf_open
So here's a bit of example code:
#include<sndfile.h>
int main() {
SNDFILE* sndfile; SF_INFO sfinfo; sndfile =
sf_open("", SFM_READ, &sfinfo); std::cout << "...
0
votes
1
answer
152
views
Dumpbin does not show symbols of Visual Studio C++ static library function
I would like to ask a question, why are not exported static library functions visible to dumpbin?
I have following code of x86 C++ static library (Release) using precompiled headers (Visual Studio ...
0
votes
1
answer
83
views
Tell cmake to build static version of the library
Let's consider CuteLogger CMakeLists.txt, it contains
ADD_LIBRARY(${library_target} SHARED ${sources} ${includes})
which instructs cmake to build the shared version (.dylib on macOS). I know I can ...
0
votes
0
answers
31
views
How to build shared library from static libraries NDK
I have read similar questions to this but none of the answer provided worked.
I want to build a shared library for android to link with JNI,
all libraries on which it depends are static libraries.
I ...
1
vote
3
answers
134
views
Visual Studio C++ static lib function exposing problem
I have created example of using static libraries. The goal is this functionality:
DllTestFunctDll.dll links static_lib.lib (contains fnStaticLibrary())
example.exe links DllTestFunctDll.dll (contains ...
0
votes
0
answers
15
views
Static libraries exporting API objects
The company I work for has multiple in-house projects and libraries.
Someone said the following
Let's move away from static libraries exporting API objects. Then we could link only against <...
0
votes
0
answers
32
views
How to access precompiled iOS Static Framework resources from other framework by just loading static library
I am developing iOS application that has two static frameworks/libraries.
core framework (core.a)
resources framework (resource.a)
Originally 1 & 2 are in the same static framework (core.a). ...
12
votes
3
answers
706
views
What is a good technique for compile-time detection of mismatched preprocessor-definitions between library-code and user-code?
Motivating background info: I maintain a C++ library, and I spent way too much time this weekend tracking down a mysterious memory-corruption problem in an application that links to this library. ...
0
votes
2
answers
18
views
How to include a static library inside my static library with makefile?
I have the following subdirectories:
libftprintf/
-Makefile(1)
-ft_printf.h
-ft_printf.c
-ft_printf_source1.c
-ft_printf_source2.c
-libft/
-Makefile(2)
-ft_atoi.c
-ft_itoa.c
-...
And ...
1
vote
1
answer
56
views
What is the difference between using `ar -rc` vs libtool?
I'm new to c libraries and I'm making a project where I'm not allowed to use libtool.
I tried looking online but everything either super confusing or just how to make one with no explanation.
I have a ...
0
votes
0
answers
43
views
Linker can only find part of .o in .a file
I am trying to use mingw-w64 to create a static lib on windows.
Catalog
Static Lib src:
// test.h
#ifndef __TEST_H
#define __TEST_H
int add(int a, int b);
int div(int a, int b);
int sub(int a, int b);...
0
votes
0
answers
56
views
C++ library public interface as single header file
This is an example of a tuigraphics library I'm working on, what would be the best approach into creating it's public interface accessible via a single header file?
├── CMakeLists.txt
├── include
│ ├...
0
votes
0
answers
86
views
premake doesn't include static libraries
I'm using premake5 and SFML (a graphics library).
I want to make a static library so that the user only has to link against it and not its dependencies.
premake5.lua:
workspace "Processing"
...
1
vote
0
answers
16
views
dynamic initialization for a static object array does not happen in the static library
// IniReader.cpp
static ConfigMap configMap[] =
{
DEFINE_UINT_PARAM(NUM_BANKS,DEV_PARAM),
DEFINE_UINT_PARAM(NUM_ROWS,DEV_PARAM),
// ...
}
define of macro DEFINE_UINT_PARAM:
#define ...
1
vote
0
answers
48
views
CMake project with a static lib depending on another static lib
I have a project with the below structure. Basically, there are two static libraries: lib_a and lib_b. lib_a uses classes and functions defined in lib_b. There is the main executable, which depends on ...
0
votes
0
answers
40
views
Dynamically check and import framework into objc file in a static ios library
Here is my particular usecase I am trying to achieve
I have a swift PM framework A and I have static library B. I want to import A in B depending availability of A.
In the Swift classes of B I am able ...
0
votes
0
answers
41
views
Use static C library with gradle
Im trying to create static library and use it in another project using gradle. My gradle.build in library project:
apply plugin: 'c'
model {
components {
dmggameserver(NativeLibrarySpec){
...
0
votes
0
answers
87
views
How can I compile Cimgui statically and then use it?
I'm new to C and I need some help with linking and compeileing.
Here is the library which I want to use: cimgui github
I followed the instructions about how can I compile the library with the makefile ...
0
votes
0
answers
26
views
undefined reference on lib.a with symbol in the lib
I'm new in managing lib, so I want to understand why I recieved an
libcrypto.a(e_aesgcmsiv.c.o):e_aesgcmsiv.c:(.text+0x1a4) : undefined reference to « aes128gcmsiv_aes_ks »
when I link my executable ...
0
votes
0
answers
72
views
Debug linked static library under C++Builder
I am working on a new C++ project. I am using C++Builder 10.3 Rio.
Due to slow compilation, I have to split the project up, with the main project (VCL) and multiple static libraries, all in one ...
0
votes
1
answer
121
views
Boost.DLL cannot find symbols in executable using statically linked library
I am currently writing a small test application to explore statically linking libraries and accessing their symbols at runtime with Boost.DLL. I am compiling a very simple static library and link it ...
0
votes
0
answers
17
views
Yaml-Cpp undefined reference errors on compilation [duplicate]
I'm trying to work through the YAML-Cpp tutorials and ended trying to replicate some SO posts to see if I get the same outputs as those posts.
This SO post that seems to be the same issue but I'm on ...
0
votes
1
answer
63
views
How to use/link source code as a library (C/C++)
I'm trying to understand how to use build and use source code and then link to it in my project. Specifically I'm trying to do this with the SDL2 library. I am on a mac and want to do this in the ...
0
votes
0
answers
74
views
How to link several static libraries to each other within a Visual Studio Solution
My project is now quite large so I have attempted to reduce the compilation time by putting chunks of code into static libraries so they do not need to be rehashed and recompiled every time. I am not ...