This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The file gcc/configure does not set inhibit_libc if --without-headers is set, as this translates to --with-headers=no. So the bootstrap fails in compilation. This is my own personal patch, which I urge you to study closely. Release: gcc-3.2 Environment: building an sh4 xcompiler on a mandrake linux intel system How-To-Repeat: host=i686-pc-linux-gnu build=$host target=sh-linux-gnu ../../gcc/configure \ --target=$target \ --prefix=$prefix \ --host=$host \ --build=$build \ -v \ --without-headers \ --enable-languages=c \ --with-cpu=sh4 \ --disable-threads make all install
Fix: diff -r -C 5 gcc-3.2.orig/gcc/configure gcc-3.2/gcc/configure *** gcc-3.2.orig/gcc/configure Sat Jun 29 10:20:11 2002 --- gcc-3.2/gcc/configure Thu Oct 10 09:08:54 2002 *************** *** 6787,6803 **** # inhibit_libc # If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS. # This prevents libgcc2 from containing any code which requires libc # support. ! inhibit_libc= ! if test x$host != x$target && test x$with_headers = x; then ! inhibit_libc=-Dinhibit_libc ! else ! if test x$with_newlib = xyes; then ! inhibit_libc=-Dinhibit_libc ! fi fi # When building gcc with a cross-compiler, we need to adjust things so # that the generator programs are still built with the native compiler. --- 6787,6807 ---- # inhibit_libc # If this is using newlib, then define inhibit_libc in LIBGCC2_CFLAGS. # This prevents libgcc2 from containing any code which requires libc # support. ! ! # If --without-headers was an option, then define inhibit_libc. ! # But if inhibit_libc is previously defined, leave it. ! if test x${inhibit_libc} = x ! then ! if ( ( test x$host != x$target && test x$with_headers = x) \ ! || ( test x${with_headers} = xno ) \ ! || ( test x$with_newlib = xyes ) \ ! ); then ! inhibit_libc=-Dinhibit_libc ! fi fi # When building gcc with a cross-compiler, we need to adjust things so # that the generator programs are still built with the native compiler.
From: Dara Hazeghi <dhazeghi@yahoo.com> To: pgarrone@linuxmail.org, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: bootstrap/8180: --without-headers configure option not working Date: Wed, 14 May 2003 02:35:56 -0700 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- trail&database=gcc&pr=8180 Hello, would it be possible for the submitter to check and see whether this problem still occurs on gcc 3.3? Thanks, Dara
State-Changed-From-To: open->feedback State-Changed-Why: See Dara's question.
Poster says he replied to Dara in private mail. Dara?
Peter wrote me: >Hi, > Sorry for the delay. > > I have just downloaded 3.3. The bit of code that I had to change to >make it work still hasnt changed. The file gcc-3.3/gcc/configure, line >9465 is still the original code, and when I run it with the >--without-headers configure option, the variable "inhibit_libc" does not get set to >-Dinhibit_libc. > >I am trying to do this to create a bootstrap compiler. > >I imagine the bug is there, but cannot tell for sure as the compiler >wont build for other reasons.
Confirmed with current mainline as well. The documentation for this flag is also inadequate...
Confirmed. See http://kegel.com/crosstool for workaround.
It's worse in 3.4. I'm going to try pgarrone's patch...
Subject: Re: --without-headers configure option not working ----- Original Message ----- From: "dank at kegel dot com" <gcc-bugzilla@gcc.gnu.org> Date: 14 Aug 2003 16:08:22 -0000 To: pgarrone@linuxmail.org Subject: [Bug bootstrap/8180] --without-headers configure option not working PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8180 dank at kegel dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dank at kegel dot com ------- Additional Comments From dank at kegel dot com 2003-08-14 16:08 ------- It's worse in 3.4. I'm going to try pgarrone's patch... ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter. hi, mistake in last reply, apologies. I think when I reported this bug, i didnt understand configure was a non-editable file. so perhaps the autoconf source file should be adjusted instead. For a cross-compiler, i think inhibit-libc needs setting somehow, for first pass without libraries because glibc needs building. I suppose this is detected if without-headers is set. I am very happy to enter into correspondence on this issue, for testing patches etc.
OK, I have a patch to fix this for gcc-3.4-20030813 at http://www.kegel.com/crosstool/current/gcc-3.4-20030813-patches/gcc-3.4-without-headers.patch The patch for earlier versions would be similar.
Subject: Bug 8180 CVSROOT: /cvs/gcc Module name: gcc Changes by: geoffk@gcc.gnu.org 2003-08-21 02:19:45 Modified files: . : ChangeLog configure.in gcc : ChangeLog configure.in configure Log message: Index: ChangeLog 2003-08-20 Geoffrey Keating <geoffk@apple.com> PR 8180 * configure.in: When testing with_libs and with_headers, treat 'no' as unset. Based on a patch by Dan Kegel <dank@kegel.com>. * configure: Regenerate. Index: gcc/ChangeLog 2003-08-20 Geoffrey Keating <geoffk@apple.com> PR 8180 * configure.in: When testing with_libs and with_headers, treat 'no' as unset. Based on a patch by Dan Kegel <dank@kegel.com>. * configure: Regenerate. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.790&r2=1.791 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.in.diff?cvsroot=gcc&r1=1.251&r2=1.252 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.827&r2=2.828 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.in.diff?cvsroot=gcc&r1=1.717&r2=1.718 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/configure.diff?cvsroot=gcc&r1=1.734&r2=1.735
Fixed for 3.4.
By the way, the workaround in gcc-3.2/gcc-3.3 is to give the --with-newlib option when configuring gcc, even if you plan to use glibc later. Sorry I didn't mention that before.
Subject: Re: --without-headers configure option not working Hi, Sorry about my laxity here Unfortunatly I am still mired with gcc-3.2.2 and I dont have time just now to set up the latest toolchain, since I have to complete other aspects of my project. I plan to get back to this in a fortnight or so. I lieu of doing anything useful like checking your patch, I will give my two cents worth here. To set up a cross-compiler, it is necessary to first create a compiler without a library (phase 1), then compile a library, then create the final compiler (phase 2). At the moment, for phase 1, I have the configure option --without-headers, and for phase 2, --with-libs=... and --with-headers=... You are suggesting that for newer versions of the compiler, it should be --with-newlib for phase 1, event though I am not using newlib? I will most definitly not do that, I like my config files to look sensible, and I will continue to apply my patch thanks. I suppose that it has to be possible somehow to set inhibit_libc. If --without-headers is set, then this implies inhibit_libc at the moment. The whole logic seems a little torturous. Maybe inhibit_libc should only be set if --without-libs or --with-newlib is a configure option. That way, for pass 1 for a cross-toolchain, one provides configure options --without-headers and --without-libs. Then for pass 2, one provides --with-headers=wherever and --with-libs=wherever Dont consider newlib, except that --with-newlib could mean --with-libs=wherever_newlib_usually_is I think it is really necessary to keep all this configuration sensible. ----- Original Message ----- From: "dank at kegel dot com" <gcc-bugzilla@gcc.gnu.org> Date: 21 Aug 2003 12:53:10 -0000 To: pgarrone@linuxmail.org Subject: [Bug bootstrap/8180] --without-headers configure option not working PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8180 ------- Additional Comments From dank at kegel dot com 2003-08-21 12:53 ------- By the way, the workaround in gcc-3.2/gcc-3.3 is to give the --with-newlib option when configuring gcc, even if you plan to use glibc later. Sorry I didn't mention that before. ------- You are receiving this mail because: ------- You reported the bug, or are watching the reporter.
Please trim your replies -- the extra stuff really gets messy. (Have a look at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8180 !) You wrote: "You are suggesting that for newer versions of the compiler, it should be --with-newlib for phase 1, event though I am not using newlib?" No, I'm saying that using "--with-newlib --without-headers" for phase 1 will work for all releases. The --with-newlib is a kludge, but it's traditional (see the crossgcc wiki). BTW, the script at http://kegel.com/crosstool can build cross-compilers for just about any version of gcc, and includes the few patches I found neccessary when building each version. You might find it helpful if you want to update beyond gcc-3.2.3.
Subject: Bug 8180 CVSROOT: /cvs/gcc Module name: gcc Changes by: geoffk@gcc.gnu.org 2003-08-22 17:05:20 Modified files: . : configure Log message: Index: ChangeLog 2003-08-20 Geoffrey Keating <geoffk@apple.com> PR 8180 * configure.in: When testing with_libs and with_headers, treat 'no' as unset. Based on a patch by Dan Kegel <dank@kegel.com>. * configure: Regenerate. Index: gcc/ChangeLog 2003-08-20 Geoffrey Keating <geoffk@apple.com> PR 8180 * configure.in: When testing with_libs and with_headers, treat 'no' as unset. Based on a patch by Dan Kegel <dank@kegel.com>. * configure: Regenerate. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/configure.diff?cvsroot=gcc&r1=1.110&r2=1.111