Whole document tree
The latest version of this document is always available at http://gcc.gnu.org/onlinedocs/libstdc++/install.html.
To the libstdc++-v3 homepage.
You will need a recent version of g++ to compile the snapshot of libstdc++, such as one of the GCC 3.x snapshots (insert standard caveat about using snapshots rather than formal releases). You will need the full source distribution to whatever compiler release you are using. The GCC snapshots can be had from one of the sites on their mirror list.
In addition, if you plan to modify the makefiles or regenerate the configure scripts you'll need recent versions of the GNU Autotools: autoconf (version 2.50 or later), automake (version 1.4 or later), and libtool (multilanguage, version 1.4 or later), in order to rebuild the files. These tools are all required to be installed in the same location (most linux distributions install these tools by default, so no worries as long as the versions are correct).
GNU Make is the only 'make' that will parse the makefiles correctly.
To test your build, you will need either DejaGNU 1.4 (to run
As of June 19, 2000, libstdc++ attempts to use tricky and
space-saving features of the GNU toolchain, enabled with
The following definitions will be used throughout the rest of this document:
Check out or download the gcc sources: the resulting source directory
mv libstdc++-v3 libstdc++-v3-previous [OR] rm -r libstdc++-v3
Next, unpack the libstdc++-v3 library tarball into this
gccsrcdir directory; it will create a
gzip -dc libstdc++-version.tar.gz | tar xf -
Finally, rename libsrcdir to
mv libsrcdir libstdc++-v3
If you have never done this before, you should read the basic GCC Installation Instructions first.
When building libstdc++-v3 you'll have to configure the entire gccsrcdir directory. The full list of libstdc++-v3 specific configuration options, not dependent on the specific compiler release being used, can be found here.
Consider possibly using --enable-languages=c++ to save time by only building the C++ language parts.
cd gccbuilddir gccsrcdir/configure --prefix=destdir --other-opts...
Now you have a few options:
If you're building GCC from scratch, you can do the usual
[re]building only libstdc++
To rebuild just libstdc++, use:
make all-target-libstdc++-v3This will configure and build the C++ library in the gccbuilddir/cpu-vendor-os/libstdc++ directory.
If you are rebuilding from a previous build [attempt], some information is kept in a cache file. This is stored in gccbuilddir/cpu-vendor-os/ if you are building with multilibs (the default), or in gccbuilddir/cpu-vendor-os/libstdc++-v3 if you have multilibs disabled. The filename is config.cache; if previous information is causing problems, you can delete it entirely, or simply edit it and remove lines.
You're done. Now install the rebuilt pieces with
make install-gcc make install-target-libstdc++-v3
Installation will create the destdir directory and populate it with subdirectories:
lib/ include/g++-v3/ backward/ bits/ cpu-vendor-os/bits/ ext/
You can check the status of the build without installing it using
make checkor you can check the status of the installed library using
make check-installin the libbuilddir directory. These commands will create a 'testsuite' directory underneath libbuilddir containing the results of the tests. We are interested in any strange failures of the testsuite; please see FAQ 2.4 for which files to examine.
If you only built a static library (libstdc++.a), or if you specified static linking, you don't have to worry about this. But if you built a shared library (libstdc++.so) and linked against it, then you will need to find that library when you run the executable.
Methods vary for different platforms and different styles, but the usual ones are printed to the screen during installation. They include:
A libstdc++.la file is also installed, for use with Libtool. If you use Libtool to create your executables, these details are taken care of for you.