libtool
[Top][All Lists]
Advanced

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

libtool/make and sysroot


From: Ersin Akinci
Subject: libtool/make and sysroot
Date: Sun, 21 Mar 2010 13:29:14 -0400

Hi all,

I've been trying to build DirectFB, and I think that I've narrowed down a bug in the build process to what might be a confusing make or libtool behavior.  I've been cross-compiling using --sysroot for gcc so that everything will link against a custom set of libraries that I've built.  Here's my full configure line (the important part is to note that --sysroot=/home/ersin/vorpo/toolchain):

PKG_CONFIG_LIBDIR=/home/ersin/vorpo/toolchain/usr/lib/pkgconfig F77="i386-linux-gfortran --sysroot=/home/ersin/vorpo/toolchain" FFLAGS="-Os" CCAS="i386-linux-as" CXX="i386-linux-g++ --sysroot=/home/ersin/vorpo/toolchain" CXXFLAGS="-Os" CC="i386-linux-gcc --sysroot=/home/ersin/vorpo/toolchain" CFLAGS="-Os" ./configure --prefix=/usr --host=i386-linux --disable-osx --disable-x11 --disable-debug-support --disable-voodoo --disable-unique --enable-mmx --enable-sse --enable-fbdev --enable-sysfs --enable-jpeg --enable-png --enable-gif --enable-freetype --disable-video4linux --disable-video4linux2 --disable-vnc --disable-sdl --with-gfxdrivers=none --with-inputdrivers=joystick,keyboard,linuxinput,ps2mouse,serialmouse --with-software --without-smooth-scaling --enable-static

DirectFB chokes, however, when it starts to build a certain tool, directfb-csource, that requires libpng.  Here's the relevant part from the build:

address@hidden DirectFB-1.4.3]$ make directfb-csource
make -C tools directfb-csource                      
make[1]: Entering directory `/home/ersin/vorpo/build/DirectFB-1.4.3/tools'
i386-linux-gcc --sysroot=/home/ersin/vorpo/toolchain -DHAVE_CONFIG_H -I. -I.. -I../lib -I../include -I../include -I../lib -I../src -DDATADIR=\"/usr/share/directfb-1.4.3\" -D_REENTRANT  -I/usr/include/freetype2   -O3 -ffast-math -pipe -Os -D_GNU_SOURCE  -Werror-implicit-function-declaration -MT directfb-csource.o -MD -MP -MF .deps/directfb-csource.Tpo -c -o directfb-csource.o directfb-csource.c                                   
mv -f .deps/directfb-csource.Tpo .deps/directfb-csource.Po                                                 
/bin/sh ../libtool --tag=CC   --mode=link i386-linux-gcc --sysroot=/home/ersin/vorpo/toolchain -I/usr/include/freetype2   -O3 -ffast-math -pipe -Os -D_GNU_SOURCE  -Werror-implicit-function-declaration   -o directfb-csource directfb-csource.o -lpng12 -ldl -lpthread                                                           
mkdir .libs                                                                                                
i386-linux-gcc --sysroot=/home/ersin/vorpo/toolchain -I/usr/include/freetype2 -O3 -ffast-math -pipe -Os -D_GNU_SOURCE -Werror-implicit-function-declaration -o directfb-csource directfb-csource.o  /usr/lib/libpng12.so -ldl -lpthread
/home/ersin/vorpo/build/buildroot-2010.02/output/staging/usr/bin-ccache/../lib/gcc/i386-linux-uclibc/4.3.4/../../../../i386-linux-uclibc/bin/ld: warning: libm.so.6, needed by /usr/lib/libpng12.so, not found (try using -rpath or -rpath-link)
/home/ersin/vorpo/build/buildroot-2010.02/output/staging/usr/bin-ccache/../lib/gcc/i386-linux-uclibc/4.3.4/../../../../i386-linux-uclibc/bin/ld: warning: libc.so.6, needed by /usr/lib/libpng12.so, not found (try using -rpath or -rpath-link)
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
/usr/lib/libpng12.so: undefined reference to address@hidden'
collect2: ld returned 1 exit status
make[1]: *** [directfb-csource] Error 1
make[1]: Leaving directory `/home/ersin/vorpo/build/DirectFB-1.4.3/tools'
make: *** [directfb-csource] Error 2
address@hidden DirectFB-1.4.3]$

Something strange is going on here.  Look at the lines after "mkdir .libs" carefully:

i386-linux-gcc --sysroot=/home/ersin/vorpo/toolchain -I/usr/include/freetype2 -O3 -ffast-math -pipe -Os -D_GNU_SOURCE -Werror-implicit-function-declaration -o directfb-csource directfb-csource.o  /usr/lib/libpng12.so -ldl -lpthread
/home/ersin/vorpo/build/buildroot-2010.02/output/staging/usr/bin-ccache/../lib/gcc/i386-linux-uclibc/4.3.4/../../../../i386-linux-uclibc/bin/ld: warning: libm.so.6, needed by /usr/lib/libpng12.so, not found (try using -rpath or -rpath-link)

Here's where my limited knowledge of make starts to hinder me and where I need help.  The build is trying to link explicitly against "/usr/lib/libpng12.so", which is the libpng path on my host machine, when it shouldn't be using an absolute path at all.  I narrowed it down, and that compile line above seems to be related to the following in tools/Makefile:

directfb-csource$(EXEEXT): $(directfb_csource_OBJECTS) $(directfb_csource_DEPENDENCIES)
        @rm -f directfb-csource$(EXEEXT)
        $(LINK) $(directfb_csource_OBJECTS) $(directfb_csource_LDADD) $(LIBS)

$(LINK) expands to:

LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@

which is clearly not gcc, but this line was the only place that I could find the pattern "$(directfb_csource_OBJECTS) $(directfb_csource_LDADD) $(LIBS)", which almost expands to the problematic part of the build ("i386-linux-gcc ............... directfb-csource directfb-csource.o  /usr/lib/libpng12.so -ldl -lpthread"), except for two things:

directfb_csource_LDADD = $(LIBPNG_LIBS)

and

LIBPNG_LIBS = -lpng12

So what seems to be happening is that make runs ../libtool, which happens right before the line where gcc chokes, and somewhere between then and when the build tries to link against my system libraries, direct_csource_LDADD somehow turns from "-lpng12" to "/usr/lib/libpng12.so", and then that pattern gets concatenated to the end of the compile line.  I can override this behavior by adding LIBPNG_LIBS="/home/ersin/vorpo/toolchain/usr/lib/libpng12.so -lpng12" to my configure line, but this is ugly and doesn't work properly anyhow ("/usr/lib/libpng12.so" is still being linked against and the build spits out a warning, but I guess since it finds the proper symbols from "/home/ersin/vorpo/toolchain/usr/lib/libpng12.so" it doesn't complain).  Why do these substitutions occur and how can I stop them?  If I can't stop them, can I somehow add my sysroot directory to the beginning?

Thanks,
Ersin

--
What Digital Revolution? -- www.whatdigitalrevolution.com
Thinking critically about digital worlds.

reply via email to

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