The top-level gcc configure currently only passes the "--with-sysroot" to the
subdirectories, and of these, the "gcc" subdir seems to be the only one that
uses it. When I was configuring with languages c and c++, this meant that the
libstdc++ package would not build, because it couldn't find my native libraries
and headers that I had specified with --with-sysroot. The alternative (use
--with-headers and --with-libs) would disrupt my file hiearchy too much
(basically I grab all the necessary libs and headers from the native system
as-is, meaning most of the libraries are symlinks, which are not dereferenced by
gcc's make when using --with-libs).
It turns out that this is relatively easy to fix. The top-level configure sets
the xgcc options to add "-B%{build_tooldir}/lib/ -isystem
$(build_tooldir)/include -isystem $(build_tooldir)/sys-include". These are
hard-coded, even if you use --with-sysroot. By altering configure to be 'sysroot
aware', I changed the options to "-B$(target_sysroot)/lib
-B$(target_sysroot)/usr/lib -isystem $(target_sysroot)/usr/include" (where
target_sysroot is the sysroot), and did a rebuild (from scratch) and everything
worked. I'll attach my patch below.
--
Summary: Top-level gcc configure/makefile does not handle --with-
sysroot
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: prothonotar at tarnation dot dyndns dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: sparc-sun-solaris2.8
GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: i586-sun-solaris2.10
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20955