4,593 questions
0
votes
1
answer
33
views
Static library not found by linker despite its directory being stated
I've got a problem with a static library (.a file) I'd like to include into my project: Compilation (with gcc) works well, but linking ends with the library not being found by ld whatever I do:
arm-...
1
vote
1
answer
125
views
What is the source of difference in size of statically built and dynamically built libraries in the boost library
On installing boost library (of which boost graph library is a part), the following has been installed on my computer:
(1) C:\local\boost_1_86_0\boost\graph\header files.hpp
(2) C:\local\boost_1_86_0\...
0
votes
0
answers
40
views
How do I specify shared library flags in pkgconf files?
I've got a library (Google's protobuf, FWIW) which requires a certain compile-time flag if it's been built into a shared library. However, if it's been built into a static library, then it mustn't ...
1
vote
1
answer
118
views
VS2022 C++: Referencing static lib project with date/date.h breaks chrono
I've come across a strange issue related to Howard Hinnant's date.h library that causes all of <chrono> to break, at least according to VS. It appears to be related to using date/date.h in a ...
3
votes
2
answers
146
views
What is the purpose of the ar “-l” option?
For context, I have been working on a game engine for a while now. The engine requires several libraries to function (Wayland, XKB, Vulkan, etc.). Because the added complexity of shared libraries ...
0
votes
0
answers
23
views
How to build muparser as a static library in CMake? [duplicate]
I've added muparser to my CMake project using the FetchContent module as follows:
FetchContent_Declare(
muparser
GIT_REPOSITORY https://github.com/beltoforion/muparser.git
GIT_TAG master
)
...
0
votes
0
answers
30
views
What is the best way to make CMake not install an included package/submodule? [duplicate]
I am trying to build and package an application with CMake, using Azure IoT C SDK. The projects instructs you to include it in your application by doing something like:
cmake_minimum_required (VERSION ...
2
votes
1
answer
56
views
Can I build an avr-libc static library without specifying target MCU?
I am building an avr-libc static library like this:
avr-gcc -O2 -I. -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -g -ggdb -ffunction-sections -fdata-...
3
votes
1
answer
243
views
__asan_default_options() ignored when used in a STATIC library and linked against an executable
I'm trying to globally configure AddressSanitizer (ASan) for multiple executables in my C++ project by defining the __asan_default_options() function, like this:
extern "C" const char* ...
0
votes
0
answers
127
views
Conan Header Not Found: Header Exists in Package but Fails to Compile in CMake Project
I'm working with a C++ project using Conan for dependency management and CMake as the build system.
I created a new Conan package for a static library called mylib. The header files are located under ...
0
votes
1
answer
122
views
How to compile a C++ project that uses a .a or .so library without having to provide all the .hpp files again?
I have a library that is already compiled to libserver.a
And then I have main.cpp like this:
#include <picohttp/picohttp.hpp>
#include <iostream>
The picohttp is already compiled to ...
-1
votes
1
answer
116
views
qwt library -lqwt not found
Qwt-6.3.0 | Qt6.9.0 | mingw1310_64 | Windows11
I have installed qwt as a static library, got the library files libqwt.a und libqwtd.a in the subdirectory \lib as expected.
In order to test the ...
1
vote
0
answers
175
views
How do I statically include libgccjit?
I've just compiled GCC from source, which gave me a libgccjit.so file to dynamically include from my program. However, perhaps I wouldn't want to bundle the file alongside the program if I were to ...
2
votes
1
answer
125
views
Linker drops globals (and their constructors) from static library
I've got a singleton registry that maps names to function pointers. I also have a registrar object whose constructor registers a function pointer.
My goal is to have the functions and registry in a ...
0
votes
0
answers
78
views
How do I use a Bazel built project/set of libraries , built as a submodule into a autotools based project?
I’m trying to integrate Quiche library (which uses Bazel as its build system) into an existing Autotools-based C++ project. I need it as a third-party submodule.
I am facing issues with:-
Linking the ...
0
votes
1
answer
189
views
If I build a static library that calls a function that isn't defined do I need to also compile or link other library or file?
I asked an online LLM and it said:
Yes, absolutely. You need to link to the dependency library even when building a static library that calls functions within it.
But I tried building a static ...
2
votes
1
answer
216
views
Failing to link static libraries during Rust unit testing [closed]
I have been working on this simple example. This entire project is being compiled on a (Linux AArch64) Raspberry Pi 3B.
Say I have a simple assembly function (that does SIMD addition on AArch64) ...
0
votes
0
answers
24
views
C++: Function definitions are not found when I try to compile using MinGw in vscode [duplicate]
I'm trying to compile and debug my main.cpp code, with the header file of declarations ./include/linalg.hpp and the definitions in ./src/linalg.cpp, but I face the error below:
Executing task: ...
0
votes
1
answer
122
views
statically linking SDL2 on Linux and macOS "like on Windows"
i had made a game on C using SDL2, SDL2_image, SDL2_mixer and SDL2_ttf libraries installed on Linux (Ubuntu) by sudo apt-get install libsdl2-dev (for example), and i wanted to improve it so it will be ...
2
votes
1
answer
221
views
Calling a static C/C++ library from Go
I'm still on the learning curve with Go, but I've managed to compile and run a Go program that includes a C object file.
The objective is to call an existing static C++ library. The call will be a bit ...
1
vote
1
answer
72
views
Using a shared library within static library used by 2nd shared library and other applications, Linux tools
Basic question: Can one specify, when building a static library (and ONLY when building the static library), that the static library needs to link with a shared object?
I'm working on a project that ...
2
votes
3
answers
138
views
Does a program have defined behaviour, if it has been created by linking to static libraries with multiple definitions?
This question is related to that one: How can multiple definitions in static libraries be detected/prevented? and a sentence in the first answer.
The paragraph "One Definition Rule" of ...
1
vote
1
answer
82
views
How do I link startup file inside of static library in GCC?
Clarification
I want to create static library from my code to share the artifacts (but not the code). I will call this Main_Project.
In my Main_Project, I have startup.s and flash.ld files.
startup.s:
...
1
vote
0
answers
87
views
Not able to set breakpoint in C++ code from static library
I have a C++17 console application that is built using VS2022 Professional on Windows 10.
The application is compiled and linked with external C++ static library that is compiled with /Z7.
The ...
0
votes
0
answers
122
views
Qt6: Static linked qml module
Problem description:
In Qt5, it was straightforward to work with QML resources in a static library. We simply created a .qrc file to include the QML files along with a qmldir, set QML_IMPORT_PATH for ...
2
votes
1
answer
98
views
Building OpenCV into Static Library results in missing functions
I am building my c/c++ static library for either my ios or android. Before I built the dynamic library using the keyword SHARED and everything worked fine. I crosscompiled openCV for both versions (...
1
vote
1
answer
245
views
building DLL based on libzip-static.lib
Thanks to kiyolee I have a VS2022 solution to build zlib and libzip (git clone of https://github.com/kiyolee/libzip-win-build and https://github.com/kiyolee/zlib-win-build) and I'd like to extend this ...
3
votes
1
answer
110
views
Issues displaying GLFW window when linking with static library
I'm working on a very simple Vulkan application. Up until now, I've been linking with the GLFW DLL that I installed via my OS's package manager (and I haven’t had any issues with that). After ...
0
votes
0
answers
67
views
How to privately link a library to an external static library with CMake
I have a library B that privately depends on an external static library A.
I would like library B to statically link to library A such that any library that links to library B then doesn't need to ...
0
votes
1
answer
163
views
Issue Using MuParser in Qt Creator Project for C++
I am trying to include MuParser in my Qt Creator project, but I have been struggling for quite a while to get it working properly.
Where I am now, it appears to be unable to find several symbols in ...
1
vote
1
answer
362
views
wasm-ld --export-all does not work with static libraries
While playing with building WASM modules using clang toolchain I hit a behavior that I'm struggling to understand. Basically, I have a very simple C++ code (in test.cc):
extern "C" int foo() ...
1
vote
1
answer
83
views
How to change symbol occurrences in a cpp .o file (within paramteter lists etc.)?
I am writing a wrapper for multiple static libraries that are implementing similar functionality. Two of those libraries share the same class names and (because of their age) don't make use of ...
3
votes
1
answer
159
views
Visual Studio- Strip PDB file path from static library
I'm trying to remove the PDB path in order not to expose my computer's internal directory structure in libraries that are going to be distributed publicly.
In EXE and and DLL files I can specify "...
1
vote
1
answer
384
views
Issue with static library linking for C++ (Unreal Engine 5 project)
So I'm trying to use the library utf8proc in my project. I've built the library using cmake, which has created a static lib file (utf8proc_static.lib), which I'm referencing in my Build.cs file using ...
0
votes
0
answers
59
views
Error importing a Windows static library as a plugin
I am trying to import a third-party static library as a plugin into unity. I copied the library to Assets/Plugins/x64 folder and set the OS of the Plugin to Windows and architecture to x64. However, ...
0
votes
0
answers
172
views
How to export a static library linked to an interface library?
I have successfully built and exported a shared library of mine by following the approach of putting the compiler flags into a separate INTERFACE library, as suggested in the CMake tutorial.
I also ...
0
votes
0
answers
557
views
How to link C++ project statically to zstd.lib?
I have a VS2022 C++ project that uses zstd. Previously, it used zstd v1.5.2; I changed this to v1.5.6 (the current version). Now when I attempt to run the project, I get an error "The code ...
2
votes
1
answer
175
views
Multiple definitions of glibc symbols when linking several static libraries with gcc
So I have made two libraries with gcc and ar: libwa.a and libws.a.
When I link them using -l flag in my project. I get this error:
/usr/bin/ld: .../lib/libws.a(bhns.c.o): in function `atoi':
bhns.c:(....
0
votes
1
answer
131
views
How can I link a Go static library to a C program
I'm trying to call a Go function from a C program. I have built a static library from my Go source, however, ld is unable to find the function I want to call from the C program.
Go code:
package main
...
0
votes
1
answer
123
views
Undefined reference when trying to link to static pre-built library Noesis in Cmake (c++, CLion, windows)
I am trying to start using the GUI library Noesis in my game, and am currently in the process of integrating it into my project. Unfortunately, during linking, all of the Noesis functions I have used ...
0
votes
1
answer
199
views
How to tell GNU linker to only try to find unresolved symbol so far from a specific static library?
I added some symbols into a existing src file, this src file is used by both the main program and an independent library. The added symbols belong to the main program hence locate in a static library ...
0
votes
1
answer
82
views
symbol lookup error in shared library for existing function from static library
I have a static library "import" that provides a non-member function import_init(char*) as well as a class ImportObject with the member function Import(char*) that references import_init(...
2
votes
1
answer
318
views
Hide symbol and source file name in C static library using cmake
I found a lot of questions on the hidden symbol topic in C static library.
I tried a lot of things:
-> Add strip and optimisation -O3 -s CFLAGS
-> Add -Wl,--exclude-libs,ALL" "-Wl,-...
1
vote
0
answers
600
views
Enable ASAN with static-libasan and fsanitize=address with clang with shared library
I want to enable asan on my main executable and a shared library that I build locally.
main linker flag I think relavent to the sanitizer is
-fuse-ld=lld -static-libstdc++ -static-libsan -fsanitize=...
1
vote
0
answers
110
views
Unable to static build the application using QML
I am working on a desktop Qt (6.2.0) application with UI built on QML (used through resource). I am looking forward to create static build for this application, but it fails because libGLX.a is not ...
0
votes
1
answer
102
views
How can I link to a .a file in Visual Studio
I have an application that has been worked on for several decades and I was provided .h and .a files. My program is mainly in C/C++ and when I try to link to these .a files, I get:
Error LINK2019: ...
2
votes
1
answer
297
views
Running `objdump` on an intermediate cmake target
I'm cross-compiling and I have a collection of assembly language programs in many files.
I define a static library, libtop.a to contain them all...
add_library(top
STATIC
/path/to/one.S
/...
0
votes
0
answers
67
views
Static MySQL XDevApi library failed to build in VSCode CMake Project
So I'm currently trying to make xdevapi work with cpp-httplib. This is my current CMakeLists.txt
cmake_minimum_required(VERSION 3.5.0)
project(http-server VERSION 0.1.0 LANGUAGES C CXX)
...
1
vote
1
answer
93
views
Prevent symbol from static to override libc symbol
I have a static library which I don't control that defines the symbol gettimeofday(). The main function needs to use this function but I don't want it to use the one from the library, I just want the ...
0
votes
2
answers
73
views
How should one include globally defined constants in a C++ library?
I will use a specific, albeit simplified, example to illustrate what I mean. Suppose we are developing a library related to complex numbers. We define two classes, 'cmplx' which represents complex ...