[oe-issues] [Bug 2713] New: broken linking environment
bugzilla-daemon at tinman.treke.net
bugzilla-daemon at tinman.treke.net
Thu Aug 2 13:14:43 CEST 2007
http://bugs.openembedded.org/show_bug.cgi?id=2713
Summary: broken linking environment
Product: Openembedded
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: Build
AssignedTo: openembedded-issues at lists.openembedded.org
ReportedBy: utx at penguin.cz
Current building environment of OE is broken and references to temporary build
paths many times. It causes embedding of temporary paths in many places of the
target system and causes many particular brokennesses.
In particular:
- Incorrect invocation of cross-compiler breaks many applications, libraries
and .la files. New gcc supports --sysroot for clean cross compilation.
- There is no QA tool checking for bad configure guesses directed to temporary
paths.
How to reproduce:
- Find /data/build/koen/OE over Angstrom distribution.
- Run updatedb (/data/build/koen/OE/.../bin/sort not found)
- Look at build hacks e. g. in libtool and pidgin
Fixing should consist of:
1. Remove all CFLAGS, CXXFLAGS, CPPFLAGS, LDFLAGS, --prefix, --*dir
referring to temporary system root or teporary cross tools directory.
Only PKG_CONFIG_PATH (and maybe other similar variables) can be kept,
as it is never populated to the system.
2. Use --sysroot and DESTDIR whenever possible (when defining cross
compiler, cross preprocessor and cross linker).
Especially global setting of cross AS, CC, CXX and LD should include
it.
3. Where it is not possible, use CPATH, C_INCLUDE_PATH,
CPLUS_INCLUDE_PATH, LIBRARY_PATH. These variables are used for
compiler and linker, but they are invisible for higher level tools
and never are embedded to results.
4. Remove libtool patch blocking rpath (libtool-1.5.10) and libdir-la
hack (libtool-1.5.22).
5. Remove all hacks related to previous brokenness (e. g. any occurrence
of OE_LT_RPATH_ALLOW).
6. Add a QA test and force to fail all packages, which contain traces
of any of temporary build directories.
7. Watch carefully configure log. For QA-failing packages, define correct
paths as configure cache environment variable. If it is not possible,
report upstream.
Example: "export ac_cv_path_SORT=/usr/bin/sort" before configure of
findutils
7. Follow effort to improve sysroot support in autoconf checks. An idea
for future (not yet started):
http://idea.opensuse.org/content/ideas/design-and-implement-sysroot-support-for-cross-compilation-environment
Example if idea: Improve AC_PATH_PROG autoconf macro to support
SYSROOT.
Correct way to cross-compile libraries and binaries with a new gcc is really
easy and needs no ugly hacks:
# Set native environment
export
PATH=/OE/build/tmp/staging/x86_64-linux/bin:/OE/build/tmp/cross/bin:$PATH
export
LD_LIBRARY_PATH=/OE/build/tmp/staging/x86_64-linux/lib:/OE/build/tmp/cross/lib
# Compile shared library
arm-angstrom-linux-gnueabi-libtool --mode=compile --tag=CC
arm-angstrom-linux-gnueabi-gcc
--sysroot=/OE/build/tmp/staging/arm-angstrom-linux-gnueabi libtest.c -c -o
libtest.lo
# Link shared library in a non-standard path
arm-angstrom-linux-gnueabi-libtool --mode=link --tag=CC
arm-angstrom-linux-gnueabi-gcc
--sysroot=/OE/build/tmp/staging/arm-angstrom-linux-gnueabi libtest.lo -o
libtest.la -rpath /usr/lib/test
# Compile binary
arm-angstrom-linux-gnueabi-libtool --mode=compile --tag=CC
arm-angstrom-linux-gnueabi-gcc
--sysroot=/OE/build/tmp/staging/arm-angstrom-linux-gnueabi testbin.c -c -o
testbin.o
# Link binary linked with shared library
arm-angstrom-linux-gnueabi-libtool --mode=link --tag=LINK
arm-angstrom-linux-gnueabi-gcc
--sysroot=/OE/build/tmp/staging/arm-angstrom-linux-gnueabi testbin.o -o testbin
libtest.la
# Install
mkdir -p /OE/DESTDIR/usr/lib/test /OE/DESTDIR/usr/bin
arm-angstrom-linux-gnueabi-libtool --mode=install install -c libtest.la
/OE/DESTDIR/usr/lib/test
arm-angstrom-linux-gnueabi-libtool --finish /usr/lib/test
arm-angstrom-linux-gnueabi-libtool --mode=install install -c testbin
/OE/DESTDIR/usr/bin
# QA (strip first to prevent false positives from debugging symbols)
arm-angstrom-linux-gnueabi-strip --strip-unneeded
/OE/DESTDIR/usr/lib/test/*.so.*
arm-angstrom-linux-gnueabi-strip --strip-unneeded /OE/DESTDIR/usr/bin/*
grep -r /OE /OE/DESTDIR
--
Configure bugmail: http://bugs.openembedded.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Openembedded-issues
mailing list