112
votes
How to find out the dynamic libraries executables loads when run?
readelf -d $executable | grep 'NEEDED'
Can be used if you can't run the executable, e.g. if it was cross compiled, or if you don't trust it:
In the usual case, ldd invokes the standard dynamic ...
59
votes
How to check if a shared library is installed?
You can use:
ldconfig -p | grep libavfilter
If there is no output library is not installed. I am not sure if this is 100% reliable.
At least in man page of ldconfig for option -p:
Print the lists ...
55
votes
Accepted
What is /lib64/ld-linux-x86-64.so.2 and why can it be used to execute file?
That’s the dynamic linker; if you run it on its own, it will tell you what it does:
Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]
You have invoked ‘ld.so’, the helper program for ...
41
votes
How to execute library commands from the shell?
You probably shouldn't do this, but you can. Kusalananda's answer is better for the task at hand and explains the issue. Since you did ask specifically how to use any library calls inside the terminal,...
41
votes
Accepted
Why doesn't the Linux kernel have optimized functions like glibc does (e.g., memchr, strchr)?
The kernel does have optimised versions of some of these functions, in the arch-specific directories; see for example the x86 implementation of memchr (see all the memchr definitions, and all the ...
35
votes
Accepted
Do C compilers discard unused functions when statically linking to .a file?
By default, linkers handle object files as a whole. In your example, the executable will end up containing the code from main.c (main.o), and any object files from libmine.a (which is an archive of ...
31
votes
Accepted
What is the default value of LD_LIBRARY_PATH?
The usual dynamic linker on Linux uses a cache to find its libraries. The cache is stored in /etc/ld.so.cache, and is updated by ldconfig which looks on the paths it’s given in /etc/ld.so.conf (and ...
31
votes
Accepted
How to convince dpkg that libssl1.0.2 is >= libssl1.0.0?
libssl1.0.2 and libssl1.0.0 are different packages, providing incompatible libraries; that’s why you can’t satisfy a libssl1.0.0 dependency using libssl1.0.2.
To satisfy your package’s requirements, ...
28
votes
How to find out the dynamic libraries executables loads when run?
ldd and lsof show the libraries loaded either directly or at a given moment. They do not account for libraries loaded via dlopen (or discarded by dlclose). You can get a better picture of this using ...
28
votes
Accepted
Almost no commands working - relocation error: symbol __getrlimit, version GLIBC_PRIVATE not defined in libc.so.6
Since you can log in, nothing major is broken; presumably your shell’s startup scripts add ~/lib to LD_LIBRARY_PATH, and that, along with the bad libraries in ~/lib, is what causes the issues you’re ...
28
votes
How to execute library commands from the shell?
The apropos command is useful in many ways, but it does give you a lot of "junk" too. Most of the things that you list are C library routines (this is what section 3 of the manual is for), which you ...
28
votes
Accepted
Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?
But why does it not do the same until it finds the expected version rather than accepting the first instance of library irrespective of its version?
It does, as far as it’s aware. zlib.so.1.2.7 and ...
27
votes
How to install libtoolize as non-root user
The software package is libtool : https://www.gnu.org/software/libtool/
27
votes
Accepted
How do I trace library loading?
If on a GNU system, try running your application with:
LD_DEBUG=libs your-application
See LD_DEBUG=help for more options or man ld.so.
24
votes
Almost no commands working - relocation error: symbol __getrlimit, version GLIBC_PRIVATE not defined in libc.so.6
The problem is that you have put a copy of glibc into your ~/lib directory, and that library is incompatible with the system you've uploaded it to. The library is being referenced as ~/lib is ...
23
votes
Accepted
What's the difference between a binary file and a library?
Your understanding is mostly correct, but there are a couple of extra things to consider:
'binary' refers to something that isn't human readable. This usually refers to machine code, but many other ...
21
votes
Stereo "tone-generator" for linux?
ffmpeg
ffmpeg can do it, as usual.
Create a 5 seconds mono 1000Hz sinusoidal out.wav sound file:
sudo apt-get install ffmpeg
ffmpeg -f lavfi -i "sine=frequency=1000:duration=5" out.wav
...
20
votes
Is the vdso shared library (linux-vdso.so) the library that contains the kernel object code (system calls)?
System calls are implemented in the kernel, as mentioned in the answer to your followup question. vDSO, the virtual dynamic shared object, is a small virtual library, also implemented by the kernel, ...
17
votes
How to install libtoolize as non-root user
This solves the problem:
sudo apt-get install libtool
17
votes
Is it safe to delete these snaps?
Yes it is safe to free up some space by deleting the the snap cache in /var/lib/snapd/snaps/ when the folder grows large.
Try this:
sudo apt purge snapd
This should actually remove that dir and all ...
17
votes
Accepted
opt/lampp/bin/httpd: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
I had the same error, solved by installing this package "libxcrypt-compat".
It is not in pacman, install via AUR.
yay -S libxcrypt-compat
16
votes
How to execute library commands from the shell?
I wouldn't do this for just strlen(), but it is a useful trick for trying out C code sometimes.
user@host:~$ gdb gdb
(gdb) start
Temporary breakpoint 1, ... in main ()
(gdb) print strlen("foobar")
$1 ...
15
votes
How to find out the dynamic libraries executables loads when run?
lsof also can show you which libraries are being used for one particular process.
i.e.
$ pidof nginx
6920 6919
$ lsof -p 6919|grep mem
nginx 6919 root mem REG 0,64 65960 ...
15
votes
Relationship between ldconfig and ld.so.cache
Linux programs are using libraries which are called shared objects. Shared objects have the extension .so. To see the S.O. usage of the command ls run ldd /bin/ls
By default, libs are stored in /lib /...
14
votes
Accepted
Fix hardcoded dynamic linking for executable
I don't have the same binary you have but I made a little test and it
seems that patchelf can work here. I have a hello binary compiled
with -Wl,-rpath=/home/ja/c/hello-puts/make/lib and libtest.so ...
13
votes
Do C compilers discard unused functions when statically linking to .a file?
Yes. But it is on a module level, not on a function.
For example, you have two source files: foo_goo.c and bar.c
// foo_goo.c
int foo() { .. };
int goo() { .. };
// bar.c
int bar() { .. };
Compile ...
12
votes
Accepted
Fedora 27 /usr/bin/ld: cannot find -lstdc++
Okay, I found what file it's looking for using strace, and the answer was libstdc++.a , so I fixed it by installing the libstdc++-static package
12
votes
What is libstdc++.so.6 and GLIBCXX_3.4.20?
What is libstdc++.so.6? Is this just a library that gcc ships with?
It’s GCC’s implementation of the C++ Standard Library.
What are all the different GLIBCXX_*? Are these also libraries?
These ...
11
votes
Accepted
libdnet is installed but can't be found by snort
I also upgraded recently to Fedora 22 and experienced the same issue. I resolved it by creating a symlink called libd.1 which points to (in my case) libdnet.so.1.0.1:
ln -s /usr/lib64/libdnet.so.1.0....
11
votes
Accepted
What is the purpose of libimf.so?
It is the Intel Math Library. It contains optimized versions of functions such as sin, pow, etc typically found in libm. It is needed by software built with the intel compiler unless steps were taken ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
libraries × 553linux × 76
compiling × 60
dynamic-linking × 55
software-installation × 52
shared-library × 50
debian × 48
ubuntu × 41
centos × 33
dependencies × 29
package-management × 28
gcc × 27
rhel × 22
python × 22
make × 20
arch-linux × 17
fedora × 16
apt × 15
c × 15
c++ × 15
openssl × 14
path × 13
glibc × 13
linker × 13
yum × 11