Skip to main content
59 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
42 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
42 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
37 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
36 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
33 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
30 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,659
30 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
29 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
  • 339k
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
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
22 votes

Stereo "tone-generator" for linux?

ffmpeg ffmpeg can do it, as usual. Create a 2 second mono 1000 Hz sinusoidal out.wav sound file: sudo apt-get install ffmpeg ffmpeg -f lavfi -i "sine=f=1000:d=2" out.wav Stereo instead with ...
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
20 votes

Is it safe to delete these snaps?

Yes it is safe to free up some space by deleting the snap cache in /var/lib/snapd/snaps/ when the folder grows large. Try this: sudo apt purge snapd Warning: This should actually remove that ...
David Kariuki's user avatar
19 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
  • 206
17 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,890
17 votes

How to install libtoolize as non-root user

This solves the problem: sudo apt-get install libtool
CommonSenseCode's user avatar
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
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
14 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
  • 5,149
12 votes

How to change the path of shared libraries shown by ldd?

This has been covered in part in many tutorials, but I feel many of the solutions are missing a basic example. For Linux, patchelf can accomplish this on Linux. For MacOS, there's a tool called ...
tresf's user avatar
  • 323
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

Do we need c libraries when running a program?

You have a program that calls a library function. In this case, it's the system standard library, also called “the C library” (but there are many other libraries that can be called from C code, this ...
Gilles 'SO- stop being evil''s user avatar
10 votes

Viewing Linux Library / Executable version info

Run this to get version information - strings libssl.so.1.0.0 | grep "1\.0" SSLv3 part of OpenSSL 1.0.2p-fips 14 Aug 2018 OpenSSL 1.0.2p-fips 14 Aug 2018 TLSv1 part of OpenSSL 1.0.2p-fips 14 Aug ...
yarick's user avatar
  • 209

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