Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 266319

Summary: `gen_usr_ldscript -a` seems to break sysroot linkage
Product: Gentoo Linux Reporter: Maksim 'max_posedon' Melnikau <maxposedon>
Component: [OLD] LibraryAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED DUPLICATE    
Severity: normal CC: embedded, OdinsHorse
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: libusb-0.1.12-r5.ebuild patch

Description Maksim 'max_posedon' Melnikau 2009-04-16 00:05:23 UTC
if $ROOT/lib/lib<name>.so is missing, and you trying fix bug #4411, gcc will never links correct (during cross compilation). 

$ROOT/lib/lib<name>.so files really important for working -lusr (with "LDFLAGS=-L$ROOT/lib -L$ROOT/usr/lib")

vaiper, so you try change "classic" way of fixint it in libusb-0.1.12-r5.build broke hal cross compliation for example


Reproducible: Always

Steps to Reproduce:
1. emerge-cross... libusb
2. emerge-cross... hal

Actual Results:  
compilation fails

Expected Results:  
compilation shouldn't fail
Comment 1 Maksim 'max_posedon' Melnikau 2009-04-16 00:06:57 UTC
Created attachment 188512 [details, diff]
libusb-0.1.12-r5.ebuild patch

sample for patch which one should apply for fix it (old fation way)
Comment 2 Maksim 'max_posedon' Melnikau 2009-04-16 00:16:05 UTC
may be report isn't clear, one more explanation:

missing $ROOT/lib/lib<name>.so is bad
because any program that links using -lusb
will find $ROOT/usr/lib/lib<name>.so
with GROUP ( /lib/libusb.so )
fail here

even -L$ROOT/lib can't helps, because lib<name>.so just missing
ok, I'll try add few comments with explanation)

IF $ROOT/lib/lib<name>.so is present
-lusb -L$ROOT/lib<name>.so find $ROOT/lib/lib<name>.so (before! $ROOT/usr/lib/lib<name>.so) and compilation will be successful
Comment 3 solar (RETIRED) gentoo-dev 2009-04-16 16:32:43 UTC
vapier needs to look at this bug. The problem here is multi-fold.
Comment 4 solar (RETIRED) gentoo-dev 2009-04-16 18:22:02 UTC
erp did not mean to close this bug.
Comment 5 Sven 'sleipnir' Rebhan 2009-04-16 20:49:53 UTC
The error goes back to the change from the manual creation of usr/lib/libusb.so using "gen_usr_ld libusb" to the automatic creation using "gen_usr_ld -a usb". There are two major changes, at least one affecting cross-compilation:

1. usr/lib/libusb.so now contains GROUP (/lib/libusb-0.1.so.4) instead of (/lib/libusb.so) due to the use of tlib in the toolchain-func.eclass.

2. (and this one affects cross-compilation) the automatic section of gen_usr_ld in the toolchain-func.eclass contains the line "rm -f "${D}"/${libdir}/${lib}" which makes it impossible to hack around libusb via LDFLAGS="-L${ROOT}/lib"
Comment 6 Sven 'sleipnir' Rebhan 2009-04-16 22:31:56 UTC
Just another heads-up:
Without the fix and without having libusb installed to the buildhost you get:

/usr/libexec/gcc/armv4tl-softfloat-linux-gnueabi/ld: cannot find /lib/libusb-0.1.so.4

However, if we change 

GROUP ( /lib/libusb-0.1.so.4 )  in $ROOT/usr/lib/libusb.so
to
GROUP ( =/lib/libusb-0.1.so.4 ) in $ROOT/usr/lib/libusb.so

e.g. hal compiles fine against the otherwise same version of libusb. From the ld manpage on --library-path=searchdir:
    If  searchdir  begins with "=", then the "=" will be replaced by the
    sysroot prefix, a path specified when the linker is configured.

Maybe we can use this to kill bug 4411 once and forever also for us cross-compile guys.
Comment 7 SpanKY gentoo-dev 2009-04-18 17:19:33 UTC
too many wrong/incorrect statements here ... but whatever, i'll look into it
Comment 8 SpanKY gentoo-dev 2009-07-05 19:57:51 UTC
gen_usr_ldscript is correct

*** This bug has been marked as a duplicate of bug 275666 ***