From bfcafa4fbe7ee3063f359b2e26db81a96f4bfa9c Mon Sep 17 00:00:00 2001
From: Phil Edwards 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++: gcc-2.95.2 works well, or one of the post-2.95.2 GCC
+ 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 the nuevo automake, libtool
+ and autoconf to regenerate the Makefiles and configure
+ scripts. These tools are all required to be installed in the
+ same location (most linux distributions install these tools by
+ default, so no worries.)
+ If you don't have bash, and want to run 'make check' to
+ test your build, you'll need to get bash 2.x. Also recommended
+ is GNU Make, since it is the only 'make' that will parse these
+ makefiles correctly.
+ As of June 19, 2000, libstdc++ attempts to use tricky and
+ space-saving features of the GNU toolchain, enabled with
+ -ffunction-sections -fdata-sections -Wl,--gc-sections.
+ To obtain maximum benefit from this, binutils after this date
+ should also be used (bugs were fixed with C++ exception handling
+ related to this change in libstdc++-v3). The version of these
+ tools should be 2.10.90, and you can get snapshots (as
+ well as releases) of binutils
+ here.
+ Finally, a few system-specific requirements:
+ libstdc++-v3 INSTALL
+
+
+Contents
+
+
+
+
+
+
+
+Tools you will need beforehand
+
+
+
As the libstdc++-v3 sources and the core GCC sources have + converged, more and more effort goes to building the + library as the default version to be shipped with g++. With the + 2.90.8 snapshot, and especially for CVS versions after this + release, this is treated as the usual scenario. If you want to + build the library all by itself, you will need to explicitly + disable certain features (like namespaces) since the core GCC + library, libgcc.a, will not be rebuilt with those same features. + +
+ +By default, all configurations of libstdc++-v3 now have namespaces + enabled. Being able to select/de-select this option was a complex task + that had hopelessly confused many otherwise intelligent people, and + provided an endless stream of silent cursing and cries for help. + Because of this, gcc sources are required, and are no longer optional. +
+ +The following definitions will be used throughout the rest of this + document: +
Since the release of libstdc++-2.90.8, configuration patches have gone + into CVS gcc that make the management of the various libstdc++ source + trees a bit easier. Because of this, both libstdc++-v2 and + libstdc++-v3 and live together more or less in peace, without the need + for soft linking. If a CVS gcc source directory after April 5, 2000 is + being used, then the directions are slightly different: please pick + which of the following two scenarios best represents your particular + situation. +
+ +...with gcc-2.95.2 +
Unpack the gccsrcdir and go into that directory. For + instance, gcc-2.95.2 is a valid gccsrcdir. + Once in gccsrcdir, you'll need to rename the directories + called libstdc++ and libio like so: +
+ mv libstdc++ libstdc++-v2 + mv libio libio-v2+ +
Next, unpack the libstdc++-v3 library tarball into the + gccsrcdir directory; it will create a + libsrcdir called libstdc++-version: +
+ gzip -dc libstdc++-version.tar.gz | tar xf -+ +
Finally, make a soft link between libsrcdir and + libstdc++ so that libstdc++-v3 will be the default C++ + library used. +
+ ln -s libsrcdir libstdc+++ This complexity of having two completely separate libstdc++ + libraries is necessary so that you can unlink libsrcdir + and update the compiler sources. If you're not this adventurous, or + would not like to switch between different C++ standard libraries, + this extra effort is probably wasted; just remove the v2 sources. + + + +
...with CVS gcc +
Check out or download the gcc sources: the resulting source + directory is gccsrcdir. +
+Next, unpack the libstdc++-v3 library tarball into this + gccsrcdir directory; it will create a + libsrcdir called libstdc++-version: +
+ gzip -dc libstdc++-version.tar.gz | tar xf -+ + +
If CVS libstdc++-v3 is being used instead of a snapshot's tarball, + then move the source directory from the CVS checkout into the + gccsrcdir directory. + +
Finally, rename libsrcdir to libstdc++-v3 so that + gcc's configure flags will be able to deal with the new library. +
+ mv libsrcdir libstdc++-v3+ + + + +
Due to namespaces, 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. +
+ +...with gcc-2.95.2 +
+ gccsrcdir/configure --prefix=destdir+ + +
...with CVS gcc +
+ gccsrcdir/configure --prefix=destdir --enable-libstdcxx-v3+ + +
Adding --enable-libstdcxx-v3 automatically selects libstdc++-v3 + as the C++ library to be used alongside the C++ compiler being built, + and also enables -fhonor-std by default. This option is not available + with gcc-2.95.2. +
+ + +Now you have a few options:
+If you're building GCC from scratch, you can do the usual + 'make bootstrap' here, and libstdc++-v3 will be built + as its default C++ library. The generated g++ will magically + use the correct headers, link against the correct library + binary, and in general using libstdc++-v3 will be a piece of + cake. You're done; run 'make install' (the GCC + Installation instructions) to put the new compiler and libraries + into place. +
+ +Due to differences in the configure process, the resulting Makefiles + in thegccbuilddir will have different rules depending on + the source base being used. +
+ +...with gcc-2.95.2 +
+ libstdc++-rule is libstdc++ ++ + +
...with CVS gcc +
+ libstdc++-rule is libstdc++-v3 ++ + +
To rebuild just libstdc++, use: +
+ make all-target-libstdc++-rule+ This will configure and build the C++ library in the + gccbuilddir/cpu-vendor-OS/libstdc++ directory. + As en example, for CVS gcc this would be + make all-target-libstdc++-v3, and for gcc-2.95.2 it would be + make all-target-libstdc++ + +
If the build fails with a "warning: can't inline call" + message when compiling stringMAIN.cc, see the + resolution at the end of this document. +
+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+ or +
+ make install-gcc + make install-target-libstdc++-rule+ + + +
Installation will create the destdir directory and + populate it with subdirectories: +
+ lib/ + include/g++-v3/ + bits/ + backward/ + ext/+ +
You can check the status of the build without installing it using +
+ make check+ or you can check the status of the installed library using +
+ make check-target-libstdc++-rule+ 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: +
Use the ldd(1) utility to show which library the system + thinks it will get at runtime. +
+ + + + +When building the .8 snapshot with g++ 2.95.2, compilation may halt + with this warning message. The "problem" is the -Werror + flag being passed to the compiler, which says to treat warnings as + errors. (This plus a high warning level makes us track down bugs + quickly.) The compiler can't inline a certain call, prints + a warning, and dies. +
+The workaround is to edit either libsrcdir/src/Makefile.in + (before configuring) or bld-libstdc++/src/Makefile + (after configuring). There's one line that reads +
+ WERROR = -Werror+ Delete the flag itself, so that the line reads +
+ WERROR =+ Then the compiler will still print a warning, but it won't die. + +
For the curious, this "problem" is actually a symptom + of something else. The compiler in CVS could inline more than what + 2.95.2 does, and the libstdc++ changes were made with that + compiler. One of the libstdc++ maintainers explains this +here. +
+This has been patched in current CVS sources. +
+ + + + + + +
+Comments and suggestions are welcome, and may be sent to
+Phil Edwards or
+Gabriel Dos Reis.
+
$Id: install.html,v 1.12 2000/12/03 23:47:47 jsm28 Exp $
+