On Tue, 4 Aug 2020 at 20:28, Thompson, Matt (GSFC-610.1)[SCIENCE SYSTEMS AND APPLICATIONS INC] via Gcc-help <gcc-help@xxxxxxxxxxx> wrote: > > All, > > This might be a FAQ, but my Google-fu is being stymied by the fact that my searches are often finding issues about making executables, etc. made by GCC smaller rather than my issue: making GCC itself smaller. > > To wit, I'm trying to build some Docker images and found that the code I'm eventually trying to build with gcc (gfortran, actually) doesn't like the versions from RPMs/DEBs/etc. So, my first step is usually to do what I'm quite used to and build GCC a la: > > ../gcc-10.2.0/configure --prefix=$HOME/GCC/10.2.0 --disable-multilib --enable-languages=c,c++,fortran If you're not going to need them you can disable a number of features: --disable-nls --disable-libstdcxx-pch --disable-libcc1 --disable-libsanitizer --disable-libssp --disable-libgomp --disable-libvtv --disable-libstdcxx-filesystem-ts I wouldn't recommend this one, despite shrinking the size of libstdc++.so and libstdc++.a, because it is an ABI break: --disable-libstdcxx-dual-abi If this one still works it would also be an ABI break (and make C++ code compile slower): --disable-extern-template