php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65752 ImageMagick-6.8.6-10 does not work with imagick
Submitted: 2013-09-24 12:14 UTC Modified: 2013-09-25 08:54 UTC
From: php at kriegt dot es Assigned: mkoppanen (profile)
Status: Closed Package: imagick (PECL)
PHP Version: 5.4.20 OS: Debian 7.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php at kriegt dot es
New email:
PHP Version: OS:

 

 [2013-09-24 12:14 UTC] php at kriegt dot es
Description:
------------
Hi,

I am getting annyoing errors while compiling imagick for PHP 5.4.20.

Getting the error "/usr/lib/libMagickWand-6.Q16.a: could not read symbols: Bad 
value"

The notification:

"/usr/bin/ld: /usr/lib/libMagickWand-6.Q16.a(wand_libMagickWand_6_Q16_la-
deprecate.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used 
when making a shared object; recompile with -fPIC"

is quite annoying since I've added CCFLAGS='-fPIC' before I configured and then 
realized that its already built-in to the latest configure.

Anyway, why is the -fPIC paramter getting ignored or not working for me neither 
on squeeze nor on wheezy.

=====================[ Some informations ]=====================
$ phpize -v
phpize -v
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-
bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-
languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --
enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix --with-gxx-include-
dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --
enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --
enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --
with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --
host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 


Test script:
---------------
cd /tmp
wget "http://pecl.php.net/get/imagick" -O imagick-3.1.1.tar.gz
tar -xzf imagick-3.1.1.tar.gz
cd imagick-3.1.1
phpize
./configure --with-imagick=/usr --with-libdir=/usr/lib --disable-shared PKG_CONFIG_PATH=/usr/lib/pkgconfig --enable--static
make

Expected result:
----------------
Everything works fine

Actual result:
--------------
[...]
libtool: compile:  gcc -fPIC -DMAGICKCORE_HDRI_ENABLE=0 -
DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6 -I/usr/include -I. -
I/tmp/imagick-3.1.1 -DPHP_ATOM_INC -I/tmp/imagick-3.1.1/include -I/tmp/imagick-
3.1.1/main -I/tmp/imagick-3.1.1 -I/usr/include/php5 -I/usr/include/php5/main -
I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -
I/usr/include/php5/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g 
-O2 -c /tmp/imagick-3.1.1/imagickpixeliterator_class.c  -fPIC -DPIC -o 
.libs/imagickpixeliterator_class.o
/bin/bash /tmp/imagick-3.1.1/libtool --mode=compile gcc -fPIC -
DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -
I/usr/include/ImageMagick-6   -I/usr/include -I. -I/tmp/imagick-3.1.1 -
DPHP_ATOM_INC -I/tmp/imagick-3.1.1/include -I/tmp/imagick-3.1.1/main -
I/tmp/imagick-3.1.1 -I/usr/include/php5 -I/usr/include/php5/main -
I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -
I/usr/include/php5/ext/date/lib -I/usr/include/ImageMagick-6  -DHAVE_CONFIG_H  -
g -O2   -c /tmp/imagick-3.1.1/imagick_helpers.c -o imagick_helpers.lo 
libtool: compile:  gcc -fPIC -DMAGICKCORE_HDRI_ENABLE=0 -
DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6 -I/usr/include -I. -
I/tmp/imagick-3.1.1 -DPHP_ATOM_INC -I/tmp/imagick-3.1.1/include -I/tmp/imagick-
3.1.1/main -I/tmp/imagick-3.1.1 -I/usr/include/php5 -I/usr/include/php5/main -
I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -
I/usr/include/php5/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g 
-O2 -c /tmp/imagick-3.1.1/imagick_helpers.c  -fPIC -DPIC -o 
.libs/imagick_helpers.o
/tmp/imagick-3.1.1/imagick_helpers.c: In function 'php_imagick_validate_map':
/tmp/imagick-3.1.1/imagick_helpers.c:153:12: warning: initialization discards 
'const' qualifier from pointer target type [enabled by default]
/bin/bash /tmp/imagick-3.1.1/libtool --mode=compile gcc -fPIC -
DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -
I/usr/include/ImageMagick-6   -I/usr/include -I. -I/tmp/imagick-3.1.1 -
DPHP_ATOM_INC -I/tmp/imagick-3.1.1/include -I/tmp/imagick-3.1.1/main -
I/tmp/imagick-3.1.1 -I/usr/include/php5 -I/usr/include/php5/main -
I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -
I/usr/include/php5/ext/date/lib -I/usr/include/ImageMagick-6  -DHAVE_CONFIG_H  -
g -O2   -c /tmp/imagick-3.1.1/imagick.c -o imagick.lo 
libtool: compile:  gcc -fPIC -DMAGICKCORE_HDRI_ENABLE=0 -
DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/include/ImageMagick-6 -I/usr/include -I. -
I/tmp/imagick-3.1.1 -DPHP_ATOM_INC -I/tmp/imagick-3.1.1/include -I/tmp/imagick-
3.1.1/main -I/tmp/imagick-3.1.1 -I/usr/include/php5 -I/usr/include/php5/main -
I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -
I/usr/include/php5/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g 
-O2 -c /tmp/imagick-3.1.1/imagick.c  -fPIC -DPIC -o .libs/imagick.o
/bin/bash /tmp/imagick-3.1.1/libtool --mode=link gcc -fPIC -DPHP_ATOM_INC -
I/tmp/imagick-3.1.1/include -I/tmp/imagick-3.1.1/main -I/tmp/imagick-3.1.1 -
I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -
I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib 
-I/usr/include/ImageMagick-6  -DHAVE_CONFIG_H  -g -O2   -o imagick.la -export-
dynamic -avoid-version -prefer-pic -module -rpath /tmp/imagick-3.1.1/modules  
imagick_file.lo imagick_class.lo imagickdraw_class.lo imagickpixel_class.lo 
imagickpixeliterator_class.lo imagick_helpers.lo imagick.lo -lMagickWand-6.Q16 -
lMagickCore-6.Q16
libtool: link: gcc -fPIC -shared  -fPIC -DPIC  .libs/imagick_file.o 
.libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o 
.libs/imagickpixeliterator_class.o .libs/imagick_helpers.o .libs/imagick.o   
/usr/lib/libMagickWand-6.Q16.a /usr/lib/libMagickCore-6.Q16.a  -O2   -Wl,-soname 
-Wl,imagick.so -o .libs/imagick.so
/usr/bin/ld: /usr/lib/libMagickWand-6.Q16.a(wand_libMagickWand_6_Q16_la-
deprecate.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used 
when making a shared object; recompile with -fPIC
/usr/lib/libMagickWand-6.Q16.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [imagick.la] Error 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-25 07:19 UTC] mkoppanen@php.net
Is compiling PHP extensions supported as static? As far as I understand your 
error comes from ImageMagick not being compiled with -fPIC and at some point a 
shared object is created which includes the position dependent code from 
libMagickWand-6.Q16.a.

Looking at the compile output imagick.so is still created:

libtool: link: gcc -fPIC -shared  -fPIC -DPIC  .libs/imagick_file.o 
.libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o 
.libs/imagickpixeliterator_class.o .libs/imagick_helpers.o .libs/imagick.o   
/usr/lib/libMagickWand-6.Q16.a /usr/lib/libMagickCore-6.Q16.a  -O2   -Wl,-soname 
-Wl,imagick.so -o .libs/imagick.so
 [2013-09-25 07:20 UTC] mkoppanen@php.net
Shouldn't CCFLAGS be CFLAGS as well?
 [2013-09-25 07:44 UTC] mkoppanen@php.net
-Status: Open +Status: Feedback
 [2013-09-25 08:44 UTC] php at kriegt dot es
-Status: Feedback +Status: Closed
 [2013-09-25 08:44 UTC] php at kriegt dot es
Well, the problem seems to be solved if you configure Imagick-6.8.6-10 without 
"--enable-static --disable-shared". I've added these to the configure of 
Imagick-6.8.6-10 because I want to have all needed libraries in the binary files 
to move them into a chroot (less files tho).

I tried it now without the "--enable-static --disable-shared" parameters and it 
seems to work properly as expected.
So, if anyone reads this bug having the same issue as I had, just remove "--
enable-static --disable-shared" from your configuration.
 [2013-09-25 08:54 UTC] mkoppanen@php.net
-Assigned To: +Assigned To: mkoppanen
 [2013-09-25 08:54 UTC] mkoppanen@php.net
If you compile ImageMagick manually and experience random segfaults that's usually 
caused by missing --disable-omp flag from ImageMagick configure line. Just a hint
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 17:01:31 2024 UTC