Page 1 of 1

Perlmagick links to wrong libs

Posted: 2009-12-18T07:47:10-07:00
by martink
As said in this thread: viewtopic.php?f=3&t=15175 it seems that the PerlMagick component of ImageMagick 6.5.8-6 links to libs in the build dir:

Code: Select all

martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
ImageMagick 6.5.8-6 2009-12-18 Q16 http://www.imagemagick.org   


*** glibc detected *** perl: free(): invalid next size (fast): 0x0a13aea8 ***
======= Backtrace: =========                                                 
/lib/tls/i686/cmov/libc.so.6[0x1dbff1]                                       
/lib/tls/i686/cmov/libc.so.6[0x1dd6f2]                                       
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x1e079d]                           
/data/wrebuild/source/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs/libMagickCore.so.2(RelinquishMagickMemory+0x22)[0x4d55d2]
/data/wrebuild/source/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs/libMagickCore.so.2(DestroyDrawInfo+0x158)[0x470808]      
/data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so(XS_Image__Magick_Mogrify+0x5e64)[0xd3c094]
perl(Perl_pp_entersub+0x592)[0x80c7772]                                                                                       
perl(Perl_runops_standard+0x13)[0x80c5cc3]                                                                                    
perl(perl_run+0x2bd)[0x80771dd]                                                                                               
perl(main+0xc5)[0x8062905]                                                                                                    
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x187b56]                                                                
perl[0x80627a1]                                                                                                               
======= Memory map: ========                                                                                                  
00110000-00112000 r-xp 00000000 08:01 645911     /lib/tls/i686/cmov/libdl-2.10.1.so                                           
00112000-00113000 r--p 00001000 08:01 645911     /lib/tls/i686/cmov/libdl-2.10.1.so                                           
00113000-00114000 rw-p 00002000 08:01 645911     /lib/tls/i686/cmov/libdl-2.10.1.so                                           
00114000-00147000 r-xp 00000000 08:01 8565       /data/wre/prereqs/lib/libjpeg.so.7.0.0                                       
00147000-00148000 ---p 00033000 08:01 8565       /data/wre/prereqs/lib/libjpeg.so.7.0.0                                       
00148000-00149000 r--p 00033000 08:01 8565       /data/wre/prereqs/lib/libjpeg.so.7.0.0                                       
00149000-0014a000 rw-p 00034000 08:01 8565       /data/wre/prereqs/lib/libjpeg.so.7.0.0                                       
0014a000-00156000 r-xp 00000000 08:01 107420     /usr/lib/libgomp.so.1.0.0                                                    
00156000-00157000 r--p 0000b000 08:01 107420     /usr/lib/libgomp.so.1.0.0                                                    
00157000-00158000 rw-p 0000c000 08:01 107420     /usr/lib/libgomp.so.1.0.0                                                    
00158000-00160000 r-xp 00000000 08:01 12830      /data/wre/prereqs/lib/libltdl.so.7.2.0                                       
00160000-00161000 r--p 00007000 08:01 12830      /data/wre/prereqs/lib/libltdl.so.7.2.0                                       
00161000-00162000 rw-p 00008000 08:01 12830      /data/wre/prereqs/lib/libltdl.so.7.2.0                                       
00162000-00169000 r-xp 00000000 08:01 645924     /lib/tls/i686/cmov/librt-2.10.1.so                                           
00169000-0016a000 r--p 00006000 08:01 645924     /lib/tls/i686/cmov/librt-2.10.1.so                                           
0016a000-0016b000 rw-p 00007000 08:01 645924     /lib/tls/i686/cmov/librt-2.10.1.so                                           
0016b000-0016c000 r-xp 00000000 08:01 543795     /data/wre/prereqs/lib/ImageMagick-6.5.8/modules-Q16/coders/xc.so             
0016c000-0016d000 r--p 00001000 08:01 543795     /data/wre/prereqs/lib/ImageMagick-6.5.8/modules-Q16/coders/xc.so             
0016d000-0016e000 rw-p 00002000 08:01 543795     /data/wre/prereqs/lib/ImageMagick-6.5.8/modules-Q16/coders/xc.so             
00171000-002af000 r-xp 00000000 08:01 645908     /lib/tls/i686/cmov/libc-2.10.1.so                                            
002af000-002b1000 r--p 0013e000 08:01 645908     /lib/tls/i686/cmov/libc-2.10.1.so                                            
002b1000-002b2000 rw-p 00140000 08:01 645908     /lib/tls/i686/cmov/libc-2.10.1.so                                            
002b2000-002b5000 rw-p 00000000 00:00 0                                                                                       
002df000-002e1000 r-xp 00000000 08:01 645927     /lib/tls/i686/cmov/libutil-2.10.1.so                                         
002e1000-002e2000 r--p 00001000 08:01 645927     /lib/tls/i686/cmov/libutil-2.10.1.so                                         
002e2000-002e3000 rw-p 00002000 08:01 645927     /lib/tls/i686/cmov/libutil-2.10.1.so                                         
002e3000-00355000 r-xp 00000000 08:01 11801      /data/wre/prereqs/lib/libfreetype.so.6.3.22                                  
00355000-00359000 r--p 00071000 08:01 11801      /data/wre/prereqs/lib/libfreetype.so.6.3.22                                  
00359000-0035a000 rw-p 00075000 08:01 11801      /data/wre/prereqs/lib/libfreetype.so.6.3.22
003f8000-003f9000 r-xp 00000000 00:00 0          [vdso]
003f9000-00568000 r-xp 00000000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
00568000-00572000 r--p 0016e000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
00572000-00578000 rw-p 00178000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
0079d000-007b2000 r-xp 00000000 08:01 645922     /lib/tls/i686/cmov/libpthread-2.10.1.so
007b2000-007b3000 r--p 00014000 08:01 645922     /lib/tls/i686/cmov/libpthread-2.10.1.so
007b3000-007b4000 rw-p 00015000 08:01 645922     /lib/tls/i686/cmov/libpthread-2.10.1.so
007b4000-007b6000 rw-p 00000000 00:00 0
007d5000-007f1000 r-xp 00000000 08:01 65413      /lib/libgcc_s.so.1
007f1000-007f2000 r--p 0001b000 08:01 65413      /lib/libgcc_s.so.1
007f2000-007f3000 rw-p 0001c000 08:01 65413      /lib/libgcc_s.so.1
008b4000-008c7000 r-xp 00000000 08:01 645914     /lib/tls/i686/cmov/libnsl-2.10.1.so
008c7000-008c8000 r--p 00012000 08:01 645914     /lib/tls/i686/cmov/libnsl-2.10.1.so
008c8000-008c9000 rw-p 00013000 08:01 645914     /lib/tls/i686/cmov/libnsl-2.10.1.so
008c9000-008cb000 rw-p 00000000 00:00 0
008cf000-00921000 r-xp 00000000 08:01 11831      /data/wre/prereqs/lib/libtiff.so.3.8.2
00921000-00923000 r--p 00051000 08:01 11831      /data/wre/prereqs/lib/libtiff.so.3.8.2
00923000-00924000 rw-p 00053000 08:01 11831      /data/wre/prereqs/lib/libtiff.so.3.8.2
00924000-0092d000 r-xp 00000000 08:01 645910     /lib/tls/i686/cmov/libcrypt-2.10.1.so
0092d000-0092e000 r--p 00008000 08:01 645910     /lib/tls/i686/cmov/libcrypt-2.10.1.so
0092e000-0092f000 rw-p 00009000 08:01 645910     /lib/tls/i686/cmov/libcrypt-2.10.1.so
0092f000-00956000 rw-p 00000000 00:00 0
009ff000-00a1a000 r-xp 00000000 08:01 70861      /lib/ld-2.10.1.so
00a1a000-00a1b000 r--p 0001a000 08:01 70861      /lib/ld-2.10.1.so
00a1b000-00a1c000 rw-p 0001b000 08:01 70861      /lib/ld-2.10.1.so
00bf0000-00c20000 r-xp 00000000 08:01 11866      /data/wre/prereqs/lib/liblcms.so.1.0.18
00c20000-00c21000 r--p 0002f000 08:01 11866      /data/wre/prereqs/lib/liblcms.so.1.0.18
00c21000-00c22000 rw-p 00030000 08:01 11866      /data/wre/prereqs/lib/liblcms.so.1.0.18
00c22000-00c24000 rw-p 00000000 00:00 0
00c69000-00c87000 r-xp 00000000 08:01 13224      /data/wre/prereqs/lib/libjpeg.so.62.0.0
00c87000-00c88000 rw-p 0001d000 08:01 13224      /data/wre/prereqs/lib/libjpeg.so.62.0.0
00ca5000-00e34000 r-xp 00000000 08:01 694979     /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00e34000-00e35000 r--p 0018e000 08:01 694979     /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00e35000-00e3f000 rw-p 0018f000 08:01 694979     /data/wre/prereqs/lib/perl5/site_perl/5.10.1/i686-linux/auto/Image/Magick/Magick.so
00e3f000-00e40000 rw-p 00000000 00:00 0
00ebd000-00ed0000 r-xp 00000000 08:01 12909      /data/wre/prereqs/lib/libz.so.1.2.3Aborted
martin@hopla:/data/custom/chartmagick/scripts$
Note these lines:

Code: Select all

/data/wrebuild/source/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs/libMagickCore.so.2(RelinquishMagickMemory+0x22)[0x4d55d2]
/data/wrebuild/source/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs/libMagickCore.so.2(DestroyDrawInfo+0x158)[0x470808]      
and

Code: Select all

003f9000-00568000 r-xp 00000000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
00568000-00572000 r--p 0016e000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
00572000-00578000 rw-p 00178000 08:01 982637     /data/wrebuild/source/ImageMagick-6.5.8-6/magick/.libs/libMagickCore.so.2.0.1
those are still pointing to libraries inside the build dir. This isn't the case in 6.5.7-10.

When I rename the build dir the same program segfault (probably because it cannot find these libs anymore), however convert still keeps working, so my guess is that this problem is PerlMagick related only:

Code: Select all

martin@hopla:/data/custom/chartmagick/scripts$ mv /data/wrebuild/source/ImageMagick-6.5.8-6 /data/wrebuild/source/ImageMagick-6.5.8-6.disable
martin@hopla:/data/custom/chartmagick/scripts$ perl test_dash.pl
Segmentation fault
martin@hopla:/data/custom/chartmagick/scripts$ convert -version
Version: ImageMagick 6.5.8-6 2009-12-18 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

martin@hopla:/data/custom/chartmagick/scripts$
I'm compiling as follows:

Code: Select all

./configure LD=ld --prefix=/data/wre/prereqs --enable-delegate-build LDFLAGS=-L/data/wre/prereqs/lib CPPFLAGS=-I/data/wre/prereqs/include --enable-shared --with-gvc --with-jp2 --with-jpeg --with-png --with-perl --with-lcms --with-tiff --without-x GVC_CFLAGS=-I/data/wre/prereqs/include/graphviz GVC_LIBS="-L/data/wre/prereqs/lib -lgvc -lgraph -lcdt"

make

make install
I compiled 6.5.7-10 in exactly the same way.

Regards,

Martin Kamerbeek
http://www.oqapi.nl

Re: Perlmagick links to wrong libs

Posted: 2009-12-20T04:27:45-07:00
by martink
I found that adding this to ./configure solves this problem for me:

Code: Select all

--with-perl-options="LIBS=-L/data/wre/prereqs/lib"
resulting in:

Code: Select all

./configure LD=ld --prefix=/data/wre/prereqs --enable-delegate-build LDFLAGS=-L/data/wre/prereqs/lib CPPFLAGS=-I/data/wre/prereqs/include --enable-shared --with-gvc --with-jp2 --with-jpeg --with-png --with-perl --with-lcms --with-tiff --without-x GVC_CFLAGS=-I/data/wre/prereqs/include/graphviz GVC_LIBS="-L/data/wre/prereqs/lib -lgvc -lgraph -lcdt" --with-perl-options="LIBS=-L/data/wre/prereqs/lib"

make

make install
Still, I would think that the dir set in LDFLAGS would be passed somehow to the perl Makefile.PL step...

BTW. I just recompiled 6.5.7-10 to be sure, and I found that that perlmagick also links to libs in the build dir. Still I'm pretty convinced that it does link correctly when built on some other system (debian box), so this might be a condition induced on the environment of my laptop (running Kubuntu 9.10).

Any idea on what has been going wrong?

Regards,

Martin Kamerbeek
http://www.oqapi.nl