All Questions
Tagged with gcc shared-libraries
710
questions
0
votes
1
answer
36
views
Create a dynamic library with unresolved symbols at link time with mingw-w64
I have a file mylib.c with the following content:
extern void some_function(void);
int add(int a, int b) {
some_function();
return a+b;
}
I want to create a shared library from it. The ...
0
votes
1
answer
68
views
C: Linking shared libraries during building vs using libdl at runtime
This website says there are 2 ways of using shared object files (.so):
Dynamically linked at run time. The libraries must be available during compile/link phase. The shared objects are not included ...
0
votes
1
answer
66
views
Linking a multilibrary project statically to libstd++?
We're building a project consisting of 2 shared libraries libProduct and libHelper. libProduct depends on libHelper. We are using a pretty new GCC toolchain (12) for the Linux build in order to ...
0
votes
0
answers
89
views
Why there is segment fault when compile with clang15
Given the following code, built on x86 clang, and run, it will segment fault.
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <sys/...
0
votes
1
answer
35
views
g++ -c vs. g++ -shared difference and when to use which?
I am just really wondering, what is difference between g++ -c and g++ -shared? If I understand it correctly, it has something to do with the linking. So what does the -shared flag introduce that is ...
0
votes
1
answer
73
views
Compatibility rules to follow if we want to modify a function definition in a shared library used by our program
I'm on an Ubuntu x86_64 system.
I have this source file main.c that uses the fx function defined in the shared library libfx.so :
int fx( int a, int b);
int main( void ){
int x = fx( 50, 30 ...
0
votes
1
answer
61
views
Is the creation of linux shared libraries consistent between linux x86_64 and arm64 architectures?
I'm wondering if the way we create shared libraries is the same between these two architectures.
Let's say I have the file fx.c that contains some functions definitions so I would create a shared ...
1
vote
0
answers
47
views
Find the default library paths and default headers include paths
I'm on an Ubuntu 22.04 system and I'm working with C language and libraries.
I know ( from different books, included "The Linux Programming Interface" by Kerrisk ) that this algorithm is ...
1
vote
1
answer
119
views
behavior of string literal in rodata section of shared object
#include <stdio.h>
#include <string.h>
#define CONFDIR "/opt/hp9300/pov64_IworkspaceIdocpv989Ieightonews-r7.6-dev_tests-000001"
#define NEW_CONFDIR "/etc" CONFDIR
// ...
2
votes
1
answer
159
views
Is symbol versioning widely used in linux libraries or is it just used in some specific and rare cases?
I'm quoting the following from the popular book "The Linux programming interface" by Michael Kerrisk related to symbol versioning :
"This technique provides an alternative to the ...
0
votes
1
answer
160
views
Setting LIBRARY_PATH for rocksdb in linux with clang/gcc
I am trying to build rocksdb as a shared library and facing issues while specifying its dependencies. I want to compile rocksdb with bzip2 but the issue is by default rocksdb is using bzip2 shared ...
1
vote
1
answer
343
views
What happens when an executable can't find a symbol in dynamic library?
I would like to use openOCD as my debugger to interact with the J-Link adapter on my board. So I download the code from a mirror repository openocd - github and follow the step in README to build it.
...
-1
votes
1
answer
108
views
post-build removal of a set of symbols (keeping only a given set) from C++ dynamic library
i'm building a dynamic library (in C++), which exports a number of symbols.
these exported symbols (obviously) match the API of my library.
however, my lib also exports a plethora of additional ...
0
votes
1
answer
55
views
If I want to compile a dynamic library through gcc, do I need to use - static? What is the difference between with '-static' and without '-static'
What is the difference between with -static and without -static
when I use gcc to compile a shared library with -static
I got an error
/usr/sbin/ld.gold: error: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/...
0
votes
1
answer
522
views
Undefined symbol while importing so. file
I was running a code of (https://github.com/google-deepmind/constrained_optidice) for research purpose. When I tried to run neural/run_experiments after installing the requirements as stated, it gave ...