How can you determine installed versions of glibc libraries?

I work with embedded Linux deployments and use a cross-compiler toolchain that does not compile I2C library function calls.

How to determine the exact library versions in the system so that I can rebuild the tool chain?

I am not going to replace the deployed libraries since I know that they work (including I2C), so I believe that I need the following:

  • Binutils Version
  • Gcc version
  • GLIBC
  • Kernel (for titles)

I think I can assume from the following that the binutils library is version 2.2.5. The kernel is modified for which I have a source.

root@dev-box />ls /lib/ -al drwxrwxrwx 3 root root 1024 Apr 27 09:44 . drwxrwxrwx 14 root root 1024 Jan 1 1970 .. -rwxrwxrwx 1 root root 105379 Jan 1 1970 ld-2.2.5.so lrwxrwxrwx 1 root root 16 Jan 1 1970 ld-linux.so.2 -> /lib/ld-2.2.5.so lrwxrwxrwx 1 root root 16 Jan 1 1970 ld.so.1 -> /lib/ld-2.2.5.so -rwxrwxrwx 1 root root 1288601 Jan 1 1970 libc.so.6 -rwxrwxrwx 1 root root 25441 Jan 1 1970 libcrypt.so.1 -rwxrwxrwx 1 root root 14303 Jan 1 1970 libdl.so.2 -rwxrwxrwx 1 root root 36800 Jan 1 1970 libgcc_s.so.1 -rwxrwxrwx 1 root root 530401 Jan 1 1970 libm.so.6 -rwxrwxrwx 1 root root 86626 Jan 1 1970 libnsl.so.1 -rwxrwxrwx 1 root root 17533 Jan 1 1970 libnss_dns.so.2 -rwxrwxrwx 1 root root 46324 Jan 1 1970 libnss_files.so.2 -rwxrwxrwx 1 root root 98633 Jan 1 1970 libpthread.so.0 -rwxrwxrwx 1 root root 69966 Jan 1 1970 libresolv.so.2 -rwxrwxrwx 1 root root 12897 Jan 1 1970 libutil.so.1 
+6
source share
3 answers

For glibc:

/lib/libc.so.6

It may sound strange to run such a file, but in this case you need to print version information

For kernel version use uname

For parsing binutils, the output of ld --version may give what you expect, the same for gcc --version . This is a little tiring, but I do not know another way.

+14
source

To find out the current installed version of glibc, copy and run the following C code.

 #include <stdio.h> #include <gnu/libc-version.h> int main (void) { puts (gnu_get_libc_version ()); return 0; } 

Greetings !!!

+1
source

a more complete answer can be found by running

 find /lib -iname 'libc*.so' 

On a recent system, this will give you results that show that I am using glibc 2.28 here on ubuntu 18.10

 /lib/x86_64-linux-gnu/libc-2.28.so /lib/x86_64-linux-gnu/libcrypt-2.28.so /lib/i386-linux-gnu/libc-2.28.so /lib/i386-linux-gnu/libcrypt-2.28.so 

For a multi-archive system, you can have multiple copies for 386 and 64 modes, I think they should be the same.

I did not have /lib/libc.so.* on my system.

0
source

Source: https://habr.com/ru/post/1308149/


All Articles