Thank you to everyone who jumped in with a reply!  Yes, I can see now that
sysroot and libtool have some problems together.

Sure enough, the problem was in /home/ersin/vorpo/toolchain/usr/lib/
libpng12.la.  Once I changed "libdir='/usr/lib'" to
"libdir='/home/ersin/vorpo/toolchain/usr/lib'" the build linked normally.
But isn't that dangerous?  Here's what the compile line has turned into:

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  /home/ersin/vorpo/toolchain/usr/lib/libpng12.so -ldl
-lpthread   -Wl,--rpath -Wl,/home/ersin/vorpo/toolchain/usr/lib -Wl,--rpath
-Wl,/home/ersin/vorpo/toolchain/usr/lib

Is that setting the rpath to my sysroot, or is the --rpath switch spurious?
If it is setting rpath, is there a way to change libpng12.la so that libtool
gets the right directory but sets a different rpath?  Are there any other
side effects of changing .la files?

Thanks,
Ersin

On Sun, Mar 21, 2010 at 2:56 PM, Daniel Herring <dherr...@tentpost.com>wrote:

> On Sun, 21 Mar 2010, Ersin Akinci wrote:
>
>> 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):
>>
> ...
>
>  DirectFB chokes, however, when it starts to build a certain tool,
>> directfb-csource, that requires libpng.  Here's the relevant
>> part from the build:
>>
>> [er...@basmati 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-lin
>> ux-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-lin
>> ux-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 `f...@glibc_2.0'
>>
> ...
>
>  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
>> [er...@basmati DirectFB-1.4.3]$
>>
>> Something strange is going on here.  Look at the lines after "mkdir .libs"
>> carefully:
>>
>
> It looks like libtool is reading the wrong .la file and changing paths on
> you.  The output of `libtool --version` might be useful.  For proper
> debugging,
>
> # cd /home/ersin/vorpo/build/DirectFB-1.4.3/tools
> # /bin/sh ../libtool --debug --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 >
> libtool-debug.txt
>
> Search this for the first occurrance of /usr/lib/libpng12.so and then look
> backwards for a .la.  Or just grep the /usr/lib/libpng12.la text file. If
> you find this path in an offending .la file, rename that file to .la-bak and
> try recompiling.
>
> These .la files can be absolutely essential in some situations, and a
> complete nightmare in others.
>
> The .la file problem is my first guess.  If its not the issue, then upload
> the libtool-debug.txt file to a paste bin somewhere and submit a link to
> this list.
>
> - Daniel




-- 
What Digital Revolution? -- www.whatdigitalrevolution.com
Thinking critically about digital worlds.
_______________________________________________
http://lists.gnu.org/mailman/listinfo/libtool

Reply via email to