问题
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