As of May 31, 2023, we have updated our Code of Conduct.
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 ...
Ciro Santilli OurBigBook.com's user avatar
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 ...
taliezin's user avatar
  • 9,035
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 ...
Stephen Kitt's user avatar
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,...
Michael Homer's user avatar
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 ...
Stephen Kitt's user avatar
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 ...
Stephen Kitt's user avatar
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 ...
Stephen Kitt's user avatar
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, ...
Stephen Kitt's user avatar
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 ...
Thomas Dickey's user avatar
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 ...
Stephen Kitt's user avatar
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 ...
Kusalananda's user avatar
  • 316k
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 ...
Stephen Kitt's user avatar
27 votes

How to install libtoolize as non-root user

The software package is libtool : https://www.gnu.org/software/libtool/
schaiba's user avatar
  • 7,415
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.
Stéphane Chazelas's user avatar
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 ...
Philip Kendall's user avatar
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 ...
Austin Hemmelgarn's user avatar
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 ...
Ciro Santilli OurBigBook.com's user avatar
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, ...
Stephen Kitt's user avatar
17 votes

How to install libtoolize as non-root user

This solves the problem: sudo apt-get install libtool
CommonSenseCode's user avatar
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 ...
David Kariuki's user avatar
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
arsenpa's user avatar
  • 186
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 ...
jpa's user avatar
  • 1,269
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 ...
Gongora's user avatar
  • 251
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 /...
Michael D.'s user avatar
  • 2,790
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 ...
Arkadiusz Drabczyk's user avatar
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 ...
White Owl's user avatar
  • 4,363
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
Mikhail Ramendik's user avatar
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 ...
Stephen Kitt's user avatar
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....
blaatenator's user avatar
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 ...
Olivier's user avatar
  • 625

Only top scored, non community-wiki answers of a minimum length are eligible