Compiling one shared library on Linux to target all distributions

杀马特。学长 韩版系。学妹 提交于 2019-12-03 15:21:12

I answered this at https://gcc.gnu.org/ml/libstdc++/2014-05/msg00107.html

This looks like https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54482 so might be fixed in GCC 4.7.3 (but I'm not sure)

...

PIC is implemented differently for x86 and x86_64, because 64-bit mode has built-in support for it.

Linking statically to libc/libstdc++ should not be done, even if it works! It is quite dangerous, because a lot of security aspects requires updates to libc. If statically linked in no update can fill the hole.

I can't believe that a 'generic' libc exists which works on all linux platforms. The libc is the interface to the installed system which is big pool of differences. How should one lib fits all?

While linking you could try

-static-libstdc++ -static-libgcc

as options to ld. Maybe this helps. But I would never do that!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!