Skip to contentSkip to conversation

Few questions external toolchain

Buildroot Marco Trapanese 3 participants 11 messages Feb 24, 2014 – Mar 17, 2014

lore
Share & tools
lore
#0 lore raw

Hello,
after reading the documentation I still have some questions. I want to use a Linaro toolchain for an imx6 board.

The toolchain is hosted on a git repository, and I don't understand how to tell this to buildroot. It seems it looks for a tar.gz file.

Anyway I tried to manually git clone the toolchain and I passed the directory of the local repo.
When it tries to compile something it returns:

checking for arm-buildroot-linux-gnueabi-gcc... /home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc checking whether the C compiler works... no
configure: error: in `/home/marco/dev/buildroot/output/build/alsa-lib-1.0.26':

the path is correct, but why it looks for "arm-buildroot-linux-gnueabi-gcc"? It seems the internal toolchain!

Attached there is my .config file and the buildroot version is: 2014.02-rc2

Thanks!
Marco

-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config
Type: application/xml
Size: 39446 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140224/b4b6c472/attachment.wsdl>

#1 lore raw

After digging a bit more I found the following:

ls -l ~/dev/buildroot/output/host/usr/bin/*gcc

lrwxrwxrwx 1 marco marco 21 feb 25 11:00 arm-fsl-linux-gnueabi-gcc
-> ext-toolchain-wrapper
-rwxr-xr-x 1 marco marco 5908 feb 25 11:00 ext-toolchain-wrapper

./arm-fsl-linux-gnueabi-gcc
arm-fsl-linux-gnueabi-gcc: fatal error: no input files

it's ok, but:

./ext-toolchain-wrapper /home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper: No such file or directory

I don't understand this behavior and I didn't find any information about in the documentation. Did I searched wrong?
Thanks
Marco

Il 24/02/2014 19:18, Marco Trapanese ha scritto:

Quoted 27 lines

Hello,
after reading the documentation I still have some questions. I want to use a Linaro toolchain for an imx6 board.

The toolchain is hosted on a git repository, and I don't understand how to tell this to buildroot. It seems it looks for a tar.gz file.

Anyway I tried to manually git clone the toolchain and I passed the directory of the local repo.
When it tries to compile something it returns:

checking for arm-buildroot-linux-gnueabi-gcc... /home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc checking whether the C compiler works... no
configure: error: in `/home/marco/dev/buildroot/output/build/alsa-lib-1.0.26':

the path is correct, but why it looks for "arm-buildroot-linux-gnueabi-gcc"? It seems the internal toolchain!

Attached there is my .config file and the buildroot version is:
2014.02-rc2

Thanks!
Marco

#2 lore raw

Hi Marco,

Quoted 13 lines · Marco Trapanese

After digging a bit more I found the following:

ls -l ~/dev/buildroot/output/host/usr/bin/*gcc

lrwxrwxrwx 1 marco marco 21 feb 25 11:00 arm-fsl-linux-gnueabi-gcc ->
ext-toolchain-wrapper
-rwxr-xr-x 1 marco marco 5908 feb 25 11:00 ext-toolchain-wrapper

./arm-fsl-linux-gnueabi-gcc
arm-fsl-linux-gnueabi-gcc: fatal error: no input files

Quoted 8 lines

it's ok, but:

./ext-toolchain-wrapper /home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper: No such file or directory

I don't understand this behavior and I didn't find any information about in the documentation. Did I searched wrong?

The external toolchain wrapper is created automatically by buildroot when the toolchain is 'installed'.
However, above I see two different paths:
/home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper and
~/dev/buildroot/output/host/usr/bin/

Have you moved the buildroot repository to another location? Normally the toolchain wrapper is located in <output>/host/usr/bin, just like the symbolic links that point to it.

Best regards,
Thomas

#3 lore raw

Il 25/02/2014 14:10, Thomas De Schampheleire ha scritto:

Quoted 7 lines

The external toolchain wrapper is created automatically by buildroot when the toolchain is 'installed'. However, above I see two different
paths: /home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper and ~/dev/buildroot/output/host/usr/bin/ Have you moved the buildroot repository to another location? Normally the toolchain wrapper is located in <output>/host/usr/bin, just like the symbolic links that point to it. Best regards, Thomas

Thomas,
the first path:

/home/marco/dev/fsl-linaro-toolchain/fsl-linaro-toolchain/bin

is where I put my toolchain.
The second one:

home/marco/dev/buildroot/output/host/usr/bin/

is where buildroot wrapped the toolchain, but of course /home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper does not exist!

I tried to let buildroot to download the tarball but it's the same. In the meanwhile I fix this issue I'm compiling using the built-in codesourcery toolchain.

Best regards
Marco

#4 lore raw
In reply to Marco Trapanese

Hi Marco,

Quoted 10 lines · Marco Trapanese

After digging a bit more I found the following:

ls -l ~/dev/buildroot/output/host/usr/bin/*gcc

lrwxrwxrwx 1 marco marco 21 feb 25 11:00 arm-fsl-linux-gnueabi-gcc ->
ext-toolchain-wrapper
-rwxr-xr-x 1 marco marco 5908 feb 25 11:00 ext-toolchain-wrapper

Quoted 9 lines

./arm-fsl-linux-gnueabi-gcc
arm-fsl-linux-gnueabi-gcc: fatal error: no input files

it's ok, but:

./ext-toolchain-wrapper /home/marco/dev/fsl-linaro-toolchain/bin/ext-toolchain-wrapper: No such file or directory

I now understand your problem better. The toolchain wrapper is not supposed to be called directly like that, but rather always through a symbolic link, like the 'arm-fsl-linux-gnueabi-gcc' one. The wrapper uses the name of the link (how it was called) to know which tool to call in the real toolchain installation.
So the behavior you are seeing above is normal.

Regarding the usage of a git repo as toolchain: did you try to set the URL as 'git://URL_of_repo/' ?

Finally, to understand the cause of the problem you were experiencing:
checking for arm-buildroot-linux-gnueabi-gcc... /home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc checking whether the C compiler works... no
configure: error: in `/home/marco/dev/buildroot/output/build/alsa-lib-1.0.26'

you should look in the 'config.log' file inside /home/marco/dev/buildroot/output/build/alsa-lib-1.0.26. The file may be long, and the error will not be entirely at the end. You should look for the string 'checking whether the C compiler works', and see what the error is that caused the 'no'.

Best regards,
Thomas

#5 lore raw

Hi Thomas,
thank you for your clarification. Perhaps this is described in the guide but I didn't find it.
About the toolchain git repo I tried to set the URL as 'git://URL_of_repo/' but it asks for a tarball.

Anyway I can live with it at the moment... I manually cloned the repository outside buildroot and I passed the path of the toolchain's root directory.

Below the relevant part of the config.log. It seems the linker cannot find the libraries. Should I set any environment variables? I can't see any other options in the nconfig menu.

configure:3133: checking for arm-buildroot-linux-gnueabi-gcc configure:3160: result:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc configure:3429: checking for C compiler version
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc --version >&5
arm-fsl-linux-gnueabi-gcc (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) 4.6.2 20110630 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3449: $? = 0
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc
-v >&5
Using built-in specs.
COLLECT_GCC=/home/marco/dev/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/home/marco/dev/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
Target: arm-fsl-linux-gnueabi
Configured with:
/work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure
--build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu
--target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro
2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit
--disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl'
--enable-threads=posix --enable-target-optspace --enable-plugin
--enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs
--disable-nls --enable-c99 --enable-long-long --with-system-zlib
Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07
-- Built at 2011/08/10 09:20)
configure:3449: $? = 0
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc
-V >&5
arm-fsl-linux-gnueabi-gcc: error: unrecognized option '-V'
arm-fsl-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3449: $? = 1
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc
-qversion >&5
arm-fsl-linux-gnueabi-gcc: error: unrecognized option '-qversion'
arm-fsl-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3449: $? = 1
configure:3469: checking whether the C compiler works
configure:3491:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe
-Os -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -lm conftest.c >&5 /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crt1.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crti.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lm /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lc /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status
configure:3495: $? = 1
configure:3533: result: no

Thanks!
Marco

#6 lore raw

Hi Marco,

On Wed, Feb 26, 2014 at 5:53 PM, Marco Trapanese
<[email protected]> wrote:
[..]

Quoted 15 lines

configure:3469: checking whether the C compiler works configure:3491:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc

(quoted diff) +0 -3
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe -Os
-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64  -lm conftest.c  >&5

/home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crt1.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crti.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lm /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:

Quoted 10 lines

cannot find -lc /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status
configure:3495: $? = 1
configure:3533: result: no

Can you run following command:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc
-print-file-name=crt1.o
and verify that the reported file exists? What is the output?

Normally you shouldn't give any special environment flags.

You could also try to compile a simple hello world program with that compiler in output/host/usr/bin, to see if that works correctly or not.

Thanks,
Thomas

#7 lore raw

Hi Thomas,

Il 26/02/2014 20:42, Thomas De Schampheleire ha scritto:

Quoted 3 lines

Can you run following command:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc -print-file-name=crt1.o and verify that the reported file exists? What is the output?

The output is:

crt1.o

Furthermore:

find -name crt1.o ./output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/crt1.o

Quoted 3 lines

Normally you shouldn't give any special environment flags. You could also try to compile a simple hello world program with that compiler in output/host/usr/bin, to see if that works correctly or not.

Compiling an hello world program with the (symbolic link) in output/host/usr/bin/arm-fsl-linux-gnueabi-gcc leads to the same linker errors described in the previous post.

But the original compiler (/home/marco/dev/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-gcc) works fine with the same hello world.

Thanks again!
Marco

#8 lore raw
In reply to Marco Trapanese
Quoted 88 lines · Marco Trapanese

Hi Thomas,
thank you for your clarification. Perhaps this is described in the guide but I didn't find it.
About the toolchain git repo I tried to set the URL as 'git://URL_of_repo/' but it asks for a tarball.

Anyway I can live with it at the moment... I manually cloned the repository outside buildroot and I passed the path of the toolchain's root directory.

Below the relevant part of the config.log. It seems the linker cannot find the libraries. Should I set any environment variables? I can't see any other options in the nconfig menu.

configure:3133: checking for arm-buildroot-linux-gnueabi-gcc configure:3160: result:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc configure:3429: checking for C compiler version
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc --version >&5
arm-fsl-linux-gnueabi-gcc (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) 4.6.2 20110630 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3449: $? = 0
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc -v >&5
Using built-in specs. COLLECT_GCC=/home/marco/dev/fsl-linaro-toolchain/bin/arm-fsl-linux-gnueabi-gcc

COLLECT_LTO_WRAPPER=/home/marco/dev/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper

Target: arm-fsl-linux-gnueabi
Configured with:
/work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20)
configure:3449: $? = 0
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc -V >&5
arm-fsl-linux-gnueabi-gcc: error: unrecognized option '-V'
arm-fsl-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3449: $? = 1
configure:3438:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc -qversion >&5
arm-fsl-linux-gnueabi-gcc: error: unrecognized option '-qversion'
arm-fsl-linux-gnueabi-gcc: fatal error: no input files
compilation terminated.
configure:3449: $? = 1
configure:3469: checking whether the C compiler works
configure:3491:
/home/marco/dev/buildroot/output/host/usr/bin/arm-fsl-linux-gnueabi-gcc

(quoted diff) +0 -3
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -pipe
-Os  -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64  -lm conftest.c  >&5

/home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crt1.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crti.o: No such file or directory /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lm

Quoted 8 lines

/home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lc /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s /home/marco/dev/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crtn.o: No such file or directory

This smells like our external toolchain logic doesn't properly locate
and copy the sysroot. Can you verify if output/staging/usr/lib/crt1.o exists?

Perhaps if you can give the URL of this external toolchain, we can have
a look?

Regards,
Arnout

Quoted 14 lines

collect2: ld returned 1 exit status
configure:3495: $? = 1
configure:3533: result: no

Thanks!
Marco

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#9 lore raw

Il 26/02/2014 22:47, Arnout Vandecappelle ha scritto:

Quoted 3 lines

This smells like our external toolchain logic doesn't properly locate and copy the sysroot. Can you verify if output/staging/usr/lib/crt1.o exists?

Yes, it exists!

Quoted 2 lines

Perhaps if you can give the URL of this external toolchain, we can have a look? Regards, Arnout

https://github.com/embest-tech/fsl-linaro-toolchain

Thank you!
Marco

#10 lore raw

Hi Marco,

Quoted 11 lines · Marco Trapanese

Il 26/02/2014 22:47, Arnout Vandecappelle ha scritto:

Quoted 2 lines

This smells like our external toolchain logic doesn't properly locate and copy the sysroot. Can you verify if output/staging/usr/lib/crt1.o exists?

Yes, it exists!

Quoted 7 lines
Quoted 2 lines

Perhaps if you can give the URL of this external toolchain, we can have a look? Regards, Arnout

https://github.com/embest-tech/fsl-linaro-toolchain

I finally took some time to look into this, sorry for the long delay. I can indeed reproduce this problem:

$ BR2_DEBUG_WRAPPER=2 ./output/host/usr/bin/arm-linux-gcc /tmp/test.c
Toolchain wrapper executing:
    '/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/arm-linux-gcc'
    '--sysroot'
    '/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot'
    '-mabi=aapcs-linux'
    '-msoft-float'
    '-marm'
    '-pipe'
    '-mfloat-abi=soft'
    '-march=armv5te'
    '-mcpu=arm926ej-s'
    '/tmp/test.c'
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crt1.o: No such file or directory
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crti.o: No such file or directory
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lc
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find -lgcc_s
/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/bin/ld:
cannot find crtn.o: No such file or directory
collect2: ld returned 1 exit status

./output/host/usr/bin/arm-linux-gcc -print-file-name=crt1.o crt1.o

The details of gcc provided with the toolchain:
./output/host/usr/bin/arm-linux-gcc -v
Using built-in specs.
COLLECT_GCC=/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/arm-linux-gcc COLLECT_LTO_WRAPPER=/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper
Target: arm-fsl-linux-gnueabi
Configured with:
/work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure
--build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu
--target=arm-fsl-linux-gnueabi
--prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs
--enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro
2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit
--disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic
-lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl'
--enable-threads=posix --enable-target-optspace --enable-plugin
--enable-multilib
--with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs
--disable-nls --enable-c99 --enable-long-long --with-system-zlib
Thread model: posix
gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro
2011.07 -- Built at 2011/08/10 09:20)

Looking at why crt1.o is not found, using strace, following locations are tried:

8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/armv5/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/armv5/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/lib/arm-fsl-linux-gnueabi/4.6.2/armv5/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/lib/armv5/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/lib/arm-fsl-linux-gnueabi/4.6.2/armv5/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/lib/armv5/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/usr/lib/arm-fsl-linux-gnueabi/4.6.2/armv5/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/usr/lib/armv5/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/lib/arm-fsl-linux-gnueabi/4.6.2/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../lib/gcc/arm-fsl-linux-gnueabi/4.6.2/../../../../arm-fsl-linux-gnueabi/lib/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/lib/arm-fsl-linux-gnueabi/4.6.2/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/lib/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/usr/lib/arm-fsl-linux-gnueabi/4.6.2/crt1.o", R_OK) = -1 ENOENT (No such file or directory)
8119 access("/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/armv5/usr/lib/crt1.o",
R_OK) = -1 ENOENT (No such file or directory)

while the real location is:
output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/crt1.o

If I check the original toolchain directly (outside of
buildroot):./bin/arm-linux-gcc -print-file-name=crt1.o /home/tdescham/repo/contrib/fsl-linaro-toolchain/bin/../arm-fsl-linux-gnueabi/multi-libs/default/usr/lib/crt1.o

So at least the original toolchain can find its crt1.o.

Going back to buildroot, here are some variables determined in the
external toolchain logic:
SYSROOT_DIR=/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/default/ ARCH_SYSROOT_DIR=/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/armv5/ ARCH_LIB_DIR=lib
SUPPORT_LIB_DIR= ARCH_SUBDIR=/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/armv5/

During copying of the toolchain files, I do see following message:

ln: target '/home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot//home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/armv5/' is not a directory: No such file or directory
Symlinking /home/tdescham/repo/contrib/buildroot-toolchain-marco/output/host/usr/arm-buildroot-linux-gnueabi/sysroot//home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/armv5/ -> ./../../../../../../../../../

and this message originates from:
toolchain/helpers.mk:158: echo "Symlinking
$(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \

meaning that ARCH_SUBDIR is not supposed to be an absolute path. ARCH_SUBDIR is determined as follows:
ARCH_SUBDIR=echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"

which essentially strips off SYSROOT_DIR from the beginning of ARCH_SYSROOT_DIR. However, there is no common part between both variables in this toolchain:

SYSROOT_DIR=/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/default/ ARCH_SYSROOT_DIR=/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/armv5/

so the logic of determining ARCH_SUBDIR is not correct in this case. Looking at the strace output given above, the expected ARCH_SUBDIR is 'armv5'.

However, I don't know what is the best way to handle this.
One could try to find the greatest common path between SYSROOT_DIR and ARCH_SYSROOT_DIR (/home/tdescham/repo/contrib/fsl-linaro-toolchain/arm-fsl-linux-gnueabi/multi-libs/) and strip that from ARCH_SYSROOT_DIR to get ARCH_SUBDIR, which would fix this use case, but sounds not right.

Any input appreciated,

Best regards,
Thomas