简体   繁体   中英

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). 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; it must also be compiled and dynamically linked. Thus, I'm trying to compile and statically link 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.

But, for the question itself...

How to you compile glibc (32-bit and 64-bit)?

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.

git clone git://sourceware.org/git/glibc.git

Any thoughts or suggestions are welcomed.

My translation: my static dependency library cannot dynamically use glibc; it must also be compiled and dynamically linked. Thus, I'm trying to compile and statically link glibc.

As nm pointed out, your translation is wrong.

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.

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).

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM