Bug 4921

Summary: Building libtool_cross fails when using external cross-toolchain for 32 bit on 64 bit host
Product: [Build System, Metadata & Runtime] Other YP Layers Reporter: Laszlo Papp <lpapp>
Component: layersAssignee: Christopher Larson <kergoth>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: Medium CC: kergoth, poky.bs.watcher, poky.watcher, ross.burton, sgw
Version: unspecified   
Target Milestone: 1.5   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
config.log none

Description Laszlo Papp 2013-07-26 02:47:06 UTC
Created attachment 1367 [details]
config.log

bitbake core-image-minimal
WARNING: Host distribution "arch-rolling" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100% |################################################################################################################################################################| ETA:  00:00:00
Parsing of 848 .bb files complete (0 cached, 848 parsed). 1175 targets, 48 skipped, 0 masked, 0 errors.

Build Configuration:
BB_VERSION        = "1.19.1"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "arch-rolling"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "qemuarm"
DISTRO            = "poky"
DISTRO_VERSION    = "1.4+snapshot-20130726"
TUNE_FEATURES     = "armv5 thumb dsp"
TARGET_FPU        = "soft"
CSL_VER_MAIN      = "2013.05-24"
EXTERNAL_TOOLCHAIN = "/usr"
meta-sourcery     = "master:18bbe5f8ed0f95d2c75b691b92266bc63f832324"
meta              
meta-yocto        
meta-yocto-bsp    = "master:67864ca79da08df752487a3a4e1a975546da123d"

NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Function failed: do_configure (log file is located at /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/temp/log.do_configure.13791)
ERROR: Logfile of failure stored in: /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/temp/log.do_configure.13791
Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
| DEBUG: Python function sysroot_cleansstate finished
| DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
| DEBUG: Executing shell function autotools_preconfigure
| DEBUG: Shell function autotools_preconfigure finished
| DEBUG: Executing shell function do_configure
| automake (GNU automake) 1.12.6
| Copyright (C) 2012 Free Software Foundation, Inc.
| License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
| This is free software: you are free to change and redistribute it.
| There is NO WARRANTY, to the extent permitted by law.
| 
| Written by Tom Tromey <tromey@redhat.com>
|        and Alexandre Duret-Lutz <adl@gnu.org>.
| AUTOV is 1.12
| NOTE: Executing ACLOCAL="aclocal --system-acdir=/home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/build/aclocal-copy/ --automake-acdir=/home/lpapp/Projects/poky/build/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12" autoreconf --verbose --install --force --exclude=libtoolize -I /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/tests/
| autoreconf: Entering directory `.'
| autoreconf: configure.ac: not using Gettext
| autoreconf: running: aclocal --system-acdir=/home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/build/aclocal-copy/ --automake-acdir=/home/lpapp/Projects/poky/build/tmp/sysroots/x86_64-linux/usr/share/aclocal-1.12 -I /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/tests/ -I /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/tests/ --force -I libltdl/m4
| autoreconf: configure.ac: tracing
| autoreconf: running: /home/lpapp/Projects/poky/build/tmp/sysroots/x86_64-linux/usr/bin/autoconf --include=/home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/tests/ --force
| autoreconf: running: /home/lpapp/Projects/poky/build/tmp/sysroots/x86_64-linux/usr/bin/autoheader --include=/home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/tests/ --force
| autoreconf: running: automake --foreign --add-missing --copy --force-missing
| configure.ac:130: installing 'libltdl/config/test-driver'
| autoreconf: running: gnu-configize
| autoreconf: Leaving directory `.'
| NOTE: Running /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/libtool-2.4.2/configure  --build=x86_64-linux 		  --host=arm-poky-linux-gnueabi 		  --target=arm-poky-linux-gnueabi 		  --prefix=/usr 		  --exec_prefix=/usr 		  --bindir=/usr/bin 		  --sbindir=/usr/sbin 		  --libexecdir=/usr/lib/libtool 		  --datadir=/home/lpapp/Projects/poky/build/tmp/sysroots/qemuarm/usr/share 		  --sysconfdir=/etc 		  --sharedstatedir=/com 		  --localstatedir=/var 		  --libdir=/usr/lib 		  --includedir=/usr/include 		  --oldincludedir=/usr/include 		  --infodir=/home/lpapp/Projects/poky/build/tmp/sysroots/qemuarm/usr/share/info 		  --mandir=/home/lpapp/Projects/poky/build/tmp/sysroots/qemuarm/usr/share/man 		  --disable-silent-rules 		  --disable-dependency-tracking 		  --with-libtool-sysroot=/home/lpapp/Projects/poky/build/tmp/sysroots/qemuarm --with-sysroot
| configure: WARNING: unrecognized options: --disable-silent-rules, --with-sysroot
| configure: loading site script /home/lpapp/Projects/poky/meta/site/endian-little
| configure: loading site script /home/lpapp/Projects/poky/meta/site/arm-common
| configure: loading site script /home/lpapp/Projects/poky/meta/site/common-linux
| configure: loading site script /home/lpapp/Projects/poky/meta/site/common-glibc
| configure: loading site script /home/lpapp/Projects/poky/meta/site/arm-linux
| configure: loading site script /home/lpapp/Projects/poky/meta/site/common
| ## ------------------------- ##
| ## Configuring libtool 2.4.2 ##
| ## ------------------------- ##
| 
| checking for a BSD-compatible install... /bin/install -c
| checking whether build environment is sane... yes
| checking for arm-poky-linux-gnueabi-strip... arm-none-linux-gnueabi-strip
| checking for a thread-safe mkdir -p... /bin/mkdir -p
| checking for gawk... gawk
| checking whether make sets $(MAKE)... yes
| checking build system type... x86_64-pc-linux-gnu
| checking host system type... arm-poky-linux-gnueabi
| configure: autobuild project... GNU Libtool
| configure: autobuild revision... 2.4.2 ()
| configure: autobuild hostname... lpapp
| configure: autobuild mode... default
| configure: autobuild timestamp... 20130726T023754Z
| checking for arm-poky-linux-gnueabi-gcc... arm-none-linux-gnueabi-gcc  -march=armv5te -marm -mthumb-interwork --sysroot=/home/lpapp/Projects/poky/build/tmp/sysroots/qemuarm
| checking whether the C compiler works... no
| configure: error: in `/home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/build':
| configure: error: C compiler cannot create executables
| See `config.log' for more details
| Configure failed. The contents of all config.log files follows to aid debugging
| ERROR: oe_runconf failed
| ERROR: Function failed: do_configure (log file is located at /home/lpapp/Projects/poky/build/tmp/work/armv5te-poky-linux-gnueabi/libtool-cross/2.4.2-r6.1/temp/log.do_configure.13791)
ERROR: Task 443 (/home/lpapp/Projects/poky/meta/recipes-devtools/libtool/libtool-cross_2.4.2.bb, do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 357 tasks of which 74 didn't need to be rerun and 1 failed.
Waiting for 0 running tasks to finish:

Summary: 1 task failed:
  /home/lpapp/Projects/poky/meta/recipes-devtools/libtool/libtool-cross_2.4.2.bb, do_configure
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

================================================

Note how the binary is 64 bit that is failing according to the attached config.log:

file /lib/libc.so.6
/lib/libc.so.6: symbolic link to `libc-2.17.so' 
file /lib/libc-2.17.so 
/lib/libc-2.17.so: ELF 64-bit LSB  shared object, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), BuildID[sha1]=51c3975104c4cbebee3ee7735eb8f9332cf64f57, for GNU/Linux 2.6.32, not stripped

How can I make it to pick up the 32 bit variant?
Comment 1 Laszlo Papp 2013-07-26 03:03:49 UTC
Looks like a bug in the meta-sourcery layer maybe?

Arch does not do any package renaming for the new bleeding edge version:

https://aur.archlinux.org/packages/ar/arm-none-linux-gnueabi/PKGBUILD

I suspect that the problem boils down to the fact that MG has not tested meta-sourcery with the latest toolchain.

This is the libc version that should be found:

/usr/arm-none-linux-gnueabi/libc/lib/libc.so.6
lrwxrwxrwx 1 root root 12 Apr 30 10:22 /usr/arm-none-linux-gnueabi/libc/lib/libc.so.6 -> libc-2.17.so

However, meta-sourcery seems to expect this prefix:

ERROR: Unable to populate toolchain binary symlinks in /usr/arm-none-linux-gnueabi/bin/arm-poky-linux-gnueabi-*
ERROR: Execution of event handler 'toolchain_metadata_setup' failed

That is why I cannot use EXTERNAL_TOOLCHAIN = "/usr/arm-none-linux-gnueabi" because the binaries are called like this in there:

ls /usr/arm-none-linux-gnueabi/bin/
ar  as  c++  g++  gcc  ld  nm  objcopy  objdump  ranlib  README.txt  strip

Note, how the prefix is missing.

Instead, I have been forced to use /usr/bin/arm-none-linux-gnueabi-gcc, but then the wrong linker will be found.

Do you have any workaround for this?
Comment 2 Laszlo Papp 2013-07-26 03:07:41 UTC
I wonder if the workaround is just the override the prefix target with zero. I believe that could work with oe-core, but cannot be sure about the meta-sourcery layer. I need some documentation from the MG guys for this, even if it is inside meta-sourcery.
Comment 3 Laszlo Papp 2013-07-26 03:14:39 UTC
See the upstream tarball content as well just to avoid the Arch blaming game:

tar tvf arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 | grep gcc$ | grep -v doc
-rwxr-xr-x root/root    503256 2013-04-30 10:51 arm-2013.05/arm-none-linux-gnueabi/bin/gcc
-rwxr-xr-x root/root    503256 2013-04-30 10:51 arm-2013.05/bin/arm-none-linux-gnueabi-gcc
hrwxr-xr-x root/root         0 2013-04-30 10:51 arm-2013.05/bin/arm-none-linux-gnueabi-gcc-4.7.3 link to arm-2013.05/bin/arm-none-linux-gnueabi-gcc
Comment 4 Laszlo Papp 2013-07-26 03:16:09 UTC
Grep for libc.so.6 as well:

tar tvf arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 | grep libc.so.6
lrwxrwxrwx root/root         0 2013-04-30 10:22 arm-2013.05/arm-none-linux-gnueabi/libc/lib/libc.so.6 -> libc-2.17.so
lrwxrwxrwx root/root         0 2013-04-30 10:26 arm-2013.05/arm-none-linux-gnueabi/libc/armv4t/lib/libc.so.6 -> libc-2.17.so
lrwxrwxrwx root/root         0 2013-04-30 10:31 arm-2013.05/arm-none-linux-gnueabi/libc/thumb2/lib/libc.so.6 -> libc-2.17.so
Comment 5 Christopher Larson 2013-07-26 17:02:09 UTC
You're incorrect. We use meta-sourcery with every version from 2009.01 up to *unreleased* toolchains we get internally before they even go public. We do all our builds today with the 2013.05 sourcery toolchains.
Comment 6 Christopher Larson 2013-07-26 17:04:30 UTC
Using "EXTERNAL_TOOLCHAIN = "/usr/arm-none-linux-gnueabi" " is completely invalid. As I already explain in the meta-sourcery readme, oe/yocto builds need to be able to run non-prefixed native binaries for the host machine. If 'gcc' is arm, then it's impossible to run 'gcc' for x86 anymore. You need to let it run ${TARGET_PREFIX}gcc, not gcc. We will *never* support a configuration in which 'gcc' is for the target.
Comment 7 Laszlo Papp 2013-07-26 17:08:31 UTC
Your comment seems to suggest that to me you have not bothered to read my post carefully here and in the other issue either. Please do that.
Comment 8 Christopher Larson 2013-07-26 17:16:23 UTC
(In reply to comment #2)
> I wonder if the workaround is just the override the prefix target with zero.
> I believe that could work with oe-core, but cannot be sure about the
> meta-sourcery layer. I need some documentation from the MG guys for this,
> even if it is inside meta-sourcery.

This comment shows that you didn't understand the fact that using non-prefixed binaries will not work, and that clearing TARGET_PREFIX will break builds of native recipes, which is what my previous comment explained. It's not unreasonable to explain something you've indicated through your comments you don't understand.

I do intend to look into the linking problem, however.
Comment 9 Laszlo Papp 2013-07-26 17:16:45 UTC
It is in the very beginning of the build configuration: EXTERNAL_TOOLCHAIN = "/usr"

Which is exactly why I tried everything that I had in my mind. /usr/arm... was not the main point of this report at all.

The main point has been /usr as you can see in the configuration. I summarized it for you. So, can we get please some help now with fixing that?
Comment 10 Christopher Larson 2013-07-26 17:26:28 UTC
At a guess, it may be the use of the external toolchain unpacked to a standard path rather than being self contained which is breaking assumptions by the external toolchain. That's a configuration I've never personally tested. As I mentioned, I use meta-sourcery with 2013.05 every day, so I'm guessing its the location which is problematic, as the relative path it's using is climbing out to /lib, which is obviously a problem.

I'd actually be rather surprised if your external toolchain in that location works even outside of Yocto. Would it be possible to do a hello, world compile test on the use of the external toolchain outside of oe/yocto context, to isolate the problem?
Comment 11 Laszlo Papp 2013-07-26 17:28:19 UTC
Not for now as I am not from home where this issue happens. Note, we still use the old toolchain at the company.

Perhaps, you could install it to this location to try yourself if you can get there earlier than me home at some point at the weekend?
Comment 12 Laszlo Papp 2013-07-26 17:33:20 UTC
By the way, a couple of days ago I suggested /opt in here to the author under the name of "djszapi".

https://aur.archlinux.org/packages/arm-none-linux-gnueabi/

Would that be an acceptable change from the Arch unofficial package maintainer or you have a better suggestion for the remote future?
Comment 13 Laszlo Papp 2013-07-26 18:18:48 UTC
echo "int main(void) { return 0; }" > hello.c && /usr/bin/arm-none-linux-gnueabi-gcc hello.c

-> works fine, fwiw.
Comment 14 Christopher Larson 2013-07-26 19:16:33 UTC
Thanks for testing, I'm currently attempting to reproduce the problem locally.
Comment 15 Christopher Larson 2013-07-26 19:18:23 UTC
Interesting data point: installed the pro version of the 2013.05 toolchain to /usr in a fresh chroot, set EXTERNAL_TOOLCHAIN = "/usr", and successfully built most of a core-image-minimal, so got past this error.

It seems that it's either specific to the lite toolchain (testing that next), or it's not seen with ubuntu and I'll have to fire up an arch chroot.
Comment 16 Laszlo Papp 2013-07-27 18:05:09 UTC
This setup succeeded, but since it is not what the archlinux package does, it should still be fixed:

bitbake core-image-minimal
WARNING: Host distribution "arch-rolling" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |##################################################################################################################################################################| ETA:  00:00:00
Loaded 1176 entries from dependency cache.

Build Configuration:
BB_VERSION        = "1.19.1"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "arch-rolling"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "qemuarm"
DISTRO            = "poky"
DISTRO_VERSION    = "1.4+snapshot-20130727"
TUNE_FEATURES     = "armv5 thumb dsp"
TARGET_FPU        = "soft"
CSL_VER_MAIN      = "2013.05-24"
EXTERNAL_TOOLCHAIN = "/usr/local/arm-2013.05"
meta-sourcery     = "master:68ef23ab753467afc46947701e3809655aeea2e3"
meta              
meta-yocto        
meta-yocto-bsp    = "master:67864ca79da08df752487a3a4e1a975546da123d"

NOTE: Resolving any missing task queue dependencies
NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 1617 tasks of which 1613 didn't need to be rerun and all succeeded.

Summary: There was 1 WARNING message shown.

============================================

config files were the same.
Comment 17 Ross Burton 2013-09-25 10:19:09 UTC
Moved to meta-sourcery tracker: https://github.com/MentorEmbedded/meta-sourcery/issues/18.
Comment 18 Laszlo Papp 2013-09-25 10:21:56 UTC
Ok, thanks.