https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Daniel Richard G. from comment #8) > First, GCC can't find its own runtime library when linking programs: > > /usr/bin/ld: cannot find -lgcc_s That's Bug 35248, it's a problem with --enable-version-specific-runtime-libs > I can specify -L$(PREFIX)/lib/gcc/x86_64-unknown-linux-gnu/lib64 manually, > and that allows things to link. But then, unless I futz with > ld.so.conf/LD_LIBRARY_PATH, the resulting executable uses the wrong instance > of libgcc/libstdc++: Yes, that's how linking works. https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.how_to_set_paths