Configuring a cross compile with --with_sysroot
Michiel Bacchiani
michiel.bacchiani@gmail.com
Fri Sep 2 02:38:00 GMT 2016
I am attempting to cross compile GCC on x86_64 for arm. I created a
chroot with the arm system with the target system headers.
I configure the build with
${ROOT}/gcc-4.9.4/configure \
--prefix=${ROOT}/toolchain \
--program-prefix=arm-linux-gnueabihf- \
--enable-languages=c,c++ \
--with-gnu-as \
--with-as=${ROOT}/toolchain/bin/arm-linux-gnueabihf-as \
--with-gnu-ld \
--with-ld=${ROOT}/toolchain/bin/arm-linux-gnueabihf-ld \
--with-sysroot=/var/lib/schroot/chroots/trusty-armhf \
--target=arm-linux-gnueabihf \
--disable-multilib \
--disable-nls
It succeeds in building the first compiler and then starts to use it
./gcc/xgcc .....
which dies with
make[2]: *** [_addvsi3.o] Error 1
In file included from
/var/lib/schroot/chroots/trusty-armhf/usr/include/stdio.h:27:0,
from
/usr/local/suteki/chn_20160901/gcc-4.9.4/libgcc/../gcc/tsystem.h:87,
from
/usr/local/suteki/chn_20160901/gcc-4.9.4/libgcc/libgcc2.c:27:
/var/lib/schroot/chroots/trusty-armhf/usr/include/features.h:374:25:
fatal error: sys/cdefs.h: No such file or directory
# include <sys/cdefs.h>
^
compilation terminated.
The header it cannot find is present but in
/var/lib/schroot/chroots/trusty-armhf/usr/include/arm-linux-gnueabihf/sys/cdefs.h
It seems only <sysroot>/usr/include is on the search path, not the
additional <sysroot>/usr/include/<target> which is needed to find this
header.
How can I add this search path? Searching for header in the
configuration instruction page came up empty...

Michiel.
More information about the Gcc-help
mailing list