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
2 answers
97 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....
1 vote
2 answers
61 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/...
1 vote
0 answers
42 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 ...
  • 337
0 votes
0 answers
26 views

How do I find out which shared object resolved the symbol used in an ELF?

I'm wondering if there's a systematic method I can use to determine which shared object is resolving a specific symbol without running the binary. Assuming I look at curl, listing all of the shared ...
  • 813
0 votes
0 answers
55 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 ...
1 vote
1 answer
156 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 ...
  • 949
1 vote
0 answers
65 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 ...
1 vote
2 answers
408 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 ...
0 votes
1 answer
382 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 ...
  • 157
0 votes
0 answers
557 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=...
4 votes
1 answer
731 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 ...
0 votes
1 answer
54 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/...
  • 2,334
0 votes
1 answer
236 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 ...
0 votes
1 answer
975 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/...
  • 5
1 vote
0 answers
179 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: ...
0 votes
1 answer
125 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 ...
  • 189
0 votes
0 answers
668 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 ...
  • 1
1 vote
1 answer
304 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 ...
  • 3,799
0 votes
2 answers
1k 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 ...
  • 247
1 vote
0 answers
242 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 ...
  • 11
0 votes
0 answers
109 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?
  • 496
0 votes
2 answers
134 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 ...
  • 113
0 votes
1 answer
222 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 ...
  • 101
0 votes
1 answer
210 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 ...
  • 103
0 votes
0 answers
284 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: ...
2 votes
1 answer
77 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 /...
2 votes
1 answer
158 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-...
  • 163
0 votes
0 answers
273 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 ...
1 vote
1 answer
342 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 <...
1 vote
2 answers
740 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 ...
  • 523
1 vote
0 answers
170 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 ...
  • 203
0 votes
1 answer
170 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"...
1 vote
0 answers
357 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 ...
0 votes
0 answers
179 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 ...
0 votes
0 answers
211 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 ...
0 votes
1 answer
290 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 ...
-1 votes
2 answers
2k views

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

CSAPP (3ed) says in 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: linux> ./prog Since prog does not ...
  • 95.9k
0 votes
1 answer
798 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 ...
  • 95.9k
1 vote
1 answer
2k 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) { ... } //...
  • 239
2 votes
1 answer
330 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....
  • 25
0 votes
1 answer
694 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 ...
  • 3
1 vote
1 answer
612 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 ...
  • 105
1 vote
1 answer
1k 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/...
0 votes
0 answers
1k 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 ...
  • 2,345
0 votes
2 answers
4k 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....
1 vote
1 answer
677 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(...
  • 2,145
1 vote
0 answers
45 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 ...
2 votes
1 answer
14k views

Correct way to add /lib/ld-linux.so.3 in Debian

My current setup is quite exotic, and I could use some clarification. I am running on a Pinebook Pro, powered by a Quad Cortex-A53, 64-bit CPU. The OS is a 64-bit version of Debian: $ uname -a Linux ...
  • 189
0 votes
0 answers
202 views

Linux: Where and how is ELF object file header used?

Does anyone know where in the shell, fork(), exec() sequence ELF are read and used by the loader? Linux can be used as an example. I ask because it's my understanding ELF has information about ...
  • 193
1 vote
1 answer
263 views

ldconfig creating links with strange names after patching libraries with patchelf?

I am patching several libraries on my development server to remove unneeded dependencies using the patchelf tool. These get packaged into an RPM and installed on my runtime system. After the install, ...
  • 111

1
2 3 4 5 6