The source, build, and installation directories should
not be parents of one another; i.e., these should all be
separate directories. Please don't build out of the
source directory.
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 in peace, without the need
for soft linking. The setup instructions are slightly different,
depending on whether you want to use CVS gcc or a snapshot. Please
choose the appropriate scenario:
...with a gcc-2.9[67] snapshot
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 or delete
the libstdc++-v3 directory which comes with that snapshot:
mv libstdc++-v3 libstdc++-v3-previous
[OR]
rm -r libstdc++-v3
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++-v3
so that libstdc++-v3 will be the default C++
library used.
ln -s
libsrcdir
libstdc++-v3
...with CVS gcc
Check out or download the gcc sources: the resulting source
directory is
gccsrcdir
. Once in
gccsrcdir
,
you'll need to rename or delete the libstdc++-v3 directory
which comes with that snapshot:
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
libsrcdir
called
libstdc++-
version
:
gzip -dc libstdc++-version.tar.gz | tar xf -
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
If you have never done this before, you should read the basic
GCC Installation
Instructions
first.
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.
cd
gccbuilddir
gccsrcdir
/configure --prefix=
destdir
--other-opts...
Now you have a few options:
[re]building
everything
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'
(see the GCC
installation instructions) to put the new compiler and libraries
into place.
[re]building only libstdc++
To rebuild just libstdc++, use:
make all-target-
libstdc++-v3
This 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
make install-gcc
make install-target-libstdc++-v3
Installation will create the
destdir
directory and
populate it with subdirectories:
include/g++-v3/
bits/
CPU-vendor-OS/include/g++-v3/
bits/
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-install
in 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.