[英]How to you compile glibc (32-bit and 64-bit)?
Right now, I have a modified version of a open-source dependency library (mylib.a file) in my project and thus I have it statically linked via gcc command(s).现在,我的项目中有一个开源依赖库(mylib.a 文件)的修改版本,因此我通过 gcc 命令静态链接了它。 I am getting the error that...
我收到的错误是...
"statically linked applications require at runtime the shared libraries from the glibc version used for linking"
My translation: my static dependency library cannot dynamically use glibc;我的翻译:我的静态依赖库不能动态使用glibc; it must also be compiled and dynamically linked.
它也必须被编译和动态链接。 Thus, I'm trying to compile and statically link glibc.
因此,我正在尝试编译和静态链接 glibc。
I've gather that they would need to be compiled, the *.a library placed in a folder within the project, the "-I//location//" added in for the include headers, and the "-L//location//" added in for the libraries themselves.我收集到它们需要编译,*.a 库放置在项目内的文件夹中,为包含头添加了“-I//location//”,以及“-L//location” //" 为库本身添加。
But, for the question itself...但是,对于问题本身......
How to you compile glibc (32-bit and 64-bit)?如何编译 glibc(32 位和 64 位)?
Through open-source research, I've found this link and I have cloned the repo but I cannot find any documentation on how to actually compile it.通过开源研究,我找到了这个链接,我克隆了这个 repo,但我找不到任何关于如何实际编译它的文档。
git clone git://sourceware.org/git/glibc.git
Any thoughts or suggestions are welcomed.欢迎任何想法或建议。
My translation: my static dependency library cannot dynamically use glibc;
我的翻译:我的静态依赖库不能动态使用glibc; it must also be compiled and dynamically linked.
它也必须被编译和动态链接。 Thus, I'm trying to compile and statically link glibc.
因此,我正在尝试编译和静态链接 glibc。
As nm pointed out, your translation is wrong.正如 nm 指出的那样,您的翻译是错误的。
You are trying to link a fully static executable, and GLIBC is warning you that such executable will not run correctly on any machine with a different version of GLIBC installed.您正在尝试链接一个完全静态的可执行文件,而 GLIBC 警告您此类可执行文件将无法在安装了不同版本 GLIBC 的任何机器上正确运行。
Instead of trying to build a fully-static executable, build it such that it uses libc.so.6
(you can still link mylib.a
into such executable).不要尝试构建完全静态的可执行文件,而是构建它以使用
libc.so.6
(您仍然可以将mylib.a
链接到此类可执行文件)。
IF the reason you added -static
to your link is that you have both libmylib.a
and libmylib.so
, and would like to link in the former instead of the latter, read this answer .如果您在链接中添加
-static
的原因是您同时拥有libmylib.a
和libmylib.so
,并且希望链接前者而不是后者,请阅读此答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.