FS#37596 - [imagemagic] 6.8.7.4-1 exists with Illegal Instruction
Attached to Project:
Arch Linux
Opened by Jonathan Pallant (thejpster) - Saturday, 02 November 2013, 08:59 GMT
Last edited by Eric Belanger (Snowman) - Sunday, 03 November 2013, 00:32 GMT
Opened by Jonathan Pallant (thejpster) - Saturday, 02 November 2013, 08:59 GMT
Last edited by Eric Belanger (Snowman) - Sunday, 03 November 2013, 00:32 GMT
|
Details
Description:
$ pacman -S imagemagick resolving dependencies... looking for inter-conflicts... Packages (1): imagemagick-6.8.7.4-1 Total Installed Size: 9.46 MiB :: Proceed with installation? [Y/n] y (1/1) checking keys in keyring [############################################################] 100% (1/1) checking package integrity [############################################################] 100% (1/1) loading package files [############################################################] 100% (1/1) checking for file conflicts [############################################################] 100% (1/1) checking available disk space [############################################################] 100% (1/1) installing imagemagick [############################################################] 100% Optional dependencies for imagemagick ghostscript: for Ghostscript support [installed] openexr: for OpenEXR support libwmf: for WMF support [installed] librsvg: for SVG support [installed] libxml2: for XML support [installed] jasper: for JPEG-2000 support [installed] libpng: for PNG support [installed] libwebp: for WEBP support [installed] $ convert Illegal instruction (core dumped) $ journalctl --since=XXX | tail Nov 02 08:53:31 toshlaptop kernel: traps: convert[19971] trap invalid opcode ip:7f14e958e02a sp:7fff3b9f0aa0 error:0 in libMagickCore-6.Q16HDRI.so.1.0.0[7f14e93eb000+23e000] Nov 02 08:53:31 toshlaptop systemd-coredump[19972]: Process 19971 (convert) dumped core. $ gdb convert GNU gdb (GDB) 7.6.1 ... Reading symbols from /usr/bin/convert...(no debugging symbols found)...done. (gdb) run Starting program: /usr/bin/convert warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000 warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Program received signal SIGILL, Illegal instruction. 0x00007ffff7ad102a in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1 > quit I attempted to unpack the x64 rpm for RHEL5 supplied on the ImageMagick website but it's linked against old versions of many of my libraries (e.g. liblzma.so.0). I compiled Imagemagic 6.8.7-4 from source and that runs OK, so it's a packaging issue? Additional info: $ uname -a Linux toshlaptop 3.11.6-1-ARCH #1 SMP PREEMPT Fri Oct 18 23:22:36 CEST 2013 x86_64 GNU/Linux $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 37 model name : Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz stepping : 2 microcode : 0x8 cpu MHz : 933.000 cache size : 3072 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 11 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat dtherm tpr_shadow vnmi flexpriority ept vpid bogomips : 4257.16 clflush size : 64 cache_alignment : 64 address sizes : 36 bits physical, 48 bits virtual power management: (times 4, it's a hyper-threaded dual-core) On this thread, someone else has the same issue: http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=24353 Steps to reproduce: Install imagemagic 6.8.7.4-1 Run 'convert' |
This task depends upon
Closed by Eric Belanger (Snowman)
Sunday, 03 November 2013, 00:32 GMT
Reason for closing: Fixed
Additional comments about closing: see last comment
Sunday, 03 November 2013, 00:32 GMT
Reason for closing: Fixed
Additional comments about closing: see last comment
$ uname -rms
Linux 3.11.6-1-ARCH x86_64
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz
stepping : 10
microcode : 0xa07
cpu MHz : 1998.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dtherm tpr_shadow vnmi flexpriority
bogomips : 5987.49
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:
[times 2, it’s a dual core]
Intel(R) Core(TM)2 Duo CPU L9300 @ 1.60GHz
Linux 3.11.6-1-ARCH x86_64
Here's a rebuild: https://dev.archlinux.org/~eric/imagemagick-6.8.7.4-1.1-x86_64.pkg.tar.xz
Please try it and let me know if it works. If it doesn't work, tell me how you rebuild the package. Do you use the PKGBUILD from svn/ABS? Do you use a clean chroot? Posting the build log would help too.
But im an arch beginner and not used with packaging just guessing.
toshlaptop /home/jonathan/Downloads :( # pacman -R imagemagick
checking dependencies...
Packages (1): imagemagick-6.8.7.4-1
Total Removed Size: 9.46 MiB
:: Do you want to remove these packages? [Y/n] y
(1/1) removing imagemagick [######################] 100%
toshlaptop /home/jonathan/Downloads # md5sum imagemagick-6.8.7.4-1.1-x86_64.pkg.tar.xz
0eb7e9dfd3042d552db543755d81e64e imagemagick-6.8.7.4-1.1-x86_64.pkg.tar.xz
toshlaptop /home/jonathan/Downloads # pacman -U imagemagick-6.8.7.4-1.1-x86_64.pkg.tar.xz
loading packages...
resolving dependencies...
looking for inter-conflicts...
Packages (1): imagemagick-6.8.7.4-1.1
Total Installed Size: 9.46 MiB
:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
(1/1) installing imagemagick [######################] 100%
Optional dependencies for imagemagick
ghostscript: for Ghostscript support [installed]
openexr: for OpenEXR support
libwmf: for WMF support [installed]
librsvg: for SVG support [installed]
libxml2: for XML support [installed]
jasper: for JPEG-2000 support [installed]
libpng: for PNG support [installed]
libwebp: for WEBP support [installed]
toshlaptop /home/jonathan/Downloads # /usr/bin/convert
Illegal instruction (core dumped)
toshlaptop /home/jonathan/Downloads :( # gdb /usr/bin/convert
GNU gdb (GDB) 7.6.1
Copyright (C) 2013 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-unknown-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
Starting program: /usr/bin/convert
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x00007ffff7ad102a in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
(gdb) quit
I built a copy that worked by just pulling the tarball from upstream and ./configure && make -j4 && (I didn't install it, just ran ./utilities/convert)
Edit: That's High Dynamic Range Image support. I recompiled my copy with --enable-hdri, my library is now called libMagickCore-6.Q16HDRI.so.1.0.0 and it still works fine.
Edit2: I just built 6.8.7.2-1 from /var/abs with makepkg -s and it also works fine. I can't find the 6.8.7.4 PKGBUILD in /var/abs. Must take a while to come through.
Alternative steps to reproduce the segfault:
curl -O http://fc01.deviantart.net/fs71/f/2010/318/3/5/portal_ascii_icon___button_by_lightmystic-d32udqx.png
convert portal_ascii_icon___button_by_lightmystic-d32udqx.png test.png
Backtrace with gdb (not compiled with debug symbols):
(gdb) r
Starting program: /bin/convert
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0x00007ffff7ad102a in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
(gdb) bt
#0 0x00007ffff7ad102a in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#1 0x00007ffff7ad13f5 in StartTimer () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#2 0x00007ffff7a4efbc in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#3 0x00007ffff7a4f4b1 in ?? () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#4 0x00007ffff7a4f78d in LogComponentGenesis () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#5 0x00007ffff7a52b12 in MagickCoreGenesis () from /usr/lib/libMagickCore-6.Q16HDRI.so.1
#6 0x000000000040087e in ?? ()
#7 0x00007ffff7069bc5 in __libc_start_main () from /usr/lib/libc.so.6
#8 0x00000000004008fd in ?? ()
(gdb)
I'm going to go out on a limb and blame the addition of the file m4/ax_cc_maxopt.m4 in this new version. It automagically selects CFLAGS for you, explaining why for some people the Arch built package is OK and for some it isn't, and why if I build my own it's all good.
export CFLAGS="$CFLAGS -O0 -fbuiltin -g"
export CXXFLAGS="$CXXFLAGS -O0 -fbuiltin -g"
Was just about to debug with gdb, but now it works fine.
Being a CFLAGS issue sounds plausible.
CFLAGS = -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -pthread -fopenmp -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
6.8.7-4 CFLAGS
CFLAGS = -I/usr/include/lqr-1 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -pthread -fopenmp -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -march=corei7 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16
Note the addition of -march=corei7. I think we have a winner.
Edit: I can't read M4. Can someone look at m4/ax_gcc_archflag.m4 and tell me if they've turned on arch-specific optimisations by default in this version? The diff is:
jonathan@toshlaptop ~/abs/imagemagick-new/src/ImageMagick-6.8.7-4/m4 $ diff ./ax_gcc_archflag.m4 ~/abs/imagemagick-old/src/ImageMagick-6.8.7-2/m4/ax_gcc_archflag.m4
74c74
< ax_gcc_arch=$withval, ax_gcc_arch=yes)
---
> ax_gcc_arch=$withval, ax_gcc_arch=no)
It was automatically adding a -march=corei7-avx to the CFLAGS which explains why it was working for me and not for people with a different CPU. I fixed it with the --with-gcc-arch configure option.
Thanks for your help in debugging this.