public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Ruottu <kai.ruottu@luukku.com>
To: Peter Barada <peter@baradas.org>
Cc: gcc@gcc.gnu.org, crossgcc@sources.redhat.com
Subject: Re: failure building gcc-3.3 (broken libiberty/vsprintf.c or build?)
Date: Tue, 20 May 2003 10:44:00 -0000	[thread overview]
Message-ID: <3EC9F529.6060106@luukku.com> (raw)
In-Reply-To: <20030520053204.ADDB298982@baradas.org>

Peter Barada wrote:
> I'm trying to build gcc-3.3 configured with:
> /home/peter/work/cvs-local/xgcc/gcc-3.3/configure \
> --with-gcc-version-trigger=/home/peter/work/cvs-local/xgcc/gcc-3.3/gcc/version.c \
> --host=i686-pc-linux-gnu --target=m68k-elf --prefix=/tmp/m68k-elf \
> --enable-languages=c,c++ --with-local-prefix=/tmp/m68k-elf/m68k-elf \

  Recently I built the gcc-3.3 prerelease for m68k-elf (cpu32-elf) and
didn't get any problems.

> --with-headers=/tmp/m68k-elf/m68k-elf/include

  This stupid option is recommended by the gnu.org install instructions,
but using it with newlib-based targets can be dangerous. As is well-
known, it copies the pointed headers to '$prefix/$target/sys-include'
and then tries to fix them to be suitable for ISO C and GNU C during
the GCC-build. Assuming the newlib-headers being broken and not at all
suitable for GCC should sound weird as a thought.

  I assume the newlib-1.11.0 installation still installing its headers
to '$prefix/$target/include', so 'hiding' them from any fixing during
the next GCC-build. Generally this has been/is the de-facto install
place for the target headers, not the '$prefix/$target/sys-include'
and the GCC-manual(s) still document it as the "equivalent to
'/usr/include' in the native GCC".  The need/use of the 'sys-include'
has never been documented very clearly.

  Simply copying the newlib headers from 'newlib/libc/include' into the
'$prefix/$target/include' before starting to configure and build GCC,
and using the '--with-newlib' in configure, should enable one to build
everything, besides in those 'unreal elves as the targets'-cases, for
which at least the 'm68k-elf' and 'mips-elf' belong, but 'arm-elf',
'm32r-elf', 'sh-elf', 'fr30-elf' etc. don't (some magic touch has let
them have a real body)...

  Ok, you have added all kind of 'nice-looking' options into your
configure-command, but the important '--with-newlib' is missing...
If it is missing, the already installed '$prefix/$target/lib' stuff
will be checked for the existing C functions. This option simply tells
that newlib will be used as the chosen C library.

  So my thought is that all your problems come from leaving the
'--with-newlib' away.  Sometimes the so-called 'fixed' newlib headers,
found before the original newlib headers when compiling 'libiberty',
can cause problems too. So you should check your $build/gcc/include
too for the 'fixes' done if using newlib.

> and 'make all' bombs with:
> 
> /home/peter/work/cvs-local/xgcc/obj/m68k-elf/m68k-elf-gcc/gcc/xgcc
 > -B/home/peter/work/cvs-local/xgcc/obj/m68k-elf/m68k-elf-gcc/gcc/
 > -B/tmp/m68k-elf/m68k-elf/bin/ -B/tmp/m68k-elf/m68k-elf/lib/
 > -isystem /tmp/m68k-elf/m68k-elf/include
 > -c -DHAVE_CONFIG_H -O2 -g -O2 -I.
 > -I/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/../include
 > -W -Wall -Wtraditional
 > -pedantic /home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/vsprintf.c
 > -o vsprintf.o

  Ok, newlib includes 'vsprintf()', so producing it into libiberty is
totally vain and clearly an bug, if using newlib as the C library :

E:\usr\local\m68k-elf\lib>..\bin\nm libc.a | grep vsprintf
vsprintf.o:
0000004a T _vsprintf_r
00000000 T vsprintf

  If using some 'local' C-library, this should be built and installed
after doing the 'only GCC'-build with 'make all-gcc ; make install-gcc',
so that the libiberty-configure sees what is in the 'libc.a'...

> /home/peter/work/cvs-local/xgcc/obj/m68k-elf/m68k-elf-gcc/gcc/include/varargs.h:4:2: #error "GCC no longer implements <varargs.h>."
> /home/peter/work/cvs-local/xgcc/obj/m68k-elf/m68k-elf-gcc/gcc/include/varargs.h:5:2: #error "Revise your code to use <stdarg.h>."
> make[2]: *** [vsprintf.o] Error 1
> make[2]: Leaving directory `/home/peter/work/cvs-local/xgcc/obj/m68k-elf/m68k-elf-gcc/m68k-elf/libiberty'
> 
> gcc-3.3/lbiberty/vsprintf.c, indeed includes <varargs.h> (which gcc
> supplise), so if gcc-3.3 has killed support for varargs,h, why is
> libiberty/vsprintf.c trying to include it.

  Which C libraries don't include this function?  For those it will be
built and the important question is how the GCC/libiberty-build behaves 
with them, does it fail or not...

> In fact, why is gcc-3.3 trying to build libiberty with the *target*
 > compiler anyway?

  Your question(s) could also be "For which purposes the extra functions
in 'libiberty' are needed?" and "Why the functions cannot simply be
included into newlib and glibc ?"  Unfortunately I cannot answer to
these, one must review the libiberty documentation...

Cheers, Kai


  parent reply	other threads:[~2003-05-20 10:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-20  6:12 Peter Barada
2003-05-20  6:53 ` Erik Christiansen
2003-05-20 10:53   ` Kai Ruottu
2003-05-20 10:44 ` Kai Ruottu [this message]
2003-05-21  4:55   ` Peter Barada
2003-05-21  7:13     ` Peter Barada
2003-05-21 15:05       ` Randy Rude
2003-05-21 15:38         ` Peter Barada
2003-05-21 16:56           ` Randy Rude
2003-05-21 17:28             ` Joe Buck
2003-05-21 17:39           ` DJ Delorie
2003-05-22 14:59             ` Randy Rude
2003-05-22 17:36               ` DJ Delorie
2003-05-23 19:40                 ` Randy Rude
2003-05-22  3:14           ` Peter Barada
2003-05-22 12:17             ` Kai Ruottu
2003-05-22 13:33               ` Peter Barada
2003-05-23  3:25               ` Peter Barada
2003-05-20 16:19 ` DJ Delorie
2003-05-20 21:06   ` Kaveh R. Ghazi
2003-05-20 21:44     ` DJ Delorie
2003-05-23 15:30       ` Kaveh R. Ghazi
2003-05-23 17:49         ` Joe Buck
2003-05-23 18:17           ` Peter Barada
2003-05-23 18:17             ` Joe Buck
2003-05-23 18:39               ` Peter Barada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EC9F529.6060106@luukku.com \
    --to=kai.ruottu@luukku.com \
    --cc=crossgcc@sources.redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=peter@baradas.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).