I have different C++ compilers on my computer, each compiler has its own libstdc++.so and their size is different.
-rwxr-xr-x. 1 root root 967K Mar 22 2017 libstdc++.so.6.0.13
-rwxr-xr-x. 1 root root 6.5M Aug 1 2017 libstdc++.so.6.0.20
-rwxr-xr-x. 1 root root 11M Aug 1 2017 libstdc++.so.6.0.21
-rwxr-xr-x. 1 root root 12M Jan 30 16:58 libstdc++.so.6.0.24
I want to know why libstdc++.so.6.0.13 is so much smaller than others, and is there any way to reduce others' size. I will be glad if some one can help me.
Libstdc++ is the standard C++ library. It is needed to compile C++ code (part of GCC is written in C++), but we had to defer its installation when we built gcc-pass1 because it depends on glibc, which was not yet available in /tools. Approximate build time: 0.5 SBU. Required disk space: 878 MB.
This happens even when the libstdc++ is installed and the file is available in /usr/local/lib/libstdc++.so. By default, the ds_agent looks for the required library in the /opt/ds_agent/lib folder.
Libsupc++ is a support library for g++ that contains functions dealing with run-time type information (RTTI) and exception handling. If you attempt to use either exceptions or RTTI in a C++ kernel you have compiled with a GCC Cross-Compiler you will also need the libsupc++ library.
The versioning scheme of libstdc++ is misleading, the differences between these versions are actually huge when you consider the corresponding GCC versions:
There's been the C++14 implementation between GCC 4.4 and 4.9, and major work on C++17 and various experimental proposals after that.
From libstdc++'s FAQ:
Usually the size of libraries on disk isn't noticeable...
. . . the object files in question contain template classes and template functions, pre-instantiated, and splitting those up causes severe maintenance headaches.
So in short - not much can be done about the size. If you're really interested, you can see what's inside using readelf -a libname.so
You can always downgrade to an older GCC version which will come with a smaller libstdc++.
Having said that, on Ubuntu the size of libstdc++.so.6.0.24
is 1.54MB, so it didn't actually grow that much. There could be something wrong with your specific distro or maybe you grabbed a debug version. You can try stripping debug symbols with strip libstdc++.so.6.0.24
(the strip
utility is part of binutils
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With