gcc/libstdc++-v3/docs/gccrebuild.html

131 lines
5.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="AUTHOR" CONTENT="pme@sources.redhat.com (Phil Edwards)">
<META NAME="KEYWORDS" CONTENT="libgcc.a, rebuild">
<META NAME="DESCRIPTION" CONTENT="How to automatically rebuild libgcc.a.">
<META NAME="GENERATOR" CONTENT="vi and eight fingers">
<TITLE>How to automatically rebuild libgcc.a.</TITLE>
<LINK REL="home" HREF="http://sources.redhat.com/libstdc++/">
<LINK REL=StyleSheet HREF="lib3styles.css">
<!-- $Id: gccrebuild.html,v 1.4 2000/07/07 21:13:27 pme Exp $ -->
</HEAD>
<BODY>
<H2 CLASS="centered"><TT>--enable-libgcc-rebuild</TT></H2>
<P><B>NOTA BENE</B>: If using the <TT>--enable-libstdcxx-v3</TT> approach
to configuring, the std namespace will be turned on for you, without
going this route. Only use this flag if you'd like to experiment
with yet more binary incompatibilities, as discussed below.
</P>
<HR>
<P>If you build libstdc++ using certain flags (e.g., -fnew-abi), then
programs that use some of the new C++ language features (like namespace
std and RTTI) will only link if the compiler's libgcc is built using
the same flags. Other extralinguistic flags (like -fsquangle to change
the name mangling algorithm) will have the same effect.
</P>
<P>Passing --enable-libgcc-rebuild to libstdc++'s configure script
means that when you type 'make' next, after libstdc++ is built,
then libgcc will also be rebuilt. If you've given other
--enable/--with switches to libstdc++ that would require a core
library rebuild, then those compiler options will be automatically
used when compiling libgcc, such that both libraries will always be
built with the same options.
</P>
<P>The argument to this enable switch is the path to the GCC build
directory. The GCC configuration documentation refers to this directory
as <EM>objdir</EM>; here it will be called <EM>GCCobjdir</EM>.
</P>
<P>This was required for a few busy months of development, but was
always acknowledged a kludge. After the library sources were merged into
the compiler sources, this was commented out. If you must re-enable
it, you amy do so by uncommenting the GLIBCPP_ENABLE_RELIBGCC line in
configure.in and regenerating.
</P>
<HR>
<H3>If you kept your <EM>GCCobjdir</EM></H3>
<P>Easy as pi, er, pie. Just pass the pathname to the --enable switch
(absolute pathnames are best), and build libstdc++ as you normally
would. When it is finished, 'make' will go over to <EM>GCCobjdir</EM>
and build a new libgcc.a for you.
</P>
<P>Once that's done, skip down to &quot;Installing the new libgcc.a.&quot;
</P>
<H3>If you deleted your <EM>GCCobjdir</EM>, or never had one</H3>
<P>Aaargggghhh, you had to make things difficult. Okay, note for future
reference: if you plan on experimenting with weird features, you'll want
to keep your build directories around. If you're having to re-unpack
the GCC source for this step, the same thing applies.
</P>
<P>We don't put a whole lot of effort into supporting this, so you might
just have to go the long way 'round if you run into difficulties.
</P>
<P>You'll have to trick the configure script into believing that libgcc.a
has been previously built. You'll also have to build the libraries that
libgcc.a needs. The steps are these:
<OL>
<LI>Unpack the GCC sources. Call this directory <EM>GCCsrcdir</EM>.
<LI>&quot;<TT>mkdir <EM>GCCobjdir</EM> && cd <EM>GCCobjdir</EM> &&
<EM>GCCsrcdir</EM>/configure --whatever</TT>&quot;
<BR>Configure GCC like you normally would. See
<A HREF="http://gcc.gnu.org/install/configure.html">the GCC
configuration instructions</A> for all the possible values
of <TT>--whatever</TT>.
<LI>&quot;<TT>cd libiberty && make</TT>&quot;
<LI>&quot;<TT>cd ../gcc; touch libgcc2.ready</TT>&quot;
</OL>
Now go back to &quot;If you kept your GCCobjdir&quot; and proceed from there.
</P>
<H3>Installing the new libgcc.a</H3>
<P>The reckless method is
<PRE>
cd GCCobjdir/gcc
make install-libgcc</PRE>
This will copy in the new libgcc.a on top of the old one.
</P>
<P>The wiser method is to keep the old one around under a different name,
and install the new one under another different name, and then make
libgcc.a be a hard or soft link to one of the two real libraries. Or
copy one of them by a new name into a directory searched by the linker,
and use -l (dash ell) to pick it up before finding the default
<EM>other</EM> library.
</P>
<HR>
<P>If you're <B>really</B> interested in using a particular flag (say,
-fhonor-std) under <B>all</B> conditions, then you can edit
<EM>GCCsrcdir</EM>/gcc/cp/decl2.c and change the initialization of the
appropriate <TT>flag_</TT> variable to 1. This will turn that flag
on by default, which means that libgcc.a, libstdc++.a, libstdc++.so,
and everything else you ever do will be built with that feature
unless you specifically turn it <EM>off</EM>.
</P>
<!-- ####################################################### -->
<HR>
<P CLASS="fineprint"><EM>
$Id: gccrebuild.html,v 1.4 2000/07/07 21:13:27 pme Exp $
</EM></P>
</BODY>
</HTML>