Bug 10927 - libgcc references libc files in cross-compiler on linux-gnu
Summary: libgcc references libc files in cross-compiler on linux-gnu
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2003-05-22 10:32 UTC by felix-gcc
Modified: 2003-08-21 18:18 UTC (History)
2 users (show)

See Also:
Host:
Target: *-*-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-07-18 23:02:46


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description felix-gcc 2003-05-22 10:32:34 UTC
	libgcc references files that cannot be there because they are in
	the libc, which can only be built with the cross compiler that
	is currently being built.  In particular, I noticed
	sys/ucontext.h, but other headers are references as well.

Environment:
System: Linux beholder 2.5.69 #26 Tue May 20 12:01:42 CEST 2003 i686 unknown unknown GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: powerpc-unknown-linux-gnu
configured with: ./configure --prefix=/opt/cross --target=powerpc-unknown-linux-gnu --disable-shared --enable-static

How-To-Repeat:
	./configure --target=ppc-linux --disable-shared --enable-static; make
Comment 1 felix-gcc 2003-05-22 10:32:34 UTC
Fix:
	do not reference those headers from libgcc.
Comment 2 Andrew Pinski 2003-05-22 14:55:17 UTC
try with --without-headers for configure option, you might also want just to compile the c 
compiler, --enable-languages=c .
Comment 3 Nathanael C. Nerode 2003-05-23 06:48:33 UTC
I'm guessing you need some sort of --ffreestanding argument to build, but someone more expert will have to confirm this.
Comment 4 Andrew Pinski 2003-05-23 19:41:40 UTC
Asking again to make sure this gets through
try with --without-headers for configure option, you might also want just to compile only 
the c  compiler, --enable-languages=c .
Comment 5 felix-gcc 2003-05-24 00:27:16 UTC
Yeah of course I only compiled the C compiler, the C++ runtime depends on glibc
which can't be compiled unless I install the C compiler only first.  So
obviously I have to compile only the C compiler first.

Regarding the --without-headers option -- what is the point of that?  Building a
cross compiler should _never_ depend on the libc for the target platform being
installed.  This is not optional, in particular if things like sys/ucontext.h is
included, which depend on the system and not on the libc.  I am also surprised
because this option is not only not mentioned in INSTALL/*, it is also not in
any configure script in the gcc 3.3 distribution.  Did you make that option up?
Comment 6 Andrew Pinski 2003-05-29 18:12:04 UTC
Did you read http://gcc.gnu.org/install/configure.html?
--with-headers
       "This option with the dir argument is required when building a cross compiler, if prefix 
/target /sys-include doesn't pre-exist "
"--with option has a corresponding --without option"

--without-headers, just disables the use of headers.
Comment 7 Dara Hazeghi 2003-06-01 03:37:49 UTC
I don't know if this answers your question, but libgcc, the piece of the compiler which needs the 
headers, is built for the _target_. As such it needs to know certain information about the target, 
thus it must include target headers. If all you want is a cross compiler, cc1 is will do the trick. For a 
complete cross toolchain though, you need a libgcc compiled to run on PPC, and thus the headers 
are necessary.

Dara
Comment 8 Andrew Pinski 2003-06-26 20:37:11 UTC
This is true still, no need to check it but I think this is a dup of another bug but I cannot 
find the bug right now.
Comment 9 Dara Hazeghi 2003-07-18 23:02:46 UTC
This seems to be true of many other linux targets (not just powerpc-linux)...
Comment 10 Andrew Pinski 2003-08-18 03:31:26 UTC
The reason why you need these headers is so that libgcc gets build with expection support which 
is needed otherwise there are conflicts on how glibc is built and such.
Comment 11 dank 2003-08-21 12:50:25 UTC
You really do need --without-headers to prevent libgcc from referencing libc, 
so this bug is invalid.  That is, it would be if --without-headers worked.
See bug 8180.  --without headers should work as of gcc-3.4 cvs
yesterday.  For gcc-3.3, --without-headers is broken, but people
work around that by giving --with-newlib when configuring to
build libgcc, even if they intend to use glibc instead of newlib.
See http://kegel.com/crosstool and look at how I configure gcc the first time.
Comment 12 Andrew Pinski 2003-08-21 18:18:57 UTC
Marking this as invalid as you did not use --without-headers (but that will not work in 3.3 
but this was bug 8180 which is fixed on the mainline) and there is a workaround for that 
not working see the previous comment.