About static libstdc++

Xi Ruoyao ryxi@stu.xidian.edu.cn
Mon Mar 20 16:12:00 GMT 2017


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++.

My question is: is this really a good idea or I'm making serious
mistakes again?
-- 
Xi Ruoyao <ryxi@stu.xidian.edu.cn>
School of Aerospace Science and Technology, Xidian University



More information about the Gcc-help mailing list