Bug 1833

Summary: binutils: Should not detect locally built libraries when building host tools
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Saul Wold <sgw>
Component: devtools / tool chainAssignee: Nitin Kamble <nitin.a.kamble>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: meta.mr.watcher, meta.watcher
Version: 1.2   
Target Milestone: 1.2 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Saul Wold 2011-12-13 15:01:21 UTC
This problem appears when the Host binutils version and arch matches that of the version we are building. To reproduce this with the bernard (binutils_2.21.bb) and OpenSuSe 11.4 which binutils-2.21-13.1.x86_64.

The problem is when the sysinfo (host tool) is built within bintuils-2.21/build.blah/binutils directory, it gets an LD_LIBRARY_PATH that includes locally built libraries that are not compatible with the host system libraries.

This command will reproduce the problem directly (clearly you need to modify the directories on for your system).

LD_LIBRARY_PATH=/srv/home/swold/bernard/build/tmp/work/x86_64-poky-linux/binutils-2.21-r0/binutils-2.21/build.x86_64-poky-linux.x86_64-poky-linux/./bfd/.libs:/srv/home/swold/bernard/build/tmp/work/x86_64-poky-linux/binutils-2.21-r0/binutils-2.21/build.x86_64-poky-linux.x86_64-poky-linux/./prev-bfd/.libs:/srv/home/swold/bernard/build/tmp/work/x86_64-poky-linux/binutils-2.21-r0/binutils-2.21/build.x86_64-poky-linux.x86_64-poky-linux/./opcodes/.libs:/srv/home/swold/bernard/build/tmp/work/x86_64-poky-linux/binutils-2.21-r0/binutils-2.21/build.x86_64-poky-linux.x86_64-poky-linux/./prev-opcodes/.libs:/srv/home/swold/bernard/build/tmp/sysroots/x86_64-linux/usr/bin/../lib/pseudo/lib:/srv/home/swold/bernard/build/tmp/sysroots/x86_64-linux/usr/bin/../lib/pseudo/lib strace -s 8192 -f -o as_fail.out /usr/bin/as -Qy --64 -o sysinfo.o sysinfo.s

The libbfd-2.21.so and libopcodes-2.21.so are opened from the bfd/.libs and opcodes/.libs local build.

The build.blah/Makefile (which is generated from Makefile.in) has settings for a HOST_LIB_PATH which may not be correct, that a starting point for this bug.
Comment 1 Nitin Kamble 2011-12-13 16:45:26 UTC
Saul, Josh, I wonder why it does not hit non-suse x86-64 hosts. If you know any insight let me know.

Thanks,
Nitin
Comment 2 Nitin Kamble 2011-12-13 16:48:06 UTC
I guess it is coming from the matching binutils version on the host.
Nitin
Comment 3 Saul Wold 2011-12-14 09:40:42 UTC
Correct, on other hosts, the binutils is either an older version or is installed using a different version or extension for example on ubuntu 2.21.53.20110810-0ubuntu5 had a date in the version string and therefore is not a match.
Comment 4 Nitin Kamble 2011-12-20 23:40:59 UTC
more findings:
the problem is wrong LD_LIBRARIES_PATH while running distro gcc.

poky sets : CC_FOR_BUILD = gcc
which is correct, a distro gcc for compiling buildtime tools.

And we have setup LD_LIBRARIES_PATH including build sysroots for do_compile, 

The solution is to not pass our LD_LIBRARIES_PATH while executing distro binaries.

This commit for fixing this issue is mailed to yocto mailing list:

http://git.yoctoproject.org/cgit.cgi/poky-contrib/commit/?h=nitin/bugfix&id=6bd4afcd3f351bb92e2573d487b135c965fce0aa
Comment 5 Nitin Kamble 2011-12-21 17:36:14 UTC
sent a commit to fix this issue to mailing list