Bug 3090

Summary: Toolchain Assembler is not loaded properly on some hosts
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Alexandru Georgescu <alexandru.c.georgescu>
Component: devtools / tool chainAssignee: Laurentiu Palcu <laurentiu.palcu>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: High CC: alexandru.damian, jessica.zhang, laurentiu.palcu, laurentiu.serban, liang.li2, meta.mr.watcher, meta.watcher, poky.adt.watcher, poky.watcher, richard.purdie
Version: 1.3   
Target Milestone: 1.3 M5   
Hardware: x86   
OS: Multiple   
Whiteboard: merged
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Alexandru Georgescu 2012-09-11 11:30:32 UTC
The assembler installed by the toolchain is not loaded when the environment is sourced and the host assembler is used instead causing some erorrs.

************************************
HAPPENS ON:
Fedora 17 (and CentOS) for: 
poky-eglibc-x86_64-arm, poky-eglibc-x86_64-mips, poky-eglibc-x86_64-powerpc

Ubuntu 12.04 for: 
poky-eglibc-x86_64-mips, poky-eglibc-x86_64-powerpc

Please note that poky-eglibc-x86_64-arm on Ubuntu doesn't reproduce.


************************************
STEPS TO REPRODUCE (for ARM in Fedora):
1. Download and install the arm toolchain: http://autobuilder.yoctoproject.org/pub/nightly/20120910-5/toolchain/x86_64/poky-eglibc-x86_64-arm-toolchain-gmae-1.2+snapshot-20120911.sh

*************************************
2. source the environment

*************************************
3. Create the following C file:

alex@alex-pc:~/_current$ cat test.c 
#include <stdio.h>
#include <math.h>

double
convert(long long l)
{
   return (double)l;    // or double(l)
}

int
main(int argc, char * argv[])
{
   long long l = 10;
   double f;

   f = convert(l);
   printf("convert: %lld => %f\n", l, f);

   f = 1234.67;
   printf("floorf(%f) = %f\n", f, floorf(f));
   return 0;
}
alex@alex-pc:~/_current$ 


********************************************
4. Compile the following C file:
[alex@alex-v compile]$ ${CC} test.c -o  test -lm
Assembler messages:
Fatal error: invalid -march= option: `armv5te'
[alex@alex-v compile]$


*********************************************
5. Compile in verbose mode:

[alex@alex-v compile]$ ${CC} -v test.c -o  test -lm
Using built-in specs.
COLLECT_GCC=arm-poky-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/lto-wrapper
Target: arm-poky-linux-gnueabi
Configured with: /srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/work-shared/gcc-4.7.1.0+git1+d07e24f4ab59f264d68d21838795349faab5dede-r11/git/configure --build=x86_64-linux --host=x86_64-pokysdk-linux --target=arm-poky-linux-gnueabi --prefix=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr --exec_prefix=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr --bindir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi --sbindir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi --libexecdir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/libexec/armv5te-poky-linux-gnueabi --datadir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/share --sysconfdir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/etc --sharedstatedir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/com --localstatedir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/var --libdir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/lib/armv5te-poky-linux-gnueabi --includedir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/include --oldincludedir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/include --infodir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/share/info --mandir=/opt/poky/1.2+snapshot/sysroots/x86_64-pokysdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-poky-linux-gnueabi- --without-local-prefix --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --with-ppl=no --with-cloog=no --enable-checking=release --enable-cheaders=c_global --with-float=soft --with-gxx-include-dir=/opt/poky/1.2+snapshot/sysroots/armv5te-poky-linux-gnueabi/usr/include/c++ --with-build-time-tools=/srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/sysroots/x86_64-linux/usr/arm-poky-linux-gnueabi/bin --with-sysroot=/opt/poky/1.2+snapshot/sysroots/armv5te-poky-linux-gnueabi --with-build-sysroot=/srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/sysroots/qemuarm --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --with-mpc=/srv/home/pokybuild/yocto-autobuilder/yocto-slave/nightly-arm/build/build/tmp/sysroots/x86_64-nativesdk-pokysdk-linux --enable-nls
Thread model: posix
gcc version 4.7.2 20120706 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='--sysroot=/home/alex/tmp/sdk/sysroots/armv5te-poky-linux-gnueabi' '-march=armv5te' '-marm' '-mthumb-interwork' '-mtune=arm926ej-s' '-v' '-o' 'test' '-mfloat-abi=soft' '-mtls-dialect=gnu'
 /home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../libexec/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/cc1 -quiet -v -iprefix /home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/ -isysroot /home/alex/tmp/sdk/sysroots/armv5te-poky-linux-gnueabi test.c -quiet -dumpbase test.c -march=armv5te -marm -mthumb-interwork -mtune=arm926ej-s -mfloat-abi=soft -mtls-dialect=gnu -auxbase test -version -o /tmp/ccku8YtF.s
GNU C (GCC) version 4.7.2 20120706 (prerelease) (arm-poky-linux-gnueabi)
	compiled by GNU C version 4.7.2 20120706 (prerelease), GMP version 5.0.5, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/../../../../../arm-poky-linux-gnueabi/include"
ignoring duplicate directory "/home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/../../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/include"
ignoring nonexistent directory "/home/alex/tmp/sdk/sysroots/armv5te-poky-linux-gnueabi/usr/local/include"
ignoring duplicate directory "/home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/../../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/include-fixed"
ignoring nonexistent directory "/home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/../../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/../../../../../arm-poky-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/include
 /home/alex/tmp/sdk/sysroots/x86_64-pokysdk-linux/usr/bin/armv5te-poky-linux-gnueabi/../../lib/armv5te-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.7.2/include-fixed
 /home/alex/tmp/sdk/sysroots/armv5te-poky-linux-gnueabi/usr/include
End of search list.
GNU C (GCC) version 4.7.2 20120706 (prerelease) (arm-poky-linux-gnueabi)
	compiled by GNU C version 4.7.2 20120706 (prerelease), GMP version 5.0.5, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c7ae10bb5fd87aa66cb18f1432043778
COLLECT_GCC_OPTIONS='--sysroot=/home/alex/tmp/sdk/sysroots/armv5te-poky-linux-gnueabi' '-march=armv5te' '-marm' '-mthumb-interwork' '-mtune=arm926ej-s' '-v' '-o' 'test' '-mfloat-abi=soft' '-mtls-dialect=gnu'
 as -v -march=armv5te -mthumb-interwork -mfloat-abi=soft -meabi=5 -o /tmp/cc5cqxcM.o /tmp/ccku8YtF.s
GNU assembler version 2.22.52.0.1 (x86_64-redhat-linux) using BFD version version 2.22.52.0.1-10.fc17 20120131
Assembler messages:
Fatal error: invalid -march= option: `armv5te'
[alex@alex-v compile]$


**************************************
OTHER COMMENTS:
As you can see in the verbose output in step 5, the host compiler is used instead of the toolchain compiler:

 as -v -march=armv5te -mthumb-interwork -mfloat-abi=soft -meabi=5 -o /tmp/cc5cqxcM.o /tmp/ccku8YtF.s
GNU assembler version 2.22.52.0.1 (x86_64-redhat-linux) using BFD version version 2.22.52.0.1-10.fc17 20120131
Assembler messages:
Fatal error: invalid -march= option: `armv5te'
[alex@alex-v compile]$
Comment 1 liang li 2012-09-13 02:14:00 UTC
the error not met in my test host (ubuntu 12.04 and fedora 17) with the same toolchain of nightly build 20120910-5.
Comment 2 Alexandru Georgescu 2012-09-13 08:23:21 UTC
(In reply to comment #1)
> the error not met in my test host (ubuntu 12.04 and fedora 17) with the same
> toolchain of nightly build 20120910-5.

That's strange. We managed to reproduce on 4 different machines: Two Fedora 17, one Ubuntu and one Cent OS.

Bogdan, can you try to reproduce in your machine?

Thanks,
Alex.
Comment 3 Richard Purdie 2012-09-13 14:50:02 UTC
This looks like it might be a relocation issue with the toolchain
Comment 4 Radu Moisan 2012-09-20 09:37:38 UTC
(In reply to comment #3)
> This looks like it might be a relocation issue with the toolchain

Confirmed to be a relocation issue. Laurentiu is preparing a patch. Assigning to Laurentiu.
Comment 5 Laurentiu Palcu 2012-09-20 13:55:00 UTC
The symlinks to the toolchain binaries in usr/libexec directory were not relocated. Fixed the issue, patches were sent on the mailing list for review.
Comment 6 Laurentiu Palcu 2012-09-20 14:45:22 UTC
*** Bug 2958 has been marked as a duplicate of this bug. ***
Comment 8 Alexandru Georgescu 2012-10-15 07:20:37 UTC
Verified  on Fedora 17 64bit.
RC4: c9de24d3f4845251b01e2eab0aeeb7472badc5bb