This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Support installing headers for bootstrapping libgcc
On Fri, 9 Mar 2012, Roland McGrath wrote:
> > As noted I think glibc is the right place to fix this - the point is to
> > provide a well-defined interface to install a working set of headers,
> > sufficient for bootstrapping (but hopefully as complete as possible),
> > without building the library itself.
>
> I'll reply to your other message about this, though I might not get
> to it before next week.
I haven't seen any further comments on the <gnu/stubs.h> issue (see
<http://sourceware.org/ml/libc-alpha/2012-03/msg00267.html> for my
previous comments) - does anyone have anything to say here?
Here are the <gnu/stubs.h> bootstrap changes on their own (minus the other
parts of the original patch that have been dealt with separately).
2012-03-08 Jim Blandy <jimb@codesourcery.com>
Joseph Myers <joseph@codesourcery.com>
* Makefile [install-bootstrap-headers] (install-headers): Depend
on $(inst_includedir)/gnu/stubs.h.
[install-bootstrap-headers] (install-others): Don't include
$(inst_includedir)/gnu/stubs.h.
[install-bootstrap-headers] ($(inst_includedir)/gnu/stubs.h): New
rule.
[install-bootstrap-headers] (installed-stubs): Define to empty.
[install-bootstrap-headers] (install-others-nosubdir): Do not
depend on $(installed-stubs).
* include/stubs-bootstrap.h: New file.
* manual/install.texi (Bootstrapping): New section.
* INSTALL: Regenerated.
diff --git a/Makefile b/Makefile
index 5a31adb..4553b2d 100644
--- a/Makefile
+++ b/Makefile
@@ -69,9 +69,18 @@ subdir-dirs = include
vpath %.h $(subdir-dirs)
# What to install.
-install-others = $(inst_includedir)/gnu/stubs.h
install-bin-script =
+# If we're bootstrapping, install a dummy gnu/stubs.h along with the
+# other headers, so 'make install-headers' produces a useable include
+# tree. Otherwise, install gnu/stubs.h later, after the rest of the
+# build is done.
+ifeq ($(install-bootstrap-headers),yes)
+install-headers: $(inst_includedir)/gnu/stubs.h
+else
+install-others = $(inst_includedir)/gnu/stubs.h
+endif
+
ifeq (yes,$(build-shared))
headers += gnu/lib-names.h
endif
@@ -171,6 +180,16 @@ others: $(common-objpfx)testrun.sh
subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
+# files in glibc. For bootstrapping a GCC/glibc pair, an empty
+# gnu/stubs.h is good enough.
+ifeq ($(install-bootstrap-headers),yes)
+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force)
+ $(make-target-directory)
+ $(INSTALL_DATA) $< $@
+
+installed-stubs =
+else
ifeq ($(biarch),no)
installed-stubs = $(inst_includedir)/gnu/stubs.h
else
@@ -182,6 +201,7 @@ $(inst_includedir)/gnu/stubs.h: include/stubs-biarch.h $(+force)
install-others-nosubdir: $(installed-stubs)
endif
+endif
# Since stubs.h is never needed when building the library, we simplify the
diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h
new file mode 100644
index 0000000..e7361d1
--- /dev/null
+++ b/include/stubs-bootstrap.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>.
+
+ Placeholder stubs.h file for bootstrapping.
+
+ When bootstrapping a GCC/glibc pair, GCC requires that the glibc
+ headers be installed, but we can't fully build glibc without that
+ GCC. So we run the command:
+
+ make install-headers install-bootstrap-headers=yes
+
+ to install the headers GCC needs, but avoid building certain
+ difficult headers. The <gnu/stubs.h> header depends, via the
+ glibc subdir 'stubs' make targets, on every .o file in glibc, but
+ an empty stubs.h like this will do fine for GCC. */
diff --git a/manual/install.texi b/manual/install.texi
index 00db2b8..dd803f9 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -26,6 +26,7 @@ GNU Make, and possibly others. @xref{Tools for Compilation}, below.
compiled.
* Tools for Compilation:: You'll need these first.
* Linux:: Specific advice for GNU/Linux systems.
+* Bootstrapping:: Building cross toolchains with GNU libc.
* Reporting Bugs:: So they'll get fixed.
@end menu
@@ -385,6 +386,26 @@ GNU @code{gettext} 0.10.36 or later
You may also need these packages if you upgrade your source tree using
patches, although we try to avoid this.
+@node Bootstrapping
+@appendixsec Bootstrapping cross toolchains including @theglibc{}
+@cindex bootstrapping
+@cindex cross-compilation
+
+If you are building @theglibc{} using a cross compiler, and also
+building that cross compiler, and do not have a previously built
+version of @theglibc{}, the build process is more complicated because
+building the whole of GCC's libgcc library requires headers from
+@theglibc{}, while building @theglibc{} requires a previously built
+and installed libgcc shared library.
+
+To resolve these circular dependencies, @theglibc{} can be configured
+using a minimal build of GCC without shared libgcc. Although it is
+not then possible to do a complete build of @theglibc{}, @code{make
+install-headers install-bootstrap-headers=yes} will install headers
+suitable for building libgcc. (These headers will be replaced by the
+final @code{make install} when @theglibc{} is fully built using GCC
+with shared libgcc.)
+
@node Linux
@appendixsec Specific advice for @gnulinuxsystems{}
@cindex kernel header files
--
Joseph S. Myers
joseph@codesourcery.com