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".