1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
4 <META NAME="AUTHOR" CONTENT="pme@sources.redhat.com (Phil Edwards)">
5 <META NAME="KEYWORDS" CONTENT="libstdc++, libstdc++-v3, GCC, g++">
6 <META NAME="DESCRIPTION" CONTENT="README for the GNU libstdc++ effort.">
7 <META NAME="GENERATOR" CONTENT="vi and eight fingers">
8 <TITLE>libstdc++-v3 Installation Instructions</TITLE>
9 <LINK REL=StyleSheet HREF="lib3styles.css">
10 <!-- $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $ -->
14 <H1 CLASS="centered"><A NAME="top">libstdc++-v3 INSTALL</A></H1>
16 <P>The latest version of this document is always available at
17 <A HREF="http://gcc.gnu.org/onlinedocs/libstdc++/install.html">
18 http://gcc.gnu.org/onlinedocs/libstdc++/install.html</A>.
21 <P>To the <A HREF="http://gcc.gnu.org/libstdc++/">libstdc++-v3 homepage</A>.
24 <!-- ####################################################### -->
28 <LI><A HREF="#prereqs">Tools you will need beforehand</A>
29 <LI><A HREF="#srcsetup">Setting up the source directories</A>
30 <LI><A HREF="#config">Configuring</A>
31 <LI><A HREF="#install">Building and installing the library</A>
32 <LI><A HREF="#postinstall">Post-installation</A>
33 <LI><A HREF="#usage">Using the library</A>
38 <!-- ####################################################### -->
40 <H2><A NAME="prereqs">Tools you will need beforehand</A></H2>
41 <P>You will need a recent version of g++ to compile the snapshot of
42 libstdc++, one of the post-2.95.2 GCC
43 snapshots (insert standard caveat about using snapshots rather
44 than formal releases). You will need the full source
45 distribution to whatever compiler release you are using. The
46 GCC snapshots can be had from one of the sites on their
47 <A HREF="http://gcc.gnu.org/mirrors.html">mirror list</A>.
50 <P>In addition, if you plan to modify the makefiles or regenerate
51 the configure scripts you'll need the nuevo automake, libtool
52 and autoconf to regenerate the Makefiles and configure
53 scripts. These tools are all required to be installed in the
54 same location (most linux distributions install these tools by
55 default, so no worries.)
58 <P>If you don't have bash, and want to run <TT>'make check'</TT> to
59 test your build, you'll need to get bash 2.x. Also recommended
60 is GNU Make, since it is the only 'make' that will parse these
61 makefiles correctly. We are moving to DejaGNU, so you'll
62 probably want to get that.
65 <P>As of June 19, 2000, libstdc++ attempts to use tricky and
66 space-saving features of the GNU toolchain, enabled with
67 <TT>-ffunction-sections -fdata-sections -Wl,--gc-sections</TT>.
68 To obtain maximum benefit from this, binutils after this date
69 should also be used (bugs were fixed with C++ exception handling
70 related to this change in libstdc++-v3). The version of these
71 tools should be <TT>2.10.90</TT>, and you can get snapshots (as
72 well as releases) of binutils
73 <A HREF="ftp://sources.redhat.com/pub/binutils">here</A>.
76 <P>Finally, a few system-specific requirements:
79 <DD>If you are using Cygwin to compile libstdc++-v3 on Win32, you'll
80 have to get a version of the cygwin1.dll that is dated on or
81 after February 1, 2000. This is necessary to successfully run
82 the script "mknumeric_limits" which probes the
84 environment of the host in question -- before this date, Cygwin
85 would freeze when running this script. In addition, you may
86 want to get a current version of libtool (say libtool-1.3.4
87 and above) as earlier versions supposedly had problems creating
95 <H2><A NAME="srcsetup">Setting up the source directories</A></H2>
96 <P><EM>As the libstdc++-v3 sources and the core GCC sources have
97 converged, more and more effort goes to building the
98 library as the default version to be shipped with g++. With the
99 2.90.8 snapshot, and especially for CVS versions after this
100 release, this is treated as the usual scenario. If you want to
101 build the library all by itself, you will need to explicitly
102 disable certain features (like namespaces) since the core GCC
103 library, libgcc.a, will not be rebuilt with those same features.
107 <P>By default, all configurations of libstdc++-v3 now have namespaces
108 enabled. Being able to select/de-select this option was a complex task
109 that had hopelessly confused many otherwise intelligent people, and
110 provided an endless stream of silent cursing and cries for help.
111 Because of this, gcc sources are required, and are no longer optional.
114 <P>The following definitions will be used throughout the rest of this
117 <LI><EM>gccsrcdir</EM>: The directory holding the source of the
118 compiler. It should have several subdirectories like
119 <EM>gccsrcdir</EM>/libio and <EM>gccsrcdir</EM>/gcc.
120 <LI><EM>libsrcdir</EM>: The directory holding the source of the
122 <LI><EM>gccbuilddir</EM>: The build directory for the compiler
123 in <EM>gccsrcdir</EM>. GCC requires that it be built in
124 a different directory than its sources.
125 <LI><EM>libbuilddir</EM>: The build directory for libstdc++.
126 <LI><EM>destdir</EM>: The eventual installation directory for
127 the compiler/libraries, set with the --prefix option to
128 the configure script.
132 <LI>The .91 snapshot and following are intended to replace the
133 library that comes with the compiler, so <EM>libsrcdir</EM>
134 and <EM>libbuilddir</EM> must be contained under
135 <EM>gccsrcdir</EM> and <EM>gccbuilddir</EM>, respectively.
136 <LI>The source, build, and installation directories should
137 not be parents of one another; i.e., these should all be
138 separate directories. Please don't build out of the
143 <P>Since the release of libstdc++-2.90.8, configuration patches have gone
144 into CVS gcc that make the management of the various libstdc++ source
145 trees a bit easier. Because of this, both libstdc++-v2 and
146 libstdc++-v3 and live together in peace, without the need
147 for soft linking. The setup instructions are slightly different,
148 depending on whether you want to use CVS gcc or a snapshot. Please
149 choose the appropriate scenario:
152 <P><B>...with a gcc-2.9[67] snapshot</B>
153 <P>Unpack the <EM>gccsrcdir</EM> and go into that directory. For
154 instance, <TT>gcc-2.95.2</TT> is a valid <EM>gccsrcdir</EM>.
155 Once in <EM>gccsrcdir</EM>, you'll need to rename or delete
156 the libstdc++-v3 directory which comes with that snapshot:
158 mv libstdc++-v3 libstdc++-v3-previous <STRONG>[OR]</STRONG>
159 rm -r libstdc++-v3</PRE>
161 <P>Next, unpack the libstdc++-v3 library tarball into the
162 <EM>gccsrcdir</EM> directory; it will create a
163 <EM>libsrcdir</EM> called <TT>libstdc++-<EM>version</EM></TT>:
165 gzip -dc libstdc++-version.tar.gz | tar xf -</PRE>
167 <P>Finally, make a soft link between <EM>libsrcdir</EM> and
168 <TT>libstdc++-v3</TT> so that libstdc++-v3 will be the default C++
171 ln -s <EM>libsrcdir</EM> libstdc++-v3</PRE>
175 <P><B>...with CVS gcc</B>
176 <P>Check out or download the gcc sources: the resulting source
177 directory is <EM>gccsrcdir</EM>. Once in <EM>gccsrcdir</EM>,
178 you'll need to rename or delete the libstdc++-v3 directory
179 which comes with that snapshot:
181 mv libstdc++-v3 libstdc++-v3-previous <STRONG>[OR]</STRONG>
182 rm -r libstdc++-v3</PRE>
184 <P>Next, unpack the libstdc++-v3 library tarball into this
185 <EM>gccsrcdir</EM> directory; it will create a
186 <EM>libsrcdir</EM> called <TT>libstdc++-<EM>version</EM></TT>:
188 gzip -dc libstdc++-version.tar.gz | tar xf -</PRE>
190 <P>Finally, rename <EM>libsrcdir</EM> to <TT>libstdc++-v3</TT> so that
191 gcc's configure flags will be able to deal with the new library.
193 mv <EM>libsrcdir</EM> libstdc++-v3</PRE>
199 <H2><A NAME="config">Configuring</A></H2>
200 <P>If you have never done this before, you should read the basic
201 <A HREF="http://gcc.gnu.org/install/">GCC Installation
202 Instructions</A> first.
204 <P>Due to namespaces, when building libstdc++-v3 you'll have to configure
205 the entire <EM>gccsrcdir</EM> directory. The full list of libstdc++-v3
206 specific configuration options, not dependent on the specific compiler
207 release being used, can be found <A HREF="configopts.html">here</A>.
209 <P>Consider possibly using --enable-languages=c++ to save time by only
210 building the C++ language parts.
214 cd <EM>gccbuilddir</EM>
215 <EM>gccsrcdir</EM>/configure --prefix=<EM>destdir</EM> --other-opts...</PRE>
220 <H2><A NAME="install">Building and installing the library</A></H2>
221 <P>Now you have a few options:</P>
222 <H3>[re]building <EM>everything</EM></H3>
223 <P>If you're building GCC from scratch, you can do the usual
224 <TT> 'make bootstrap' </TT> here, and libstdc++-v3 will be built
225 as its default C++ library. The generated g++ will magically
226 use the correct headers, link against the correct library
227 binary, and in general using libstdc++-v3 will be a piece of
228 cake. You're done; run <TT>'make install'</TT> (see the GCC
229 installation instructions) to put the new compiler and libraries
233 <H3>[re]building only libstdc++</H3>
234 <P>To rebuild just libstdc++, use:
236 make all-target-<EM>libstdc++-v3</EM></PRE>
237 This will configure and build the C++ library in the
238 <EM>gccbuilddir/cpu-vendor-OS/</EM>libstdc++ directory.
240 <P>If you are rebuilding from a previous build [attempt], some
241 information is kept in a cache file. This is stored in
242 <EM>gccbuilddir/cpu-vendor-OS/</EM> if you are building with
243 multilibs (the default), or in
244 <EM>gccbuilddir/cpu-vendor-OS/</EM>libstdc++-v3 if you have
245 multilibs disabled. The filename is config.cache; if previous
246 information is causing problems, you can delete it entirely, or
247 simply edit it and remove lines.
249 <P>You're done. Now install the rebuilt pieces with
255 make install-target-libstdc++-v3</PRE>
260 <H2><A NAME="postinstall">Post-installation</A></H2>
261 <P>Installation will create the <EM>destdir</EM> directory and
262 populate it with subdirectories:
268 CPU-vendor-OS/include/g++-v3/
272 <P>You can check the status of the build without installing it using
275 or you can check the status of the installed library using
277 make check-install</PRE>
278 in the <EM>libbuilddir</EM> directory.
279 These commands will create a 'testsuite' directory underneath
280 <EM>libbuilddir</EM> containing the results of the tests. We are
281 interested in any strange failures of the testsuite; please see
282 <A HREF="faq/index.html#2_4">FAQ 2.4</A> for which files to examine.
287 <H2><A NAME="usage">Using the library</A></H2>
288 <LI><B>Find the new library at runtime (shared linking only)</B>
289 <P>If you only built a static library (libstdc++.a), or if you
290 specified static linking, you don't have to worry about this.
291 But if you built a shared library (libstdc++.so) and linked
292 against it, then you will need to find that library when you
295 <P>Methods vary for different platforms and different styles, but
296 the usual ones are printed to the screen during installation.
299 <LI>At runtime set LD_LIBRARY_PATH in your environment correctly,
300 so that the shared library for libstdc++ can be found and
301 loaded. Be certain that you understand all of the other
302 implications and behavior of LD_LIBRARY_PATH first (few
303 people do, and they get into trouble).
304 <LI>Compile the path to find the library at runtime into the
305 program. This can be done by passing certain options to g++,
306 which will in turn pass them on to the linker. The exact
307 format of the options is dependent on which linker you use:
309 <LI>GNU ld (default on Linux):<TT> -Wl,--rpath,<EM>destdir</EM>/lib</TT>
310 <LI>IRIX ld:<TT> -Wl,-rpath,<EM>destdir</EM>/lib</TT>
311 <LI>Solaris ld:<TT> -Wl,-R<EM>destdir</EM>/lib</TT>
316 <P>Use the <TT>ldd(1)</TT> utility to show which library the system
317 thinks it will get at runtime.
325 <H2><A NAME=""></A></H2>
331 <!-- ####################################################### -->
334 <P CLASS="fineprint"><EM>
335 Comments and suggestions are welcome, and may be sent to
336 <A HREF="mailto:pme@sources.redhat.com">Phil Edwards</A> or
337 <A HREF="mailto:gdr@gcc.gnu.org">Gabriel Dos Reis</A>.
338 <BR> $Id: install.html,v 1.3 2001/01/23 17:02:26 pme Exp $