Hi again,
I made some more checking and I think I found the origin of the problem:
if I rename the /usr/lib/libjpeg.so and friends to hide them, and
rebuild *just the test cases* (ex: darm-account-screen.exe), not
libagar, everything is working properly.
So it looked like the first libjpeg it was findind was not the one I
specified (in $MY_INSTALL_PREFIX/jpeg-8b/lib), but the system one, thus
resulting in a crash. However no prior -I/usr/lib could be found in the
command to explain that behaviour. Indeed agar-config --libs returns:
-L/usr/lib64 -L$MY_INSTALL_PREFIX/agar-1.4.0/lib -lag_gui -lag_core
-L$MY_INSTALL_PREFIX/SDL-1.2.14/lib -lSDL -lpthread
-L$MY_INSTALL_PREFIX/freetype-2.4.3/lib -lfreetype -lz -L/usr/local/lib
-lGL -lm -L$MY_INSTALL_PREFIX/jpeg-8b/lib -ljpeg -L/usr/lib -lpng12
-lrt
The gotcha is:
> ls -l /usr/lib64
lrwxrwxrwx 1 root root 3 2010-01-08 19:53 /usr/lib64 -> lib/
So I believe that -L/usr/lib64 is the culprit, as it introduces /usr/lib
at head of the library paths, which prevents further overloading of the
libraries to be found already there.
Shouldn't, at least for a prefixed install of libagar, -L/usr/lib64 be
removed or at least be put at end rather than begin of the library
search paths?
Best regards,
Olivier Boudeville.
Le 29/03/2011 12:46, Olivier Boudeville a écrit :
Hi Julien,
It depends on which configure we are talking about: I build the Agar
library with --with-jpeg and, as far as I know, everything is alright.
However if for example I then build demos/imageloading, I have (paths
edited for readability):
/usr/bin/cc -D_USE_AGAR_STD
-I$MY_SOURCE_PREFIX/agar-1.4-from-svn/trunk/demos/imageloading
-I$MY_INSTALL_PREFIX/agar-1.4.0/include/agar
-I$MY_INSTALL_PREFIX/SDL-1.2.14/include/SDL -D_GNU_SOURCE=1
-D_REENTRANT -I$MY_INSTALL_PREFIX/freetype-2.4.3/include/freetype2
-I$MY_INSTALL_PREFIX/freetype-2.4.3/include -I/usr/include/libpng12
-I$MY_INSTALL_PREFIX/jpeg-8b/include -o imageloading.o -c imageloading...c
/usr/bin/cc -D_USE_AGAR_STD
-I$MY_SOURCE_PREFIX/agar-1.4-from-svn/trunk/demos/imageloading
-I$MY_INSTALL_PREFIX/agar-1.4.0/include/agar
-I$MY_INSTALL_PREFIX/SDL-1.2.14/include/SDL -D_GNU_SOURCE=1
-D_REENTRANT -I$MY_INSTALL_PREFIX/freetype-2.4.3/include/freetype2
-I$MY_INSTALL_PREFIX/freetype-2.4.3/include -I/usr/include/libpng12
-I$MY_INSTALL_PREFIX/jpeg-8b/include -o imageloading imageloading.o
-L/usr/lib64 -L$MY_INSTALL_PREFIX/agar-1.4.0/lib -lag_gui -lag_core
-L$MY_INSTALL_PREFIX/SDL-1.2.14/lib -lSDL -lpthread
-L$MY_INSTALL_PREFIX/freetype-2.4.3/lib -lfreetype -lz
-L/usr/local/lib -lGL -lm -L$MY_INSTALL_PREFIX/jpeg-8b/lib -ljpeg
-L/usr/lib -lpng12 -lrt
So it looks good. However:
readelf -d imageloading |grep jpeg
0x0000000000000001 (NEEDED) Shared library: [libjpeg.so.62]
62 is the system version, not the user one (which, I believe, is 80):
> ll /usr/lib/libjpeg*
-rw-r--r-- 1 root root 223014 2010-05-09 18:24 /usr/lib/libjpeg.a
-rw-r--r-- 1 root root 941 2010-05-09 18:24 /usr/lib/libjpeg.la
lrwxrwxrwx 1 root root 17 2010-10-31 00:55 /usr/lib/libjpeg.so ->
libjpeg.so.62.0.0
lrwxrwxrwx 1 root root 17 2010-10-31 00:55 /usr/lib/libjpeg.so.62
-> libjpeg.so.62.0.0
-rw-r--r-- 1 root root 146032 2010-05-09 18:24 /usr/lib/libjpeg.so.62.0...0
> ll $MY_INSTALL_PREFIX/jpeg-8b/lib
total 2864
drwxrwxr-x 2 wondersye wondersye 4096 2010-12-04 12:32 ./
drwxrwxr-x 7 wondersye wondersye 4096 2010-12-03 23:04 ../
-rw-r--r-- 1 wondersye wondersye 1933618 2010-12-04 12:32 libjpeg.a
-rwxr-xr-x 1 wondersye wondersye 980 2010-12-04 12:32 libjpeg.la*
lrwxrwxrwx 1 wondersye wondersye 16 2010-12-04 12:32 libjpeg.so
-> libjpeg.so.8.0.2*
lrwxrwxrwx 1 wondersye wondersye 16 2010-12-04 12:32 libjpeg.so.8
-> libjpeg.so.8.0.2*
-rwxr-xr-x 1 wondersye wondersye 980542 2010-12-04 12:32
libjpeg.so.8.0.2*
And the same problem exists with my test case, so I believe
libag_gui.so was actually indeed built against 62 and seems to expect
it, as suggested by:
Compiling darm-account-screen.o
g++ -c darm-account-screen.cc -o darm-account-screen.o
-I$MY_INSTALL_PREFIX/agar-1.4.0/include/agar
-I$MY_INSTALL_PREFIX/SDL-1.2.14/include/SDL -D_GNU_SOURCE=1
-D_REENTRANT -I$MY_INSTALL_PREFIX/freetype-2.4.3/include/freetype2
-I$MY_INSTALL_PREFIX/freetype-2.4.3/include -I/usr/include/libpng12
-I$MY_INSTALL_PREFIX/jpeg-8b/include
Linking darm-account-screen.exe
g++ -o darm-account-screen.exe darm-account-screen.o -L/usr/lib64
-L$MY_INSTALL_PREFIX/agar-1.4.0/lib -lag_gui -lag_core
-L$MY_INSTALL_PREFIX/SDL-1.2.14/lib -lSDL -lpthread
-L$MY_INSTALL_PREFIX/freetype-2.4.3/lib -lfreetype -lz
-L/usr/local/lib -lGL -lm -L$MY_INSTALL_PREFIX/jpeg-8b/lib -ljpeg
-L/usr/lib -lpng12 -lrt
$ readelf -d darm-account-screen.exe|grep jpeg
0x0000000000000001 (NEEDED) Shared library: [libjpeg.so.62]
Regarding agar-config --cflags pointing to Agar's headers and not
headers of "higher-order dependencies" like libjpeg, I agree, but we
can see neverthess SDL, Freetype and libpng headers being mentioned :-) .
Thanks for your help,
Best regards,
Olivier Boudeville.
Le 29/03/2011 12:20, Julien Nadeau a écrit :
Hi Olivier,
Have you tried passing the prefix to your preferred libjpeg to
configure? For example:
./configure --with-jpeg=/usr/local
It is probably best for `agar-config --cflags` not to output the "-I"
for libjpeg, because it is only used internally in gui/load_jpg.c,
and none of the Agar headers need to include<jpeglib.h>.
On Tue, Mar 29, 2011 at 11:43:45AM +0200, Olivier Boudeville wrote:
Hi,
I am using the Agar configure option --with-jpeg (based on latest
Agar's
SVN), pointing to a user-space libjpeg install. It seems appropriately
managed (ex: agar-config --libs points to the right paths), until I run
a Agar-using program which crashed, being unable to load a JPEG.
Despite specifying the right -L/-l pair at build time and using proper
LD_LIBRARY_FLAGS at runtime, as shown with ldd that executable was
linked to the system-level JPEG library, not the user-space one. If
"hiding" the system-level JPEG libraries and rebuilding Agar, ldd tells
the link was then made to the right user-level JPEG, and indeed the
program worked.
Same thing with Agar tests, in 'demos' directory: no matter what I do
(including with LD_LIBRARY_PATH; I suppose rpath is thus being used ;
proper -L/-l are specified there as well), they will be linked to the
wrong libjpeg, unless it is hidden before the build.
Curiously, the problem does not occur for SDL or Freetype.
By the way: agar-config --cflags does not mention the -I for any
user-space JPEG apparently.
Thanks in advance for any hint,
Best regards,
Olivier Boudevillle.
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html