Bug 1741

Summary: external toolchain linking error
Product: buildroot Reporter: Matthias Brugger <mensch0815>
Component: OtherAssignee: Thomas Petazzoni <thomas.petazzoni>
Status: RESOLVED FIXED    
Severity: major CC: buildroot
Priority: P5    
Version: 2010.02   
Target Milestone: 2010.08   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: config file to create external toolchain
config file of buildroot using external toolchain
config file which uses dont-touch toolchain
config file to build the toolchain

Description Matthias Brugger 2010-05-10 09:29:11 UTC
When you use an external toolchain to compile packages you get an error like:
"cannot find /lib/libc.so.0"

Fix this by changing the paths in toolchain-folder/usr/lib/libc.so :

--- libc.so.old 2010-05-10 10:54:45.602118000 +0200
+++ libc.so 2010-05-10 11:05:57.337434000 +0200
@@ -3,4 +3,4 @@
* the static library, so try that secondarily. */
OUTPUT_FORMAT("elf32-avr32", "elf32-avr32", "elf32-avr32")
-GROUP ( /lib/libc.so.0 /usr/lib/uclibc_nonshared.a AS_NEEDED ( /lib/ld-uClibc.so.0 ) )
+GROUP ( ../lib/libc.so.0 ../usr/lib/uclibc_nonshared.a AS_NEEDED ( ../lib ld-uClibc.so.0 ) )
Comment 1 Thomas Petazzoni 2010-05-10 18:17:02 UTC
Could you precise which external toolchain you're using ? Buildroot has been tested with CodeSourcery toolchains, Crosstool-NG toolchains and Buildroot toolchains only.
Comment 2 Thomas Petazzoni 2010-05-10 21:48:28 UTC
Ok, I also have this problem with a Crosstool-NG eglibc toolchain while trying to compile netsnmp. It's due to the fact that libtool removes the --sysroot argument.

With which package and configuration do you have this failure ?
Comment 3 Matthias Brugger 2010-05-11 08:47:26 UTC
(In reply to comment #1)
> Could you precise which external toolchain you're using ? Buildroot has been
> tested with CodeSourcery toolchains, Crosstool-NG toolchains and Buildroot
> toolchains only.

I use a external toolchain build with Buildroot (sysroot + locale enabled. uClib).
This happens with Buildroot version 2010.02.
Comment 4 Thomas Petazzoni 2010-05-21 13:03:25 UTC
Thanks Matthias. But my previous question was: at which step of the compilation does you have this error ? Could you give some details about when the failure occurs and what are the latest parts of the build log ?
Comment 5 Thomas Petazzoni 2010-06-24 10:29:55 UTC
Mathias, could you add a little bit more details about how I can reproduce the build issue ? Like a .config file, or the package causing the problem, the full build log, etc.
Comment 6 Matthias Brugger 2010-06-25 07:58:06 UTC
Hi Thomas,

sorry I don't have the .config files any more. the toolchain was build with buildroot in an external directory.

I'll try to reproduce the error and if possible will give you some more information, ok.
Comment 7 Matthias Brugger 2010-06-25 10:57:43 UTC
Hello Thomas,

right now I get a different error, maybe it's because I use 2010.05.
But after all I think there is a problem, when you build an external toolchain with one buildroot and then try to build another buildroot with this toolchain.
In my case I build the atngw100 with toolchain dir to /home/matthias/toolchain.
Afterwards I took another buildroot (with same version) and tried to build antgw100 but stating that the external toolchain is at /home/matthias/toolchain.

Check this, I'm sure you will find some bugs.
Hope that helped a bit.

Regards,
Matthias
Comment 8 Thomas Petazzoni 2010-06-25 12:05:41 UTC
Can you post the .config you used for both builds (i.e the Buildroot that builds the toolchain, and the Buildroot that builds the system using the previously built toolchain) ?
Comment 9 Matthias Brugger 2010-06-29 17:24:59 UTC
Created attachment 2137 [details]
config file to create external toolchain
Comment 10 Matthias Brugger 2010-06-29 17:25:39 UTC
Created attachment 2143 [details]
config file of buildroot using external toolchain
Comment 11 Matthias Brugger 2010-06-29 17:26:43 UTC
Hi Thomas,

I uploaded the two config files.

Best regards,
Matthias
Comment 12 Matthias Brugger 2010-07-02 09:56:01 UTC
Created attachment 2155 [details]
config file which uses dont-touch toolchain
Comment 13 Matthias Brugger 2010-07-02 09:57:06 UTC
Created attachment 2161 [details]
config file to build the toolchain
Comment 14 Matthias Brugger 2010-07-02 09:59:55 UTC
Hi,

today I had the error once again, but this time I don't even have root privileges to apply the mentioned patch.
I've already added the two config files (the both from 2010-07-02)...

and here the output:
/bin/sh ../libtool --mode=compile /home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/avr32-linux-gcc -Os -pipe -Os  -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot /home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/staging_dir/ -c -DLOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DLIBDIR=\"/usr/lib\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -I. -I. -I..  -g -O2 -fvisibility=hidden  ./intl-compat.c
 /home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/avr32-linux-gcc -Os -pipe -Os -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot /home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/staging_dir/ -c -DLOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DLIBDIR=\"/usr/lib\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -fvisibility=hidden ./intl-compat.c  -fPIC -DPIC -o .libs/intl-compat.o
 /home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/avr32-linux-gcc -Os -pipe -Os -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot /home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/staging_dir/ -c -DLOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DLIBDIR=\"/usr/lib\" -DBUILDING_LIBINTL -DBUILDING_DLL -DIN_LIBINTL -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLDIR=\"/usr/lib\" -DNO_XMALLOC -Dset_relocation_prefix=libintl_set_relocation_prefix -Drelocate=libintl_relocate -DDEPENDS_ON_LIBICONV=1 -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -fvisibility=hidden ./intl-compat.c -o intl-compat.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link \
	  /home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/avr32-linux-gcc -Os -pipe -Os  -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot /home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/staging_dir/  -g -O2 -fvisibility=hidden   -o libintl.la \
	  bindtextdom.lo dcgettext.lo dgettext.lo gettext.lo finddomain.lo hash-string.lo loadmsgcat.lo localealias.lo textdomain.lo l10nflist.lo explodename.lo dcigettext.lo dcngettext.lo dngettext.lo ngettext.lo plural.lo plural-exp.lo localcharset.lo lock.lo relocatable.lo langprefs.lo localename.lo log.lo printf.lo version.lo osdep.lo intl-compat.lo -liconv    -lc \
	  -version-info 8:1:0 \
	  -rpath /usr/lib \
	  -no-undefined
/home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/avr32-linux-gcc -Os -pipe -Os  -msoft-float -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 --sysroot /home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/staging_dir/ -shared  .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/localcharset.o .libs/lock.o .libs/relocatable.o .libs/langprefs.o .libs/localename.o .libs/log.o .libs/printf.o .libs/version.o .libs/osdep.o .libs/intl-compat.o  -Wl,--rpath -Wl,/home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/lib -Wl,--rpath -Wl,/home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/lib /home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/lib/libiconv.so -L/home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/lib -L/home/hf/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/lib -lc  -msoft-float -Wl,-soname -Wl,libintl.so.8 -o .libs/libintl.so.8.0.1
/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/all/buildroot-2010.05-dont-touch/output/build/staging_dir/usr/bin/../lib/gcc/avr32-unknown-linux-uclibc/4.2.2/../../../../avr32-unknown-linux-uclibc/bin/ld: cannot find /lib//libc.so.0
collect2: ld returned 1 exit status
make[4]: *** [libintl.la] Fehler 1
make[4]: Leaving directory `/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/gettext-0.16.1/gettext-runtime/intl'
make[3]: *** [all-recursive] Fehler 1
make[3]: Leaving directory `/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/gettext-0.16.1/gettext-runtime'
make[2]: *** [all] Fehler 2
make[2]: Leaving directory `/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/gettext-0.16.1/gettext-runtime'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/gettext-0.16.1'
make: *** [/home/hfprojn1/projekte/aktuell/Adaptive_Antennen/usr/bgg/buildroot-2010.05/output/build/gettext-0.16.1/gettext-runtime/src/gettext] Fehler 2

cheers,
matthias
Comment 15 Thomas Petazzoni 2010-07-26 14:13:52 UTC
Ok, I managed to reproduce the issue, and I have a fix currently being tested for it. Should hopefully be merged before 2010.08.
Comment 16 Thomas Petazzoni 2010-07-27 21:32:26 UTC
Even though I didn't reproduce the /lib/libc.so.0 failure during the gettext build as our reporter did, http://git.buildroot.net/buildroot/commit/?id=3c77bab2eeace3ee675bd745ca335fa3dd1630bb fixes a similar problem. So I think this bug has been fixed now.

If you manage to reproduce the bug with the current Buildroot Git, please reopen this bug.