Re: libtool/make and sysroot

2010-03-21 Thread Ralf Wildenhues
Hello Ersin,

thanks for providing a nice and detailed analysis!

* Ersin Akinci wrote on Sun, Mar 21, 2010 at 06:29:14PM CET:
 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.

libtool doesn't really cope well with --sysroot yet, sorry you had to
learn the hard way.  You can probably work around it by temporarily
moving /usr/lib/libpng12.la out of the way, if that file exists.
If it doesn't exist, then another workaround to try is to add
  -L/home/ersin/vorpo/toolchain/usr/lib

to LDFLAGS at some point, but of course that means that installed .la
files will have wrong paths in them, and possibly installed programs and
libraries could have a wrong run path embedded in them.

Hope that helps.

Cheers,
Ralf


___
http://lists.gnu.org/mailman/listinfo/libtool


Re: libtool/make and sysroot

2010-03-21 Thread Bob Friesenhahn

On Sun, 21 Mar 2010, Ersin Akinci wrote:


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):


It seems that the problem is that libtool does not support --sysroot. 
Libtool searches for libpng12.so using the normal compiler search 
path.  But first it will search for a libpng12.la file and use the 
library information it finds there.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/___
http://lists.gnu.org/mailman/listinfo/libtool


Re: libtool/make and sysroot

2010-03-21 Thread Daniel Herring

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___
http://lists.gnu.org/mailman/listinfo/libtool


Re: libtool/make and sysroot

2010-03-21 Thread Ersin Akinci
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.comwrote:

 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