Page 1 of 1

images to pdf - segmentation fault

Posted: 2009-12-28T20:14:51-07:00
by radioboy
I've been trying to convert a series of images to a single pdf file in Linux Mint 8 (x64), using

Code: Select all

convert *.jpg file.pdf
The result is always a segmentation fault. I have tried using jpg and tif images.
The convert version is: ImageMagick 6.5.1-0 2009-08-27 Q16 OpenMP.
I'm using the Ubuntu Karmic repositories, and until now there are no updates available.
I have backports and getdeb repositories activated.

I read in another thread that this could be due to having multiple versions of imagemagick.
I found that, for example, I have in /usr:

Code: Select all

./lib/libMagickWand.so.2
./lib/libMagick++.so.2
./lib/libMagickCore.so.2.0.0
./lib/libMagickCore.so.2
./lib/libMagickWand.so.2.0.0
./lib/libMagick++.so.2.0.0

I don't know if it makes sense, but I tried moving first the .2 versions to a temporary folder and then the .2.0.0 versions (restoring the .2 versions before, of course) but in both cases I get:
convert: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory.

The output of "ldd /usr/bin/convert" is:

Code: Select all

	linux-vdso.so.1 =>  (0x00007fffec9ff000)
	libMagickCore.so.2 => /usr/lib/libMagickCore.so.2 (0x00007f869f058000)
	libMagickWand.so.2 => /usr/lib/libMagickWand.so.2 (0x00007f869ed52000)
	liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00007f869eb1b000)
	libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007f869e8c0000)
	libc.so.6 => /lib/libc.so.6 (0x00007f869e551000)
	libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f869e2cc000)
	libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f869e0a7000)
	libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f869de95000)
	libXt.so.6 => /usr/lib/libXt.so.6 (0x00007f869dc2f000)
	libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f869da1e000)
	libz.so.1 => /lib/libz.so.1 (0x00007f869d807000)
	libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f869d5f9000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007f869d3dd000)
	libltdl.so.7 => /usr/lib/libltdl.so.7 (0x00007f869d1d3000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007f869cfcf000)
	libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f869cdc6000)
	libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f869cbab000)
	libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f869c875000)
	libm.so.6 => /lib/libm.so.6 (0x00007f869c5f1000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f869f47a000)
	libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f869c3ee000)
	librt.so.1 => /lib/librt.so.1 (0x00007f869c1e6000)
	libuuid.so.1 => /lib/libuuid.so.1 (0x00007f869bfe1000)
	libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f869bdc5000)
	libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f869bbc0000)
(But I don't know well what to do with this.)

Using convert -debug annotate *.JPG file.pdf throws again just Segmentation fault.
I was able to do this in Opensuse about a month or two ago.
Could this be also a case of conflicts of library versions? I tried installing the latest version I found (6.5.8-9) from
source and installing, and I get the same segmentation fault. This time, however, I couldn't uninstall the older version since there are too many programs that have Imagemagick as dependency.
By the way, my installed packages as given by dpkg --get-selections | grep magick are:

Code: Select all

imagemagick					install
libmagick++2					install
libmagickcore2					install
libmagickwand2					install
perlmagick					install
Thanks!

Re: images to pdf - segmentation fault

Posted: 2009-12-29T07:41:24-07:00
by magick
We need a stack trace to investigate the problem. Type
  • gdb convert
    run *.jpg file.pdf
    where
Post the result.

Re: images to pdf - segmentation fault

Posted: 2009-12-30T08:52:55-07:00
by radioboy
Thank you very much. Here is the result:

Code: Select all

GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/convert...(no debugging symbols found)...done.
(gdb) run *IMG_833*.JPG file.pdf
Starting program: /usr/bin/convert *IMG_833*.JPG file.pdf
[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a94fa3 in CloneImage () from /usr/lib/libMagickCore.so.2
(gdb) where
#0  0x00007ffff7a94fa3 in CloneImage () from /usr/lib/libMagickCore.so.2
#1  0x00007ffff79f9272 in InjectImageBlob () from /usr/lib/libMagickCore.so.2
#2  0x00007ffff060216a in ?? ()
   from /usr/lib/ImageMagick-6.5.1/modules-Q16/coders/pdf.so
#3  0x00007ffff7a21042 in WriteImage () from /usr/lib/libMagickCore.so.2
#4  0x00007ffff7a217bb in WriteImages () from /usr/lib/libMagickCore.so.2
#5  0x00007ffff76f7c36 in ConvertImageCommand ()
   from /usr/lib/libMagickWand.so.2
#6  0x0000000000400e9b in ?? ()
#7  0x00007ffff6ed4abd in __libc_start_main (main=<value optimized out>, 
    argc=<value optimized out>, ubp_av=<value optimized out>, 
    init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=0x7fffffffe8b8)
    at libc-start.c:220
#8  0x0000000000400cb9 in ?? ()
#9  0x00007fffffffe8b8 in ?? ()
#10 0x000000000000001c in ?? ()
#11 0x0000000000000004 in ?? ()
#12 0x00007fffffffeb5b in ?? ()
#13 0x00007fffffffeb6c in ?? ()
#14 0x00007fffffffeb79 in ?? ()
#15 0x00007fffffffeb86 in ?? ()
#16 0x0000000000000000 in ?? ()
(gdb) 

Re: images to pdf - segmentation fault

Posted: 2009-12-30T10:49:32-07:00
by magick
Lets see if the problem persists in recent releases of ImageMagick. Download the latest ImageMagick release and install:
If that works, the problem may be associated with the ImageMagick 6.5.1 release. Although we downloaded ImageMagick-6.5.1-10.tar.gz and could not reproduce the problem. Conversions from JPEG to PDF worked without complaint.

Another option would be to use a compression method other than the default JPEG. Add +compress to your command line, for example, and your command should complete.

Re: images to pdf - segmentation fault

Posted: 2009-12-30T11:28:57-07:00
by radioboy
Adding the +compress option solved it.

I tried installing the version you suggested, but I still got a segmentation fault.
I couldn't uninstall the previously installed version, though, since doing that would break a very long list of dependencies;
then, I still wonder if that new segmentation fault could be due to multiple library versions.
I run convert again without the "+compress" option with gdb, but I got an empty stack.

So I still prefer to use the old version with "+compress", since it works perfectly.
Thank you very much!