On 20 March 2017 at 14:45, Xi Ruoyao wrote: > Hi all, > > At first I would like to tell my sad story: > > I'm working on some strange math problem and want to use GCC > to compile MATLAB MEX files. Unfortunately, MATLAB rejects recent > GCC but accepts GCC-4.7. > > So I checkouted GCC-4.7.4, compiled it with program-suffix=-4.7. > I thought with this suffix, I can install it without damage my system > (only thing has to be done is recreate libstdc++.so link to > libstdc++.so.6.0.23). > > At first it seems OK, but after I put down the math thing and gone to > hack GCC code, I found out I can't compile GCC anymore... Then I > noticed -static-libstdc++ in GCC Makefile and realized my libstdc++.a > had been replaced by libstdc++ 6.0.17. At last I had to use GCC-4.7 > to bootstrap GCC trunk version again. > > I know I've made a serious mistake to install ancient GCC with only > a program suffix (w/o a different prefix). Then I have an idea to > install libstdc++.a to $prefix/lib/gcc/$arch/$version so that each GCC > version would be able to use its own static libstdc++ and no version > would be broke with -static-libstdc++. There's a configure option that should do something like that: --enable-version-specific-runtime-libs but it's broken for multilib: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32415 > My question is: is this really a good idea or I'm making serious > mistakes again? It's probably not a good idea to install to the same prefix as the system compiler unless you're going to be *very* careful to avoid conflicts, which is hard to do if you just run "make install" as root. In theory it can be made to work though.