问题描述
我在写一个不是GNU GPL兼容的跨平台应用程序。我目前面临的主要问题是应用程序与glibc和libstdc ++动态链接,几乎每个新的主要更新的库不是向后兼容。因此,在我的应用程序中可以看到随机崩溃。
I'm writing a cross-platform application which is not GNU GPL compatible. The major problem I'm currently facing is that the application is linked dynamically with glibc and libstdc++, and almost every new major update to the libraries are not backwards compatible. Hence, random crashes are seen in my application.
作为一种解决方法,我分发我的应用程序的二进制文件编译在几个不同的系统(具有不同的C / C ++运行时版本)。但我想做没有这个。所以我的问题是,保持许可和一切记住,我可以链接到glibc和libstdc ++静态吗?此外,这会导致rtld有问题吗?
As a workaround, I distribute binaries of my application compiled on several different systems (with different C/C++ runtime versions). But I want to do without this. So my question is, keeping licensing and everything in mind, can I link against glibc and libstdc++ statically? Also, will this cause issues with rtld?
推荐答案
指定选项 -static-libgcc
到链接器将导致它链接到C库的静态版本(如果在系统上可用)。否则会被忽略。
Specifying the option -static-libgcc
to the linker would cause it to link against a static version of the C library, if available on the system. Otherwise it is ignored.
这篇关于使用glibc和libstdc ++静态链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!