Questions tagged [dynamic-linking]

In computing, a dynamic linking is the process of an operating system (OS) that loads (copies from persistent storage to RAM) and links (fills jump tables and relocates pointers) the shared libraries needed by an executable at run time, that is, when it is executed.

Filter by
Sorted by
Tagged with
0 votes
1 answer
106 views

Changing the path opened by openat of a program using LD_PRELOAD

I want to change a path that a program actually opens on filesystem for some paths. The reason is that I want to run a program in parallel, but that program uses /tmp/somedir/ as its temporary ...
Tomáš Zato's user avatar
  • 1,776
0 votes
0 answers
36 views

Linux so convention: is the .so link intended to come from dev packages?

On my Ubuntu jammy Linux PC, after installing the libuv1 package (apt-get install libuv1), I noticed that there was a file, named libuv.so.1.0.0 and a symbolic link to it, named libuv.so.1: $ find /...
StoneThrow's user avatar
  • 1,717
0 votes
3 answers
131 views

Making changes to the shared library

Suppose we have a C program that uses the shared library. If you make changes to a shared library and rebuild it, all programs using that library will automatically receive those changes the next time ...
dsa14dfS's user avatar
1 vote
0 answers
98 views

Runtime library search order on AIX

If I understand correctly, the variables LIBPATH and LD_LIBRARY_PATH have a higher priority than the argument to the linker -blibpath. I'm looking for how to tell the loader to search for libraries ...
ibse's user avatar
  • 295
0 votes
2 answers
905 views

gdbus symbol look up error

I'm using Archlinux. After a recent update, I find that the gdbus doesn't work and it presents a symbol lookup error: ➜ tidedra@ZgrArch ~ gdbus gdbus: symbol lookup error: /usr/lib/libgobject-2.0.so....
GearyZhang's user avatar
1 vote
2 answers
363 views

Hacking LD_LIBRARY_PATH to use a recent bash from a chroot

I try to get a more up to date version of bash from LinuxMint. I have a chroot with Debian Sid in my box. What I try to do in a bash wrapper script, early in my PATH #!/bin/bash LD_LIBRARY_PATH=/path/...
Mévatlavé Kraspek's user avatar
1 vote
0 answers
155 views

Provide a link order for `.so` libraries

I need to dynamically link to a number of .so shared libraries from R. R can only do this one at a time using the dyn.load function, which takes the file path of the shared object. However, if the ...
Migwell's user avatar
  • 407
1 vote
0 answers
154 views

How do AppImage tools decide what .so files to include? Why produced different .so-files-including list from different distros?

Compiled a Qt project and created .AppImage for it, on two different Linux distros ( Qt was installed via different ways). The two output .AppImage contain different .so files. Both .AppImage run. I ...
garywill's user avatar
2 votes
1 answer
568 views

How are system call functions linked to an executable?

Say I write a non-sensical program that features a single system call, open: #include <fcntl.h> void main() { int hi = open("does not exist", 0); } When I compile the program ...
Izzo's user avatar
  • 961
1 vote
0 answers
204 views

What's the difference between _init vs _start?

_start runs first, even though _init is pointed to by the DT_INIT dynamic entry as the initialization function. Could someone explain to me the purpose of DT_INIT if it seems to serve no purpose as ...
RabidProgrammer555's user avatar
1 vote
2 answers
986 views

Figuring out location of a loaded shared library

I'm maintaining a C-program, that uses Oracle client libraries. The libraries expect the ORACLE_HOME environment variable to be set, and fail to work without it -- in many cases. In our situation, the ...
Mikhail T.'s user avatar
0 votes
1 answer
919 views

apt packages - static vs dynamic libraries

I use Ubuntu 18.04. I install libraries using apt, for example: sudo apt install freeglut3-dev Does apt always install dynamic libraries or I can determine if a package contains static or dynamic ...
Irbis's user avatar
  • 239
0 votes
0 answers
867 views

shared library not found even if "export LD_LIBRARY_PATH" is set

Here comes a strange question. I have a QT App and it requires some libraries. Normally, the following bash script works: #!/bin/bash export LD_LIBRARY_PATH="./libs" export QT_DEBUG_PLUGINS=...
Freedomrunner's user avatar
4 votes
1 answer
2k views

Existing .so file cannot be loaded even though it exists, seems to depend on Docker host OS

I have built Qt6 in an Alma8 based Docker container, with the Docker host being Fedora 35. Under some circumstances (described below), all Qt libs cannot load libQt6Core.so[.6[.2.4]]. But that file ...
Stefan Scherfke's user avatar
0 votes
1 answer
128 views

How to link using -lfoo when there are versioned names of libfoo but no libfoo.so

Suppose /usr/lib/x86_64-linux-gnu/ contains libfoo: libfoo.so.2 -> libfoo.so.2.0.0 (symbolic link) libfoo.so.2.0.0 Notably missing is libfoo.so. Suppose there is a program /usr/local/bin/...
Flux's user avatar
  • 2,938
0 votes
1 answer
540 views

How to get meson to use a library in a different lib directory?

I have two versions of a library, zita-convolver3 and zita-convolver4. The system library is zita-convolver3, but i want to link against zita-convolver4, which is stored in a local user directory. How ...
placid chat's user avatar
0 votes
1 answer
2k views

/usr/lib vs /etc/ld.so.conf.d

TL;DR Why is it better to place a symlink to a shared library at /etc/lib(64)/ or why is it better to create a *.conf file in /etc/ld.so.conf.d/ .conf file Assuming i have my custom binary at /opt/...
void's user avatar
  • 5
1 vote
0 answers
361 views

undefined symbol on one system but not another with identical files

I'm starting vim on 2 systems, one works, the other fails with undefined symbol. The problem is that on one system libogg is not loaded but I can't see any differences in the systems: Working system: ...
Goswin von Brederlow's user avatar
0 votes
1 answer
220 views

dpkg-shlibdeps do not give version information

I am creating a package that depends on the ROS package ros-noetic-moveit-core. More specifically, it contains a shared library linking against libmoveit_robot_model.so. libmoveit_robot_model.so is i ...
Hugal31's user avatar
  • 189
0 votes
0 answers
1k views

Usage of objcopy / elfedit to patchelf symbol (versions) in elf file

The context is as follows: on my o.s. there is (already) liba.so.v2 of "liba" which contains the string 'symbol_version-2' as the symbol version for its functions , e.g. functionX@version-2 ...
cg79's user avatar
  • 11
1 vote
1 answer
719 views

Custom `PT_INTERP` interpreter results in segmentation fault?

After having read this article on executing arbitrary programs by changing the PT_INTERP to a custom interpreter, I've tried to experiment with this locally: $ cat flag.c #include <stdio.h> int ...
Shuzheng's user avatar
  • 4,431
1 vote
2 answers
2k views

Is it safe to remove a shared lib while programs which depends on it is executing?

Is it allowed to delete (for example, with the rm command) some shared library without any danger when programs that depend on it are executed? I thought so, because if the program was running, then ...
ibse's user avatar
  • 295
1 vote
0 answers
431 views

Error while loading shared libraries (libandroid.so): internal error

I'm trying to run a sample sensor NDK application in an embedded target with Qualcomm Snapdragon QCS610 running a Linux BSP supplied from the dev board manufacturer. The sensor application depends on ...
Laks's user avatar
  • 11
0 votes
0 answers
241 views

Which order are libraries searched for in LD_LIBRARY_PATH

If I have a library that can be found in two directories listed in LD_LIBRARY_PATH, when resolving libraries at runtime which one is used - the first one or the second one?
Timmmm's user avatar
  • 586
0 votes
2 answers
395 views

Are dynamic linkers interchangeable?

Are dynamic linkers interchangeable? Let's say I compile a program, for example with gcc, linking in various dynamic libraries, with the program to be used at runtime with the gnu linker for resolving ...
Daniel's user avatar
  • 123
0 votes
1 answer
431 views

Weird linking issue with libldap using cmake

I am trying to build SimGear from the FlightGear project using the download_an_compile.sh script (which uses CMake to build the binaries). The build went fine so far, but when the script tried linking ...
TheEagle's user avatar
0 votes
1 answer
386 views

How do dynamic library's code know within what process it's called?

If I understood correctly, the one dylib instance is stored in one memory segment when loaded, then it becames shared and not copied between multiple processes virtual memories that need it. But how ...
DIES's user avatar
  • 103
0 votes
0 answers
474 views

LD_PRELOAD is not using the correct library

I am trying to override a dynamic link in an executable. I have an executable "program" The command: ldd program outputs: libstdc++.so.6 => /lib64/libstdc++.so.6 I have a library a.so: ...
Mohammad Mouadi's user avatar
2 votes
1 answer
259 views

When building/running a program, how do to tell the dynamic linker where to find the appropriate libraries? [closed]

I am trying to install and run the program Dsuite. To do so, I had to install a newer version of gcc locally (as I do not have root/super user privileges.) I did this with the following commands. cd /...
wjdavis90's user avatar
2 votes
1 answer
251 views

Why does this SO (shared object) end in .3gf?

On ubuntu trusty tahr, when I install libblas3 from the repository, it installs a file at /usr/lib/libblas.so.3gf. Under focal fossa, it behaves differently and installs under /usr/lib/x86_64-linux-...
Erasmus's user avatar
  • 163
0 votes
0 answers
275 views

Can't compile any c program (/usr/bin/ld: 1: Syntax error: newline unexpected) [duplicate]

Hello everyone, I have a serious issue, i can't compile any c program, i get the following error : /usr/bin/ld: 1: Syntax error: newline unexpected collect2: ld returned 2 exit status I have found on ...
Amine Benslimane's user avatar
1 vote
1 answer
500 views

ldd shows a set of libraries linked in, but using rabin2 -l shows differently. Why is that so?

While trying to debug something, i noticed that ldd <executable> would show a bunch of libraries like libldap_r, libkrb5 and libroken, amongst others. On the other hand a rabin2 -l <...
placid chat's user avatar
1 vote
2 answers
1k views

Why is chrpath limited to maximum length 6?

I'm trying to change the RUNPATH of a shared object but I get an error that it cannot be longer than 6 characters. What is the reason for this? This is chrpath version 0.16 on Raspbian. $ chrpath -r ...
Elliott B's user avatar
  • 565
1 vote
0 answers
297 views

Linking an assembly program

I'm trying to compile and link an assembly program. assembly file (main.asm): .section .text .global main main: mov $msg, %rdi call printf xor %rax, %rax mov $80, %rdi syscall ...
fctorial's user avatar
  • 203
0 votes
1 answer
349 views

How can I "give" a forked process a diferent dynamic library than the one it "asks" for?

I want to know how I can "give" a forked process a different dynamic library than the one it "asks" for. For example, if the fork "asks" for the library "foo.so"...
Sally Beuford's user avatar
1 vote
0 answers
689 views

How to write a file PkgConfig.pc file that supports both static and shared linking

I am writing a little library as a self challenge. I plan to target Linux based systems. I want to add a libname.pc file so as to add support for PkgConfig. Here, is my current file: prefix=/usr/local ...
Mansoor Ahmed Memon's user avatar
0 votes
0 answers
317 views

What is the best way of finding library conflicts in a large application?

I have a large application (let's call it P) with lots of dependencies to boost, Qt, zlib, libpng, etc. Recently, I have added a feature to P that needs to dynamically load a new shared object (let's ...
TonySalimi's user avatar
0 votes
0 answers
299 views

How to debug a cpp file that's part of a so file in the software?

So I have this software which has multiple .so files. For one of the so file and I made some changes to the code but I want to see the line by line execution of file present in the so file. Just to ...
Himanshuman's user avatar
0 votes
1 answer
456 views

Mac OS 10.12 - Accidentally Unlinked libz.1.dylib

Ran: unlink /usr/lib/libz.1.dylib Now I can't launch from my user profile. I have been able to run in recovery mode, where I can see the .dylib in question is there, but running in single-user mode I ...
taylori's user avatar
1 vote
2 answers
4k views

What is the linker and what is the loader in dynamic linking?

Computer Systems: A Programmer's Perspective (3ed) says on p733 that 7.9 Loading Executable Object Files To run an executable object file prog, we can type its name to the Linux shell’s command line: ...
Tim's user avatar
  • 102k
0 votes
1 answer
2k views

Does `dlopen()` performs dynamic linking by invoking dynamic linker `ld-linux.so`?

CSAPP says Linux systems provide a simple interface to the dynamic linker that allows application programs to load and link shared libraries at run time. #include <dlfcn.h> void *dlopen(const ...
Tim's user avatar
  • 102k
2 votes
1 answer
4k views

Why the dynamic linker couldn't resolve reference when a shared library has a dependency on other share library?

Code: //a.c I don't use header files as this is just for demo purpose. extern void function_b(int num); void function_a(int num) { function_b(num) } //b.c void function_b(int num) { ... } //...
slowjams's user avatar
  • 259
2 votes
1 answer
507 views

What would be an effect on the system when we try to forcefully delete /etc/ld.so.preload file?

I have been doing my research around this command. rm -f /etc/ld.so.preload The script which currently I am analyzing, starts with above command. Note: I tried doing my research around "ld.so....
MVnD3X's user avatar
  • 25
1 vote
1 answer
892 views

C++ linking error: 'libcairo.so: undefined reference to FT_Get_Var_Blend_Coordinates'

I'm trying to build a C++ project via CLion and have been unable to get past this error in the linking process: /lib/../lib64/libcairo.so: undefined reference to `FT_Get_Var_Blend_Coordinates' I'm ...
ap84's user avatar
  • 13
2 votes
1 answer
986 views

compiling old glibc on arm fails with undefined references in nis and nss

It seems to have become a bit complex, so first some background: I need to compile self-contained programs that run on arm systems with glibc versions typically between 2.13 and 2.17. When trying to ...
ppenguin's user avatar
  • 115
1 vote
1 answer
2k views

ld ignores ld.so.conf

This is my /etc/ld.so.conf /usr/local/lib64 /usr/local/lib include /etc/ld.so.conf.d/*.conf The directory /etc/ld.so.conf.d/ contains mysql-x86_64.conf which contains only this one line: /usr/lib64/...
Peter VARGA's user avatar
  • 1,012
0 votes
0 answers
2k views

How to test a binary, to see if all shared library dependencies, are satisfied?

I have a program which I compiled on an earlier version of Fedora which suddenly broke after an upgrade. I was running an older version of Fedora at the time which had stopped receiving updates; so I ...
Zhro's user avatar
  • 2,669
0 votes
2 answers
6k views

Is there an rpath for dynamic linked libraries?

So, the project I am working on uses a non-system directory to keep some DLLs that the code uses. I don't want to put them in system directories, so the executables have an rpath set to find the DLLs....
casualunixer's user avatar
1 vote
1 answer
860 views

Forking `addr2line` on shared object from application for constructing stack traces. How safe is this?

I am augmenting my applications which run on Linux to emit a backtrace when terminal signals (such as SIGSEGV, SIGABRT) are received by a process or thread. The code works very well using backtrace(...
Steven Lu's user avatar
  • 2,282
1 vote
0 answers
77 views

How to link to a numbered shared library?

This is the command I am running arm-linux-gnueabihf-gcc -Wall -Wl,--verbose -mthumb -mthumb-interwork -D_REENTRANT -oTestRun11 ./main.c -ldl -lpthread -lRTU_Module Which gives in the printout ...
mega_creamery's user avatar

1
2 3 4 5 6