Proper use of libtool under buildroot?

Peter S. Mazinger ps.m at gmx.net
Sun Dec 11 09:05:15 UTC 2005


On Sun, 11 Dec 2005, Marcus Crafter wrote:

> Hi All,
> 
> Hope all is going well.
> 
> I'm wondering how I can drive libtool correctly in the buildroot  
> environment - in particular the creation of .la files that libtool  
> seems to build when linking shared libraries.
> 
> The problem I'm finding relates to buildroot shared library packages  
> that use "configure" scripts. Usually they're "configure"d as if they  
> are to be installed under /usr - when in reality they're installed to  
> buildroot/buid_xxx/staging_dir and then buildroot/build_xxx/root.

in first case prefix has to be correct, and .la will work correctly (You 
are not allowed to for ex.
./configure --prefix=/usr
make install DESTDIR=buildroot/build_xxx/staging_dir

it has to be
./configure --prefix=buildroot/build_xxx/staging_dir

haven't looked buildroot if it does this, I know that uclibc.mk had it 
wrong some time ago

the second case is problematic, because there you have to use
./configure --prefix=/usr and this gets the .la files pointing to 
libdir=/usr/lib.

Some possibilities:
1. remove .la files, if the app is written well, it will be linked 
properly indepedently of .la, if not you may add the libs needed seen in 
the .la files
2. hack libtool to accept some sort of root=
3. build only the minimally needed stuff, then chroot into the dir

warning: similar problem is present w/ pkgconfig

I opt for 3. chroot/finally usable binaries built natively are much 
better then what you ever will get cross-compiled

> This in itself is not a problem, but packages that are actually  
> libraries that use libtool generate .la files that include references  
> to where the libraries exist in the target filesystem (ie. their  
> library name, prefix location and dependencies, etc) so that further  
> calls to libtool to link those libraries with binaries can be done  
> automatically.
> 
> Since the creation of these .la files seems to be occur during the  
> "configure" stage of the build process, it results in the .la files  
> having /usr as the prefix, so when another package that relies on  
> that library is built inside of buildroot - libtool reads the .la  
> file for the dependent library and tries to link everything against  
> the host filesystem (from the /usr prefix) rather than the buildroot  
> environment.
> 
> The only way I've been able to get around this is by "configure"ing  
> dependent packages to live in the staging directory - this fixes  
> the .la file problem as things like the prefix, the -L path, etc,  
> specify the absolute location to the staging directory rather than / 
> usr - but I feel that this is not the "right way" since almost all  
> other packages that come with buildroot don't seem to do this - and  
> I'm now finding other strange issues with libtool and linking shared  
> libraries that I don't think should be happening.
> 
> Anyone having this problem or seen this problem before? What I'm  
> trying to get working is GTK2 under DirectFB which has a whole swag  
> of dependencies that are all built with autoconf/automake/libtool/etc  
> (ie. libatk, fontconfig, cairo, gtk/gdk, and do on) - so I seem to be  
> coming up against this issue over and over again.

If you are trying to get such big apps, you should really go native

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2




More information about the uClibc mailing list