[Top][All Lists]

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

Library order in gcc command

From: Arvid Brodin
Subject: Library order in gcc command
Date: Mon, 09 Jul 2007 14:44:44 +0200
User-agent: Thunderbird (X11/20070703)

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 

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/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/ /usr/lib64/ 
/usr/lib64/ /usr/lib64/ 
/home/install_dir/usr/local//lib/ -lpthread /usr/lib64/ 
-lz /home/install_di
/home/install_dir/usr/local//lib/ -ldl 
/home/install_dir/usr/local//lib/ -lm -Wl,--rpath 
-Wl,/home/install_dir/usr/local/lib -Wl,--rpath 
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?

Some system info:
$ uname -a
Linux shuttle 2.6.18-gentoo-r6 #3 Mon Jan 1 16:52:53 CET 2007 x86_64 AMD 
Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux


reply via email to

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