当前位置: 技术问答>linux和unix
请教:如何知道当前所用的gcc调用的是哪个版本的glibc库?及这个glibc库的位置?谢谢!
来源: 互联网 发布时间:2016-06-10
本文导语: 如题:我的虚拟机上有gcc 和 arm-uclinux-gcc ,但我不知道gcc 调用的是哪个版本的glibc程序库, 以及该库存放在什么地方?同理,arm-uclinux-gcc 调用的是哪个版本的uClibc库,及该库的位置, 请大家指点一下...
如题:我的虚拟机上有gcc 和 arm-uclinux-gcc ,但我不知道gcc 调用的是哪个版本的glibc程序库,
以及该库存放在什么地方?同理,arm-uclinux-gcc 调用的是哪个版本的uClibc库,及该库的位置,
请大家指点一下,非常感谢!
以及该库存放在什么地方?同理,arm-uclinux-gcc 调用的是哪个版本的uClibc库,及该库的位置,
请大家指点一下,非常感谢!
|
使用ldd指令 可以看到程序连接的动态库
如下
[root@R020 ~]# ldd /bin/ls
linux-gate.so.1 => (0x0016b000)
librt.so.1 => /lib/librt.so.1 (0x48319000)
libacl.so.1 => /lib/libacl.so.1 (0x41b1f000)
libselinux.so.1 => /lib/libselinux.so.1 (0x48324000)
libc.so.6 => /lib/libc.so.6 (0x41991000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4cb7d000)
/lib/ld-linux.so.2 (0x4196f000)
libattr.so.1 => /lib/libattr.so.1 (0x41b18000)
libdl.so.2 => /lib/libdl.so.2 (0x4c908000)
libsepol.so.1 => /lib/libsepol.so.1 (0x41b38000)
直接在shell下运行libc.so.6可以得到c library版本
[root@R020 ~]# /lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1 20061011 (Red Hat 4.1.1-30).
Compiled on a Linux 2.6.9 system on 2007-03-14.
Available extensions:
The C stubs add-on version 2.1.2.
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
GNU libio by Per Bothner
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
RT using linux kernel aio
Thread-local storage support included.
For bug reporting instructions, please see:
.
如下
[root@R020 ~]# ldd /bin/ls
linux-gate.so.1 => (0x0016b000)
librt.so.1 => /lib/librt.so.1 (0x48319000)
libacl.so.1 => /lib/libacl.so.1 (0x41b1f000)
libselinux.so.1 => /lib/libselinux.so.1 (0x48324000)
libc.so.6 => /lib/libc.so.6 (0x41991000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4cb7d000)
/lib/ld-linux.so.2 (0x4196f000)
libattr.so.1 => /lib/libattr.so.1 (0x41b18000)
libdl.so.2 => /lib/libdl.so.2 (0x4c908000)
libsepol.so.1 => /lib/libsepol.so.1 (0x41b38000)
直接在shell下运行libc.so.6可以得到c library版本
[root@R020 ~]# /lib/libc.so.6
GNU C Library stable release version 2.5, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1 20061011 (Red Hat 4.1.1-30).
Compiled on a Linux 2.6.9 system on 2007-03-14.
Available extensions:
The C stubs add-on version 2.1.2.
crypt add-on version 2.1 by Michael Glad and others
GNU Libidn by Simon Josefsson
GNU libio by Per Bothner
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
RT using linux kernel aio
Thread-local storage support included.
For bug reporting instructions, please see:
.
|
用strace跟踪一下,什么都出来了,当让,ls的ldd也很好用
|
可以追踪动态链接库
strace的信息详细一点
strace的信息详细一点
|
再通过这种方法调用一次
strace gcc -g -o ./hello ./hello.c
你可以结合其他工具来过滤信息的嘛。。。。这样你就可以更容易的看到glibc库(源代码)的位置了
strace gcc -g -o ./hello ./hello.c
你可以结合其他工具来过滤信息的嘛。。。。这样你就可以更容易的看到glibc库(源代码)的位置了