如何确定 glibc 库的安装版本?

发布于 2024-08-30 07:00:46 字数 1323 浏览 3 评论 0原文

我正在使用嵌入式 Linux 部署,并使用不编译 I2C 库函数调用的交叉编译器工具链。

如何确定系统上库的精确版本,以便我可以重建工具链?

我不打算替换已部署的库,因为我知道它们可以工作(包括 I2C) ,所以我相信我需要以下内容:

  • Binutils 版本
  • GCC 版本
  • GLIBC
  • 内核(用于标头)

我想我可以从以下内容假设 binutils 库是版本 2.2.5。内核经过修改,我有源代码。

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

I'm working with an embedded Linux deployment and am using a cross compiler tool chain that doesn't compile I2C library function calls.

How do I determine the precise versions of the libraries on the system so that I may rebuild the tool chain?

I don't intend to replace the libraries deployed, as I do know they work (including I2C), so I believe I need the following:

  • Binutils version
  • GCC version
  • GLIBC
  • Kernel (for the headers)

I think I can assume from the following that the binutils library is version 2.2.5. The kernel is modded for which I've the 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

彼岸花ソ最美的依靠 2024-09-06 07:00:46

对于 glibc:

/lib/libc.so.6

运行 so 文件听起来可能很奇怪,但在这种情况下应该打印出版本信息

对于内核版本,请使用 uname

对于binutils 解析 ld --version 的输出可能会产生您所期望的结果,对于 gcc --version 也是如此。这有点乏味,但我不知道另一种方法。

For glibc:

/lib/libc.so.6

Sounds maybe strange to run a so file but should print out version information in this case

For the kernel version use uname

For the binutils parsing the output of ld --versionmight yield what you expect, the same for gcc --version. This is a bit tedious but I do not know another way.

滥情空心 2024-09-06 07:00:46

可以通过运行在最近的系统上找到更全面的答案,

find /lib -iname 'libc*.so'

这将为您提供这样的结果,表明我在 ubuntu 18.10 上使用 glibc 2.28

/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

对于多体系结构系统,您可以拥有 386 和 64 模式的多个副本,我认为这些应该是一样的。

我的系统上没有 /lib/libc.so.* 。

a more comprehensive answer can be found by running

find /lib -iname 'libc*.so'

On a recent system this will give you results like this that show i'm 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 multiarch system you can have multiple copies for 386 and 64 modes , i think these should be the same .

i didn't have a /lib/libc.so.* on my system.

清醇 2024-09-06 07:00:46

要了解当前安装的 glibc 版本,请编译并运行以下 C 代码。

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

干杯!

To know the current installed version of glibc, please compile and run the following C code.

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

Cheers !!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文