1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
4 <meta name="AUTHOR" content="pme@gcc.gnu.org (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">
13 <h1 class="centered"><a name="top">libstdc++-v3 INSTALL</a></h1>
15 <p>The latest version of this document is always available at
16 <a href="http://gcc.gnu.org/onlinedocs/libstdc++/install.html">
17 http://gcc.gnu.org/onlinedocs/libstdc++/install.html</a>.
20 <p>To the <a href="http://gcc.gnu.org/libstdc++/">libstdc++-v3 homepage</a>.
23 <!-- ####################################################### -->
27 <li><a href="#prereqs">Tools you will need beforehand</a>
28 <li><a href="#srcsetup">Setting up the source directories</a>
29 <li><a href="#config">Configuring</a>
30 <li><a href="#install">Building and installing the library</a>
31 <li><a href="#postinstall">Post-installation</a>
32 <li><a href="#usage">Using the library</a>
37 <!-- ####################################################### -->
39 <h2><a name="prereqs">Tools you will need beforehand</a></h2>
40 <p>You will need a recent version of g++ to compile the snapshot of
41 libstdc++, such as one of the GCC 3.x snapshots (insert standard
42 caveat about using snapshots rather than formal releases). You will
43 need the full source distribution to whatever compiler release you are
44 using. The GCC snapshots can be had from one of the sites on their
45 <a href="http://gcc.gnu.org/mirrors.html">mirror list</a>. If you are
46 using a 2.x compiler, see
47 <a href="http://gcc.gnu.org/libstdc++/status.html">the status page</a>
51 <p>In addition, if you plan to modify the makefiles or regenerate the
52 configure scripts you'll need recent versions of the GNU Autotools:
53 autoconf (version 2.50 or later),
54 automake (version 1.4 or later), <!-- special version? -->
55 and libtool (multilanguage, version 1.4 or later), <!-- really? -->
56 in order to rebuild the files.
57 These tools are all required to be installed in the same location
58 (most linux distributions install these tools by default, so no
59 worries as long as the versions are correct).
62 <p>To test your build, you will need either DejaGNU 1.4 (to run
63 <code>'make check'</code> like
64 <a href="http://gcc.gnu.org/install/test.html">the rest of GCC</a>),
65 or Bash 2.x (to run <code>'make check-script'</code>).
68 <p>As of June 19, 2000, libstdc++ attempts to use tricky and
69 space-saving features of the GNU toolchain, enabled with
70 <code>-ffunction-sections -fdata-sections
71 -Wl,--gc-sections</code>. To obtain maximum benefit from this,
72 binutils after this date should also be used (bugs were fixed
73 with C++ exception handling related to this change in
74 libstdc++-v3). The version of these tools should be
75 <code>2.10.90</code>, or later, and you can get snapshots (as
76 well as releases) of binutils
77 <a href="ftp://sources.redhat.com/pub/binutils">here</a>. The
78 configure process will automatically detect and use these
79 features if the underlying support is present.
82 <p>If you are using a 3.1-series libstdc++ snapshot, then the
83 requirements are slightly more stringent: the compiler sources
84 must also be 3.1 or later (for both technical and licensing
85 reasons), and your binutils must be 2.11.95 or later if you want
86 to use symbol versioning in shared libraries. Again, the
87 configure process will automatically detect and use these
88 features if the underlying support is present.
91 <p>Finally, a few system-specific requirements:
95 <dd>If you are using gcc 3.1 or later on linux, and are using
96 the gnu locale model (enabled by default for sufficient
97 versions of glibc), the following locales are used and tested
98 in the libstdc++ testsuites: en_HK, en_US, fr_FR, fr_FR@euro,
99 de_DE, de_DE@euro, ja_JP.eucjp, and it_IT. Failure to have the
100 underlying "C" library locale information installed will mean
101 that C++ named locales for the above regions will not work:
102 because of this, the libstdc++ testsuite will not pass the
103 named locale tests. If this isn't an issue, don't worry about
104 it. If named locales are needed, the underlying locale
105 information must be installed. Note that rebuilding libstdc++
106 after locales are installed is not necessary.
109 support for locales, do only one of the following: </p>
111 <li> install all locales
112 <p> <code> export LC_ALL=C </code> </p>
113 <p> <code> rpm -e glibc-common --nodeps </code> </p>
114 <p> <code> rpm -i --define "_install_langs all"
115 glibc-common-2.2.5-34.i386.rpm </code> </p>
116 <li> install just the necessary locales
117 <p> <code> localedef -i de_DE -f ISO-8859-1 de_DE </code> </p>
124 <h2><a name="srcsetup">Setting up the source directories</a></h2>
125 <p>The following definitions will be used throughout the rest of this
128 <li><em>gccsrcdir</em>: The directory holding the source of the
129 compiler. It should have several subdirectories like
130 <em>gccsrcdir</em>/libio and <em>gccsrcdir</em>/gcc.
131 <li><em>libsrcdir</em>: The directory holding the source of the
133 <li><em>gccbuilddir</em>: The build directory for the compiler
134 in <em>gccsrcdir</em>. GCC requires that it be built in
135 a different directory than its sources.
136 <li><em>libbuilddir</em>: The build directory for libstdc++.
137 <li><em>destdir</em>: The eventual installation directory for
138 the compiler/libraries, set with the --prefix option to
139 the configure script.
143 <li>The 3.0 version and following are intended to replace the
144 library that comes with the compiler, so <em>libsrcdir</em>
145 and <em>libbuilddir</em> must be contained under
146 <em>gccsrcdir</em> and <em>gccbuilddir</em>, respectively.
147 <li>The source, build, and installation directories should
148 not be parents of one another; i.e., these should all be
149 separate directories. Please don't build out of the
154 <p>Check out or download the GCC sources: the resulting source directory
155 (<code>gcc</code> or <code>gcc-3.0.3</code>, for example) is
157 Once in <em>gccsrcdir</em>, you'll need to rename or delete the
158 libstdc++-v3 directory which comes with that snapshot:
160 mv libstdc++-v3 libstdc++-v3-previous <strong>[OR]</strong>
161 rm -r libstdc++-v3</pre>
163 <p>Next, unpack the libstdc++-v3 library tarball into this
164 <em>gccsrcdir</em> directory; it will create a
165 <em>libsrcdir</em> called <code>libstdc++-<em>version</em></code>:
167 gzip -dc libstdc++-version.tar.gz | tar xf -</pre>
169 <p>Finally, rename <em>libsrcdir</em> to <code>libstdc++-v3</code> so that
170 gcc's configure flags will be able to deal with the new library.
172 mv <em>libsrcdir</em> libstdc++-v3</pre>
177 <h2><a name="config">Configuring</a></h2>
178 <p>If you have never done this before, you should read the basic
179 <a href="http://gcc.gnu.org/install/">GCC Installation
180 Instructions</a> first. Read <em>all of them</em>.
181 <strong>Twice.</strong>
183 <p>When building libstdc++-v3 you'll have to configure
184 the entire <em>gccsrcdir</em> directory. The full list of libstdc++-v3
185 specific configuration options, not dependent on the specific compiler
186 release being used, can be found <a href="configopts.html">here</a>.
188 <p>Consider possibly using --enable-languages=c++ to save time by only
189 building the C++ language parts.
193 cd <em>gccbuilddir</em>
194 <em>gccsrcdir</em>/configure --prefix=<em>destdir</em> --other-opts...</pre>
199 <h2><a name="install">Building and installing the library</a></h2>
200 <p>Now you have a few options:</p>
201 <h3>[re]building <em>everything</em></h3>
202 <p>If you're building GCC from scratch, you can do the usual
203 <code> 'make bootstrap' </code> here, and libstdc++-v3 will be built
204 as its default C++ library. The generated g++ will magically
205 use the correct headers, link against the correct library
206 binary, and in general using libstdc++-v3 will be a piece of
207 cake. You're done; run <code>'make install'</code> (see the GCC
208 installation instructions) to put the new compiler and libraries
212 <h3>[re]building only libstdc++</h3>
213 <p>To rebuild just libstdc++, use:
215 make all-target-<em>libstdc++-v3</em></pre>
216 This will configure and build the C++ library in the
217 <em>gccbuilddir/cpu-vendor-os/</em>libstdc++ directory.
219 <p>If you are rebuilding from a previous build [attempt], some
220 information is kept in a cache file. This is stored in
221 <em>gccbuilddir/cpu-vendor-os/</em> if you are building with
222 multilibs (the default), or in
223 <em>gccbuilddir/cpu-vendor-os/</em>libstdc++-v3 if you have
224 multilibs disabled. The filename is config.cache; if previous
225 information is causing problems, you can delete it entirely, or
226 simply edit it and remove lines.
228 <p>You're done. Now install the rebuilt pieces with
234 make install-target-libstdc++-v3</pre>
239 <h2><a name="postinstall">Post-installation</a></h2>
240 <p>Installation will create the <em>destdir</em> directory and
241 populate it with subdirectories:
247 <em>cpu-vendor-os</em>/bits/
250 <p>If you used the version-specific-libs configure option, then most of
251 the headers and library files will be moved under
252 <code>lib/gcc-lib/</code> instead.
254 <p>You can check the status of the build without installing it using
257 or you can check the status of the installed library using
259 make check-install</pre>
260 in the <em>libbuilddir</em> directory.
261 These commands will create a 'testsuite' directory underneath
262 <em>libbuilddir</em> containing the results of the tests. We are
263 interested in any strange failures of the testsuite; please see
264 <a href="faq/index.html#2_4">FAQ 2.4</a> for which files to examine.
269 <h2><a name="usage">Using the library</a></h2>
270 <li><B>Find the new library at runtime (shared linking only)</B>
271 <p>If you only built a static library (libstdc++.a), or if you
272 specified static linking, you don't have to worry about this.
273 But if you built a shared library (libstdc++.so) and linked
274 against it, then you will need to find that library when you
277 <p>Methods vary for different platforms and different styles, but
278 the usual ones are printed to the screen during installation.
281 <li>At runtime set LD_LIBRARY_PATH in your environment correctly,
282 so that the shared library for libstdc++ can be found and
283 loaded. Be certain that you understand all of the other
284 implications and behavior of LD_LIBRARY_PATH first (few
285 people do, and they get into trouble).
286 <li>Compile the path to find the library at runtime into the
287 program. This can be done by passing certain options to g++,
288 which will in turn pass them on to the linker. The exact
289 format of the options is dependent on which linker you use:
291 <li>GNU ld (default on Linux):<code> -Wl,--rpath,<em>destdir</em>/lib</code>
292 <li>IRIX ld:<code> -Wl,-rpath,<em>destdir</em>/lib</code>
293 <li>Solaris ld:<code> -Wl,-R<em>destdir</em>/lib</code>
294 <li>More...? Let us know!
298 <p>Use the <code>ldd(1)</code> utility to show which library the system
299 thinks it will get at runtime.
301 <p>A libstdc++.la file is also installed, for use with Libtool. If
302 you use Libtool to create your executables, these details are
303 taken care of for you.
311 <h2><a name=""></a></h2>
317 <!-- ####################################################### -->
320 <p class="fineprint"><em>
321 See <a href="17_intro/license.html">license.html</a> for copying conditions.
322 Comments and suggestions are welcome, and may be sent to
323 <a href="mailto:libstdc++@gcc.gnu.org">the libstdc++ mailing list</a>.