问题描述
我在我的 Linux Mint 14 Nadia 中安装了 Matlab(一个 uname -a 显示:Linux Ideapad-Z570 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux),当从命令行调用它时,我会得到一个:/lib64/libc.so not found".
I installed Matlab in my Linux Mint 14 Nadia (a uname -a shows: Linux Ideapad-Z570 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux) and when calling it from the command line I would get a: "/lib64/libc.so not found".
我按照 mathworks 的帮助在/lib64 中创建了一个链接:
I followed the help on mathworks by making a link in /lib64 as:
ln -s /lib/x86_64-linux-gnu/libc.so.6 .
解决了这个问题.
现在,如果我定位这个库,我会得到:
Now, if I do a locate of this library I get:
locate "libc.so"
/lib/i386-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6
/usr/lib/x86_64-linux-gnu/libc.so
我将在这台计算机上使用 gcc 进行编译,并且我想要完整的 64 位编译.拥有所有这些不同的 libc.so 库究竟意味着什么?gnu 编译器将使用哪一个?我需要对 gcc 做任何不同的事情来编译 64 位吗?
I will be compiling with gcc in this computer and I would like to have full 64bit compilations. What does exactly mean to have all these different libc.so libraries? which one will the gnu compiler be using? do I need to do anything different with gcc to compile for 64 bits?
我也很想为我的新 i7 内核尽可能多地优化!!!
I would also love to optimize as much as I can for my new i7 core!!!
推荐答案
这是该库的 32 位版本.
This is is 32-bit version of the library.
/lib/x86_64-linux-gnu/libc.so.6
这是该库的 64 位版本.
This is the 64-bit version of the library.
两者通常都是指向实际库文件的符号链接,通常会根据glibc版本号命名,例如libc-2.15.so
Both are usually symbolic links to the actual library file, which will usually be named according to the glibc release number, for example libc-2.15.so
/usr/lib/x86_64-linux-gnu/libc.so
这不是一个库,而是一个链接描述文件,引用了上面的符号链接.
This is not a library, but a linker script file, which refers to the above symlinks.
为什么我们需要所有这些:
Why do we need all these:
首先,无论安装的 libc 版本如何,链接器都将始终搜索 libc.so
,因为编译器驱动程序将始终将 -lc
选项传递给链接器.名称 libc
保持不变并表示库的最新版本.
First, regardless of libc version installed, the linker will always search for libc.so
, because the compiler driver will always pass to the linker the -lc
options. The name libc
stays the same and denotes to most recent version of the library.
符号链接 libc.so.6
以库的 soname 命名,它或多或少对应于库的 ABI 版本.链接到 libc.so
的可执行文件实际上包含对 libc.so.6
的运行时依赖.
The symlinks libc.so.6
are named after the soname of the library, which, more or less corresponds to the ABI version of the library. The executables, linked against libc.so
in fact contain runtime dependencies on libc.so.6
.
如果我们想象有一天会发布一个与 ABI 严重不兼容的 libc,那么它的 soname 可以命名为 libc.so.7
,例如,这个版本可以与旧的 libc.so 共存.6
版本,因此针对一个或另一个链接的可执行文件可以在同一系统中共存,
If we imagine the someday a grossly ABI incompatible libc is released, it's soname could be named libc.so.7
, for example and this version coukld coexists with the older libc.so.6
version, thus executables linked against one or the other can coexist in the same system,
最后,名称 libc-2.15.so
指的是 libc 版本,当您安装新的 libc 包时,名称将更改为 libc-2.16.so
.如果它与以前的版本二进制兼容,libc.so.6
链接将保持这种命名方式,现有的可执行文件将继续工作.
And finally, the name libc-2.15.so
refers to the libc release, when you install a new libc package, the name will change to libc-2.16.so
. Provided that it is binary compatible with the previous release, the libc.so.6
link will stay named that way and the existing executables will continue to work.
这篇关于/lib/i386-linux-gnu/libc.so.6、/lib/x86_64-linux-gnu/libc.so.6 和/usr/lib/x86_64-linux-gnu/libc.so 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!