Statically linked gcc

大憨熊 提交于 2019-12-11 04:32:47

问题


Is there any method to build statically linked gcc compiler? If yes, what flags of configure/make should I use? I expect getting gcc and g++ binary files which should be "not a dynamic executable" (while checking with ldd tool, for example).


回答1:


Disabling all shared options is a good start. Then using e.g. --with-stage1-ldflags and --with-boot-ldflags to set linker flags to link statically could be used. – Some programmer dude

It worked! Here is used configure flags:

../configure --prefix=/home/myuser/soft/gcc-6.2.0/myusr/ --enable-multilib --enable-languages=c,c++ --disable-shared --disable-host-shared --with-boot-ldflags=-static --with-stage1-ldflags=-static

– AccumPlus



来源:https://stackoverflow.com/questions/41099893/statically-linked-gcc

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