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
0 answers
20 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=...
user avatar
2 votes
1 answer
55 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 ...
user avatar
0 votes
1 answer
40 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/...
user avatar
  • 1,832
0 votes
1 answer
14 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 ...
user avatar
0 votes
1 answer
60 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/...
user avatar
  • 5
1 vote
0 answers
30 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: ...
user avatar
0 votes
1 answer
43 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 ...
user avatar
  • 177
0 votes
0 answers
143 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 ...
user avatar
  • 1
1 vote
1 answer
112 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 ...
user avatar
  • 3,287
0 votes
0 answers
384 views

Compile error DSO missing from command line

I am trying to install TraceR, and I am getting the following error. make[1]: Leaving directory `/g/g92/bhowmik1/installTF/TraceR/tracer/elements' mpicxx -g `otf2-config --ldflags` p2p-events.o coll-...
user avatar
  • 35
0 votes
2 answers
962 views

ldd returns "not a dynamic executable"

I have compiled binaries on my computer with GCC 4.9.1 and transferred them to the server I want to run them on (on which I don't have the required permissions to install packages, so I can't install ...
user avatar
0 votes
0 answers
24 views

Why showing the dynamic library path to both the linker and the loader

To build and run an application in .cpp, I understand that the linker and the loader both need to know the path to the dynamic library (lib*.so). But, since in the linking steps the dynamic library is ...
user avatar
  • 1
0 votes
2 answers
248 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 ...
user avatar
  • 205
1 vote
0 answers
81 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 ...
user avatar
  • 11
0 votes
0 answers
57 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?
user avatar
  • 414
0 votes
0 answers
18 views

Copy content of .got section

I have built a custom glibc library in order to extract some data and add custom functions to be used later. Since my work has to do with dynamic linking (lazy binding) I am searching for a way to ...
user avatar
0 votes
2 answers
53 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 ...
user avatar
  • 113
0 votes
1 answer
79 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 ...
user avatar
0 votes
1 answer
77 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 ...
user avatar
  • 103
0 votes
0 answers
99 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: ...
user avatar
2 votes
1 answer
45 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 /...
user avatar
2 votes
1 answer
82 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-...
user avatar
  • 123
0 votes
0 answers
272 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 ...
user avatar
1 vote
1 answer
103 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 <...
user avatar
1 vote
1 answer
419 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 ...
user avatar
  • 493
1 vote
0 answers
56 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 ...
user avatar
  • 193
0 votes
1 answer
85 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"...
user avatar
1 vote
0 answers
177 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 ...
user avatar
0 votes
0 answers
72 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 ...
user avatar
  • 155
0 votes
0 answers
114 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 ...
user avatar
0 votes
1 answer
177 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 ...
user avatar
-4 votes
2 answers
956 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 ...
user avatar
  • 89.7k
0 votes
1 answer
429 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 ...
user avatar
  • 89.7k
0 votes
1 answer
1k 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) { ... } //...
user avatar
  • 211
2 votes
1 answer
183 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....
user avatar
  • 23
0 votes
1 answer
406 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 ...
user avatar
  • 3
1 vote
1 answer
383 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 ...
user avatar
  • 105
0 votes
1 answer
724 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/...
user avatar
0 votes
0 answers
674 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 ...
user avatar
  • 2,145
0 votes
2 answers
2k 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....
user avatar
1 vote
1 answer
440 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(...
user avatar
  • 1,919
1 vote
0 answers
37 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 ...
user avatar
1 vote
1 answer
10k 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 ...
user avatar
  • 179
0 votes
0 answers
166 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 ...
user avatar
  • 193
1 vote
1 answer
167 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, ...
user avatar
  • 111
27 votes
4 answers
10k views

What is the gold linker?

Has anyone used the gold linker before? To link a fairly large project, I had to use this as opposed to the GNU ld, which threw up a few errors and failed to link. How is the gold linker able to link ...
user avatar
1 vote
0 answers
235 views

Objdump shows different symbols when disassembling and just printing symbols

Ubuntu 18.04 I have a simple ELF64 binary compiled from a C source file and linked with a shared object. I tried to examine it with objdump and got the following confusion: $ objdump -d -j .plt bin ...
user avatar
14 votes
2 answers
2k views

How can the dynamic linker/loader itself be dynamically linked as reported by `file`?

Consider the shared object dependencies of /bin/bash, which includes /lib64/ld-linux-x86-64.so.2 (dynamic linker/loader): ldd /bin/bash linux-vdso.so.1 (0x00007fffd0887000) libtinfo.so.6 =>...
user avatar
  • 3,287
3 votes
1 answer
2k views

How do library files (*.so) resolve shared dependencies?

If I invoke the following command: ldd mylib.so this then yields something along the lines of: libopencv_features2d.so.4.1 => /usr/local/lib/libopencv_features2d.so.4.1 (0x00007f83dee6b000) If ...
user avatar
  • 1,915
4 votes
1 answer
324 views

Is the dynamic linker automatically invoked by the operating system or by code embedded in the ELF file?

I'm not sure, whether the dynamic linker /usr/bin/ld is automatically invoked by the operating system, when the ELF file is loaded, or whether it's invoked by code embedded in the ELF file? When I ...
user avatar
  • 3,287

1
2 3 4 5 6