public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Ruottu <kai.ruottu@wippies.com>
To: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
	William Gregorio <wmg665@gmail.com>,
	gcc-help@gcc.gnu.org
Subject: Re: GCC cross-compiler errors
Date: Tue, 29 Sep 2020 10:04:31 +0300	[thread overview]
Message-ID: <e54f3053-5b50-4242-376e-196423ce15ed@wippies.com> (raw)
In-Reply-To: <a1c5d37e-ab38-6beb-d9ae-33b6f38857d5@foss.arm.com>

Richard Earnshaw kirjoitti 28.9.2020 klo 19.46:
> On 25/09/2020 14:12, William Gregorio via Gcc-help wrote:
>> Hi,
>>
>> I'm trying to build a gcc cross-compiler from source, and whenever I invoke
>> make it results in an error. I'd appreciate any help! Feel free to request
>> any more details needed.
>>
>> ./configure options
>> --target=arm-none-eabi
>> --prefix=/usr/bin/crossbuild
>> --without-headers
>> --enable-multilib
>> --with-multilib=armv7e-m
>> --with-gnu-as
>> --with-gnu-ld
>> --with-dwarf2
>> --with-newlib
>> --with-system-zlib
>> --without-libffi
>> --disable-decimal-float
>> --disable-nls
>> --enable-languages="c,c++"
>> --enable-interwork
>> --disable-libstdcxx-pch
>> --with-newlib
>>
>>
>> make all
Here are the true errors during the configure/build :
>> configure: WARNING: stdbool.h: present but cannot be compiled
>> configure: WARNING: stdbool.h:     check for missing prerequisite headers?
>> checking for stdbool.h... no
>> configure: WARNING: stdalign.h: present but cannot be compiled
>> configure: WARNING: stdalign.h:     check for missing prerequisite headers?
>> checking for stdalign.h... no
>> Makefile:10307: recipe for target 'configure-target-libstdc++-v3' failed
>> make[1]: *** [configure-target-libstdc++-v3] Error 1
I don't remember for what group these headers belong but one thing is 
sure in
every GCC build, especially when trying to produce the extra target 
libraries like
'libstdc++-v3'.  What was told in the "Prerequisites" :
https://gcc.gnu.org/install/prerequisites.html

"In order to build GCC, the C standard library and headers must be 
present for all
target variants for which target libraries will be built (and not only 
the variant of
the host C++ compiler)."

So where you did put the required 'arm-none-eabi' target headers?
The option :

|--without-headers|
    Tells GCC not use any target headers from a libc when building a 
cross compiler.
    When crossing to GNU/Linux, you need the headers so GCC can build the
    exception handling for libgcc.

Isn't maybe very clearly described. What means the "cross compiler"?  Is 
it the
"xgcc", "cc1", "cc1plus" etc produced into the 'gcc' build directory?  
Or does it
also include all the target libraries produced with these executables?  The
"Prerequisites" is more clear in this issue.  The :

--with-newlib
    Specifies that ‘newlib’ is being used as the target C library. This 
causes __eprintf
    to be omitted from libgcc.a on the assumption that it will be 
provided by ‘newlib’.

then only shows that one's aim is to use 'newlib' as the target C 
library. Normally
this means that one builds 'newlib' at the same time with the GCC 
sources via
providing the 'newlib' and 'libgloss' subdirs from the 'newlib-x.yz' 
sources in the
main GCC source directory.  Via copying or symlinking. The GCC build 
will find the
newlib headers automatically during the GCC and target libraries builds 
among
the sources.  Trying to copy the headers from the newlib sources where 
they would
be found is more hard ("--with-headers=<something>").  If one already 
has an earlier
toolchain for the target with "acid tested" C library, then not building 
one with the
new GCC maybe is motivated. Only when one is sure that the newer GCC 
will produce
working code. In this case one knows where the target headers are and 
can copy them
or use them where they are (the $prefix used in configure is the same).

>> Use a separate build area from your sources.  Building inside the source
>> tree is not supported.
This is true but I'm not sure whether this was the case here. "Where are the
target headers and where to put them" has been an eternal problem when 
people
are building tools for embedded use.  And all kind of "conspiracy 
theories" about
the GCC developers trying to get things complicated are spread in the 
net. Although
the "Prerequisites" clearly tells :
"To build all languages in a cross-compiler or other configuration where 
3-stage
bootstrap is not performed,"
people still believe in weird "multi-phase" build requirements in cross 
GCC builds.
For instance that building newlib immediately with GCC doesn't work but 
one must
first build a "bootstrap GCC", then newlib from sources with it and in 
stage 3 the
"final GCC".


      reply	other threads:[~2020-09-29  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-25 13:12 William Gregorio
2020-09-28 16:46 ` Richard Earnshaw
2020-09-29  7:04   ` Kai Ruottu [this message]

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=e54f3053-5b50-4242-376e-196423ce15ed@wippies.com \
    --to=kai.ruottu@wippies.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=wmg665@gmail.com \
    /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).