public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Configuring a cross compile with --with_sysroot
@ 2016-09-02  2:38 Michiel Bacchiani
       [not found] ` <CAH6eHdQN7c9o__nCWXQyGMbAs1szZtLoSJkc3vfUEL622g0W2g@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Michiel Bacchiani @ 2016-09-02  2:38 UTC (permalink / raw)
  To: gcc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Configuring a cross compile with --with_sysroot
       [not found] ` <CAH6eHdQN7c9o__nCWXQyGMbAs1szZtLoSJkc3vfUEL622g0W2g@mail.gmail.com>
@ 2016-09-02 14:33   ` Michiel Bacchiani
  0 siblings, 0 replies; 2+ messages in thread
From: Michiel Bacchiani @ 2016-09-02 14:33 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-02 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02  2:38 Configuring a cross compile with --with_sysroot Michiel Bacchiani
     [not found] ` <CAH6eHdQN7c9o__nCWXQyGMbAs1szZtLoSJkc3vfUEL622g0W2g@mail.gmail.com>
2016-09-02 14:33   ` Michiel Bacchiani

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