Configuring a cross compile with --with_sysroot

Michiel Bacchiani michiel.bacchiani@gmail.com
Fri Sep 2 14:33:00 GMT 2016


I had added that before without any success. Tried it again and
confirmed it still doesn't work. But I did solve it, so for the
benefit of others: enlightening was a

# gcc-4.9.4-build-arm/gcc/cpp -v

which in the report of COLLECT_GCC_OPTIONS showed

-imultiarch arm-linux-gnueabi

Ie. it searches in the target header sub-path, but it deduces target
different from what I intended. The "hf" is "hard float" (one of the
ARM additional target nuances). So with --enable-multiarch and
--with-float=hard things work.

Thanks for sending me in the right direction.

Michiel.


On Fri, Sep 2, 2016 at 2:58 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
> On Friday, 2 September 2016, Michiel Bacchiani <michiel.bacchiani@gmail.com>
> wrote:
>> 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.
>
> That path is a Debianism, it might be searched if you add --enable-multiarch
> to your configure flags.
>



More information about the Gcc-help mailing list