Why do I have libc.so.6 under /usr/lib/x86_64-linux-gnu directory?
After I read this question difference between libc6-dev and libc6 , I started a fresh Ubuntu 20.04 LTS
VPS and went checking what files are included in some Ubuntu packages.
I checked libc6-dev
(https://packages.ubuntu.com/focal/amd64/libc6-dev/filelist) and libc6
(https://packages.ubuntu.com/focal/amd64/libc6/filelist).
As we can see, the libc6-dev
have those share libraries under /usr/lib/x86_64-linux-gnu/
and libc6
‘s share libraries are under /lib/x86_64-linux-gnu/
.
But what makes me curious is that:
-
I also have
libc.so.6
under/usr/lib/x86_64-linux-gnu/
(libc.so.6 -> libc-2.31.so*
). Andapt install remove libc6-dev
doesn’t removelibc.so.6
. Where does thislibc.so.6
come from? -
The
-rw-r--r-- 1 root root 298 Apr 7 09:24 libc.so
installed bylibc6-dev
packge is only298
bytes, what? Why?
sudo apt list --installed
output: https://pastebin.com/geDjY2z2
ll -h | grep libc
output: https://pastebin.com/UHn5QVt1
ll -h | grep libc
output, left(remove libc6-dev
):
libc.so.6
is part of the libc6
package. It is only in the file list in /lib/x86_64-linux-gnu
, but /lib
is a symlink to /usr/lib
, so it shows up in /usr/lib/x86_64-linux-gnu
as well. libc.so.6
is the library which programs using the C library refer to:
$ ldd /bin/true
linux-vdso.so.1 (0x00007ffc797a9000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc865f4a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc86614b000)
libc.so
is used when building programs, and is a linker script rather than a library; you can examine its contents:
$ cat /lib/x86_64-linux-gnu/libc.so
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) )