[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Library order in gcc command

From: Arvid Brodin
Subject: Re: Library order in gcc command
Date: Tue, 10 Jul 2007 10:02:26 +0200
User-agent: Thunderbird (X11/20070703)

On 2007-07-09 19:40, Peter O'Gorman wrote:
> On Mon, 2007-07-09 at 14:44 +0200, Arvid Brodin wrote:
>> I am doing a test installation of GTK+ on top of DirectFB (instead of on 
>> X11). (I'm later going to cross compile this for an embedded system.) Now, 
>> GTK+ depends on Cairo, and Cairo in turn is compiled with support for either 
>> X11 or DirectFB as graphics backend. I'm installing everything to a separate 
>> directory (using ./configure --prefix=/home/install_dir), and that is where 
>> the DirectFB version of the Cairo libraries end up (in subdir lib/). I'm 
>> normally running X11 on this system, so an X11 version of the Cairo library 
>> is already installed in /usr/lib64. 
>> libtool is used by make to generate commands for building GTK+. libtool 
>> finds both versions of the Cairo library, but unfortunately it places the 
>> /usr/lib64 one first, and that makes the linker fail with undefined 
>> references. (If I run the command by hand, removing the 
>> /usr/lib64/ reference, the command works fine, but there are many 
>> files to compile/link and I would like a better solution.)
>> This is what is printed by make:
>> /bin/sh ../libtool --mode=link gcc  -DG_DISABLE_DEPRECATED -g -O2 -Wall   -o 
>> gtk-query-immodules-2.0  queryimmodules.o 
>> ../gdk-pixbuf/ ../gdk/ 
>> gcc -DG_DISABLE_DEPRECATED -g -O2 -Wall -o .libs/gtk-query-immodules-2.0 
>> queryimmodules.o  ./.libs/ 
>> -L/home/install_dir/usr/local//lib 
>> /home/install_dir/source/gtk+-2.10.13/gdk/.libs/ 
>> -L/home/install_dir/usr/local/lib 
>> /home/install_dir/usr/local/lib/ 
>> ../gdk-pixbuf/.libs/ ../gdk/.libs/ 
>> /home/install_dir/usr/local//lib/ /usr/lib64/ 
>> /usr/lib64/ /usr/lib64/ /usr/lib64/ 
>> /usr/lib64/ /usr/lib64/ 
>> /home/install_dir/usr/local//lib/ 
>> /home/install_dir/usr/local//lib/ 
>> /home/install_dir/usr/local//lib/ /usr/lib64/ 
>> /usr/lib64/ /usr/lib64/ 
>> /home/install_dir/usr/local//lib/ 
>> /home/install_dir/usr/local//lib/ 
>> /home/install_dir/usr/local//lib/ -lpthread 
>> /usr/lib64/ -lz /home/install
>> r/source/gtk+-2.10.13/gdk-pixbuf/.libs/ 
>> /home/install_dir/usr/local//lib/ -ldl 
>> /home/install_dir/usr/local//lib/ 
>> /home/install_dir/usr/local//lib/ -lm -Wl,--rpath 
>> -Wl,/home/install_dir/usr/local/lib -Wl,--rpath 
>> -Wl,/home/install_dir/usr/local//lib
>> /home/install_dir/source/gtk+-2.10.13/gdk/.libs/ 
>> undefined reference to `cairo_directfb_surface_create'
>> collect2: ld returned 1 exit status
>> I have set LD_LIBRARY_PATH=/home/install_dir/lib - is this where libtool 
>> gets the path to the correct library? And most importantly, how do I get 
>> libtool to place the correct library before the /usr/lib64/ one 
>> so that the link does not fail?
> check /home/install_dir/lib/*.la files for references to /usr/lib64 in
> dependency_libs.
> You may have to edit or remove them. Libtool is not great at building in
> a root like this.
> Peter

Great, that solved my problem!


// Arvid

reply via email to

[Prev in Thread] Current Thread [Next in Thread]