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.

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.

The specific operating system and executable format determine how the dynamic linker functions and how it is implemented.

Linking is often referred to as a process that is performed at compile time of the executable while a dynamic linker is in actuality a special loader that loads external shared libraries into a running process and then binds those shared libraries dynamically to the running process. The specifics of how a dynamic linker functions is operating-system dependent.

In case of dynamic linking the linker while creating the executable does minimal work. For the dynamic linker to work it actually has to load the libraries too. Hence, it's also called linking loader.

Reference: Dynamic linker.

261 questions
186
votes
4 answers

Where do executables look for shared objects at runtime?

I understand how to define include shared objects at linking/compile time. However, I still wonder how do executables look for the shared object (*.so libraries) at execution time. For instance, my app a.out calls functions defined in the lib.so…
rahmu
  • 19,673
  • 28
  • 87
  • 128
164
votes
9 answers

How to find out the dynamic libraries executables loads when run?

I want to find out the list of dynamic libraries a binary loads when run (With their full paths). I am using CentOS 6.0. How to do this?
nakiya
153
votes
4 answers

How do SO (shared object) numbers work?

I'm aware that shared objects under Linux use "so numbers", namely that different versions of a shared object are given different extensions, for example: example.so.1 example.so.2 I understand the idea is to have two distinct files such that two…
user119
77
votes
2 answers

Getting "Not found" message when running a 32-bit binary on a 64-bit system

I have currently a strange problem on debian (wheezy/amd64). I have created a chroot to install a server (i can't give any more detail about it, sorry). Let's call its path /chr_path/. To make things easy, I have initialized this chroot with a…
Elenaher
  • 949
  • 1
  • 7
  • 8
32
votes
5 answers

What system call is used to load libraries in Linux?

In strace outputs, the paths to the libraries that executables call are in calls to open(). Is this the system call used by executables that are dynamically linked? What about dlopen()? open() isn't a call I'd have guessed would play a role in the…
Melab
  • 3,808
  • 8
  • 29
  • 49
31
votes
4 answers

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 large projects where ld fails? Is there some kind…
placid chat
  • 691
  • 1
  • 6
  • 19
31
votes
5 answers

Linux executable fails with "File not found" even though the file is there and in PATH

I want to launch the wine executable (Version 2.12), but I get the following error ($=shell prompt): $ wine bash: /usr/bin/wine: No such file or directory $ /usr/bin/wine bash: /usr/bin/wine: No such file or directory $ cd /usr/bin $ ./wine bash:…
akraf
  • 805
  • 1
  • 7
  • 14
28
votes
3 answers

Find where is a shared library symbol defined on a live system / list all symbols exported on a system

Basically, this is two questions into one - because if I can list all symbols exported within a system, along with their shared library path, then I could simply grep that output. For kernel symbols, I guess it is somewhat easier - because we can…
sdaau
  • 6,668
  • 12
  • 57
  • 69
24
votes
4 answers

Find out if library is in path

Assuming I want to test if a library is installed and usable by a program. I can use ldconfig -p | grep mylib to find out if it's installed on the system. but what if the library is only known via setting LD_LIBRARY_PATH? In that case, the program…
nbubis
  • 954
  • 3
  • 10
  • 23
22
votes
2 answers

What is the order that Linux's dynamic linker searches paths in?

This is not a duplicate because this is dealing with a peculiarity I noticed when I use /etc/ld.so.conf. To get the paths that the dynamic linker searches in for libraries, I run the command ldconfig -v | grep -v "^"$'\t' | sed "s/:$//g". When…
Melab
  • 3,808
  • 8
  • 29
  • 49
21
votes
2 answers

How to upgrade shared library without crash?

Here it says that you can rewrite an executable file and the process will run just fine - it will be re-read when a process restarts. However, when I try to replace a binary file while the process is running (with scp, from dev to test server) it…
Sam
  • 355
  • 1
  • 2
  • 7
17
votes
1 answer

Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?

I have a binary executable named "alpha" that requires a linked library (libz.so.1.2.7) which is placed at /home/username/myproduct/lib/libz.so.1.2.7 I export the same to my terminal instance before spawning my binary executable by executing the…
daedalus_hamlet
  • 331
  • 1
  • 9
17
votes
3 answers

"which" equivalent for shared libraries

I am looking for a utility that would behave in the same way as which, but to look up shared libraries (*.so) in the directories defined in $LD_LIBRARY_PATH?
rahmu
  • 19,673
  • 28
  • 87
  • 128
17
votes
9 answers

Problem to launch java at Debian: "error while loading shared libraries: libjli.so"

I'm trying to launch java: $ java -version java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory $ ldd /usr/lib/jvm/java-6-openjdk/jre/bin/java linux-gate.so.1 => (0xb779f000) …
aetaur
  • 171
  • 1
  • 1
  • 4
17
votes
1 answer

Installing two glibc alongside in debian/ubuntu

Is it possible to install and use two different glibc versions on the same machine. Where one version is only used to run legacy software, which relies on old glibc binaries? Is it possible to do that with the aid of the package manager (something…
Elazar Leibovich
  • 3,131
  • 5
  • 27
  • 28
1
2 3
17 18