Bug 2347

Summary: libtool library files broken
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Wolfgang Denk <wd>
Component: devtools / tool chainAssignee: Nitin Kamble <nitin.a.kamble>
Status: RESOLVED NOTABUG QA Contact:
Severity: major    
Priority: Undecided CC: agust, jessica.zhang, mark.hatle, meta.mr.watcher, meta.watcher
Version: 1.2   
Target Milestone: ---   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Wolfgang Denk 2012-04-19 10:23:46 UTC
Building autotools based packages on the target and using
core-image-*-sdk as the root file system fails. In the libtool
library files each path in the dependency_libs list is prefixed by
"=". This causes linking issues like:

...
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -Wall \ 
-o libgstcoralpfbsink.la -rpath /usr/local/lib/gstreamer-0.10 -module \
-avoid-version -export-symbols-regex _*\(gst_\|Gst\|GST_\).* \
libgstcoralpfbsink_la-coralpfbsink.lo libgstcoralpfbsink_la-log.lo \
-pthread -lgstbase-0.10 -lgstcontroller-0.10 -lgstreamer-0.10 \
-lgobject-2.0 -lgmodule-2.0 -lxml2 -lgthread-2.0 -lrt -lglib-2.0 \
-lpciaccess
grep: =/usr/lib/libgobject-2.0.la: No such file or directory
/bin/sed: can't read =/usr/lib/libgobject-2.0.la: No such file or directory
libtool: link: `=/usr/lib/libgobject-2.0.la' is not a valid libtool archive
make[2]: *** [libgstcoralpfbsink.la] Error 1
make[2]: Leaving directory `/home/root/gst-coralpfbsink-0.1.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/root/gst-coralpfbsink-0.1.2'
make: *** [all] Error 2


This problem is still present with 1.2_M4.rc4 ; see for example the
latest results of the autobuilder:

$ wget http://autobuilder.yoctoproject.org/pub/nightly/CURRENT/machines/beagleboard/core-image-sato-sdk-beagleboard-20120418183642.rootfs.tar.bz2
$ sudo tar xpf core-image-sato-sdk-beagleboard-20120418183642.rootfs.tar.bz2
$ cd usr/lib
$ grep =/usr *.la | head -10
libacl.la:dependency_libs=' =/usr/lib/libattr.la'
libassuan.la:dependency_libs=' -L=/usr/lib =/usr/lib/libgpg-error.la'
libatk-1.0.la:dependency_libs=' =/usr/lib/libgobject-2.0.la =/usr/lib/libgthread-2.0.la =/usr/lib/libffi.la =/usr/lib/libffi.la =/usr/lib/libgthread-2.0.la =/usr/lib/libglib-2.0.la -lpthread =/usr/lib/libglib-2.0.la -lrt'
libaugeas.la:dependency_libs=' =/usr/lib/libfa.la =/usr/lib/libxml2.la -ldl -lz -lm'
libavahi-client.la:dependency_libs=' =/usr/lib/libdbus-1.la -lpthread -lrt =/usr/lib/libavahi-common.la -ldl'
libavahi-core.la:dependency_libs=' =/usr/lib/libavahi-common.la'
libavahi-glib.la:dependency_libs=' =/usr/lib/libavahi-common.la =/usr/lib/libglib-2.0.la -lrt'
libavahi-gobject.la:dependency_libs=' =/usr/lib/libavahi-client.la =/usr/lib/libdbus-1.la -ldl =/usr/lib/libavahi-glib.la =/usr/lib/libavahi-common.la =/usr/lib/libgobject-2.0.la =/usr/lib/libgthread-2.0.la =/usr/lib/libffi.la =/usr/lib/libffi.la =/usr/lib/libgthread-2.0.la =/usr/lib/libglib-2.0.la -lpthread =/usr/lib/libglib-2.0.la -lrt'
libblkid.la:dependency_libs=' =/usr/lib/libuuid.la'
libcairo-gobject.la:dependency_libs=' =/usr/lib/libcairo.la -L=/usr/lib =/usr/lib/libpixman-1.la =/usr/lib/libfontconfig.la =/usr/lib/libfreetype.la =/usr/lib/libexpat.la =/usr/lib/libexpat.la =/usr/lib/libfreetype.la =/usr/lib/libpng12.la =/usr/lib/libXrender.la =/usr/lib/libX11.la =/usr/lib/libX11.la =/usr/lib/libxcb.la =/usr/lib/libxcb.la =/usr/lib/libXau.la =/usr/lib/libXdmcp.la =/usr/lib/libXau.la =/usr/lib/libXdmcp.la -ldl -lz =/usr/lib/libgobject-2.0.la =/usr/lib/libgthread-2.0.la =/usr/lib/libffi.la =/usr/lib/libffi.la =/usr/lib/libgthread-2.0.la =/usr/lib/libglib-2.0.la -lpthread =/usr/lib/libglib-2.0.la -lrt -lm'


This cannot work.

As a quick-fix one can run the following command on the target:

	# cd /usr/lib
	# for file in `ls *.la`;do sed -i.orig -e "s/=\/usr/\/usr/g" $file;done

But obviously this should be fixed in the build environment.
Comment 1 Mark Hatle 2012-04-19 14:33:32 UTC
The libtool archive files themselves appear to be correct based on your grep.

Something is wrong with the libtool on the target.  The "=" syntax is correct, the target libtool for some reason is not evaluating it.  

Two possibilities come to mind.  The first is you are compiling something on the target that included libtool preinstalled.  If that is the case, you need to run libtoolize --copy --force to ensure that the correct version of libtool is used.

The other option is that libtool on the target only evaluates the "=" syntax when a --sysroot is passed?  If so, it seems like it would be reasonable to set it to "/" if no --sysroot= is set.
Comment 2 Jessica 2012-04-19 22:04:32 UTC
Please look at Mark's comments regarding running libtoolize.  We expect people to use libtool that support sysroot.
Comment 3 Anatolij Gustschin 2012-04-23 20:48:52 UTC
The source package didn't contain libtool preinstalled, but ltmain.sh, so the
generated libtool didn't evaluate this "=" syntax.

Running autoreconf --force --install (which runs 'libtoolize --copy --force' among other things) fixes the issue.

Thanks!