Troubles installing MagickWand for PHP
Posted: 2013-01-21T20:35:29-07:00
Hello,
I was giving MagickWand for PHP a spin after a long break and encountered three build related issues. In my environment ImageMagick is installed into /opt/imagemagick/6.8.1-9. The first issue I encountered is during MagickWand-config:
This is caused by PKG_CONFIG_PATH not being set for the custom install location.
Second issue I encountered is:
This is due to $CPPFLAGS not being added to build properly.
Third issue was:
This is because config.m4 contains:
and the libraries are actually:
The following patch should address these issues:
ldd output after the patch:
I was giving MagickWand for PHP a spin after a long break and encountered three build related issues. In my environment ImageMagick is installed into /opt/imagemagick/6.8.1-9. The first issue I encountered is during MagickWand-config:
Code: Select all
checking MagickWand-config --cppflags... Package MagickWand was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickWand.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickWand' found
checking MagickWand-config --libs... Package MagickWand was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickWand.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickWand' found
Second issue I encountered is:
Code: Select all
/opt/imagemagick/6.8.1-9/include/ImageMagick/magick/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
/opt/imagemagick/6.8.1-9/include/ImageMagick/magick/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile"
/opt/imagemagick/6.8.1-9/include/ImageMagick/magick/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
/opt/imagemagick/6.8.1-9/include/ImageMagick/magick/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile"
Third issue was:
Code: Select all
/usr/bin/ld: cannot find -lMagickWand
collect2: ld returned 1 exit status
make: *** [magickwand.la] Error 1
Code: Select all
PHP_ADD_LIBRARY_WITH_PATH(MagickCore, $WAND_DIR/lib, MAGICKWAND_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(MagickWand, $WAND_DIR/lib, MAGICKWAND_SHARED_LIBADD)
Code: Select all
# ls -l /opt/imagemagick/6.8.1-9/lib
total 44892
drwxr-xr-x 3 root root 4096 Jan 18 03:12 ImageMagick-6.8.1
-rw-r--r-- 1 root root 21230706 Jan 20 20:53 libMagickCore-Q16.a
-rwxr-xr-x 1 root root 1508 Jan 20 20:53 libMagickCore-Q16.la
lrwxrwxrwx 1 root root 26 Jan 20 20:53 libMagickCore-Q16.so -> libMagickCore-Q16.so.7.0.0
lrwxrwxrwx 1 root root 26 Jan 20 20:53 libMagickCore-Q16.so.7 -> libMagickCore-Q16.so.7.0.0
-rwxr-xr-x 1 root root 10884369 Jan 20 20:53 libMagickCore-Q16.so.7.0.0
-rw-r--r-- 1 root root 4699308 Jan 20 20:53 libMagick++-Q16.a
-rwxr-xr-x 1 root root 1580 Jan 20 20:53 libMagick++-Q16.la
lrwxrwxrwx 1 root root 24 Jan 20 20:53 libMagick++-Q16.so -> libMagick++-Q16.so.7.0.0
lrwxrwxrwx 1 root root 24 Jan 20 20:53 libMagick++-Q16.so.7 -> libMagick++-Q16.so.7.0.0
-rwxr-xr-x 1 root root 2258146 Jan 20 20:53 libMagick++-Q16.so.7.0.0
-rw-r--r-- 1 root root 4378464 Jan 20 20:53 libMagickWand-Q16.a
-rwxr-xr-x 1 root root 1558 Jan 20 20:53 libMagickWand-Q16.la
lrwxrwxrwx 1 root root 26 Jan 20 20:53 libMagickWand-Q16.so -> libMagickWand-Q16.so.7.0.0
lrwxrwxrwx 1 root root 26 Jan 20 20:53 libMagickWand-Q16.so.7 -> libMagickWand-Q16.so.7.0.0
-rwxr-xr-x 1 root root 2406739 Jan 20 20:53 libMagickWand-Q16.so.7.0.0
drwxr-xr-x 2 root root 4096 Jan 20 20:53 pkgconfig
Code: Select all
Index: config.m4
===================================================================
--- config.m4 (revision 10695)
+++ config.m4 (working copy)
@@ -62,9 +62,10 @@
fi
AC_DEFINE(HAVE_MAGICKWAND,1,[ ])
+
+ export ORIG_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+ export PKG_CONFIG_PATH="`$WAND_CONFIG_PATH/MagickWand-config --prefix`/lib/pkgconfig/"
- PHP_ADD_LIBRARY_WITH_PATH(MagickCore, $WAND_DIR/lib, MAGICKWAND_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(MagickWand, $WAND_DIR/lib, MAGICKWAND_SHARED_LIBADD)
PHP_ADD_INCLUDE($WAND_DIR/include/ImageMagick)
AC_MSG_CHECKING(MagickWand-config --cppflags)
WAND_CPPFLAGS="`$WAND_CONFIG_PATH/MagickWand-config --cppflags`"
@@ -75,8 +76,10 @@
WAND_LIBS="`$WAND_CONFIG_PATH/MagickWand-config --libs`"
AC_MSG_RESULT($WAND_LIBS)
PHP_EVAL_LIBLINE($WAND_LIBS, MAGICKWAND_SHARED_LIBADD)
+
+ export PKG_CONFIG_PATH="$ORIG_PKG_CONFIG_PATH"
PHP_SUBST(MAGICKWAND_SHARED_LIBADD)
- PHP_NEW_EXTENSION(magickwand, magickwand.c, $ext_shared)
+ PHP_NEW_EXTENSION(magickwand, magickwand.c, $ext_shared,,$WAND_CPPFLAGS)
fi
Index: ChangeLog
===================================================================
--- ChangeLog (revision 10695)
+++ ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2013-01-22 1.0.9-2 Mikko Koppanen <mikko.koppanen@gmail...>
+ * Fixes build with newer ImageMagick
+ * Fixes build when ImageMagick is installed in non-standard location
+
2012-10-25 1.0.9-1 Cristy <omicronpersei8@image...>
* Add support for MagickSetImageEndian().
Code: Select all
ldd modules/magickwand.so
linux-vdso.so.1 => (0x00007fffcbfff000)
libMagickWand-Q16.so.7 => /opt/imagemagick/6.8.1-9/lib/libMagickWand-Q16.so.7 (0x00007f5ce8d42000)
libm.so.6 => /lib/libm.so.6 (0x00007f5ce8ab9000)
libMagickCore-Q16.so.7 => /opt/imagemagick/6.8.1-9/lib/libMagickCore-Q16.so.7 (0x00007f5ce8446000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f5ce822a000)
libc.so.6 => /lib/libc.so.6 (0x00007f5ce7ec8000)
liblcms.so.1 => /usr/lib/liblcms.so.1 (0x00007f5ce7c8f000)
libtiff.so.4 => /usr/lib/libtiff.so.4 (0x00007f5ce7a2c000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f5ce77a4000)
libjasper.so.1 => /usr/lib/libjasper.so.1 (0x00007f5ce754a000)
liblqr-1.so.0 => /usr/lib/liblqr-1.so.0 (0x00007f5ce7338000)
libpng12.so.0 => /lib/libpng12.so.0 (0x00007f5ce7112000)
libdjvulibre.so.21 => /usr/lib/libdjvulibre.so.21 (0x00007f5ce6d74000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x00007f5ce6b51000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007f5ce691c000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f5ce6709000)
libXt.so.6 => /usr/lib/libXt.so.6 (0x00007f5ce64a5000)
libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f5ce6295000)
libIlmImf.so.6 => /usr/lib/libIlmImf.so.6 (0x00007f5ce5fd2000)
libImath.so.6 => /usr/lib/libImath.so.6 (0x00007f5ce5dcd000)
libHalf.so.6 => /usr/lib/libHalf.so.6 (0x00007f5ce5b8b000)
libIex.so.6 => /usr/lib/libIex.so.6 (0x00007f5ce596c000)
libIlmThread.so.6 => /usr/lib/libIlmThread.so.6 (0x00007f5ce5765000)
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x00007f5ce5559000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x00007f5ce530c000)
libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007f5ce508f000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007f5ce4e48000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007f5ce4c44000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x00007f5ce4a40000)
librt.so.1 => /lib/librt.so.1 (0x00007f5ce4838000)
libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00007f5ce455b000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f5ce420a000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f5ce3ff3000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x00007f5ce3dea000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x00007f5ce3bcf000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f5ce3894000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5ce92d1000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f5ce357f000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f5ce3368000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f5ce3140000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x00007f5ce2f16000)
libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007f5ce2cbd000)
libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0x00007f5ce2aba000)
libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007f5ce28b2000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f5ce2695000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x00007f5ce248b000)
libpcre.so.3 => /lib/libpcre.so.3 (0x00007f5ce225b000)
libdl.so.2 => /lib/libdl.so.2 (0x00007f5ce2056000)
libuuid.so.1 => /lib/libuuid.so.1 (0x00007f5ce1e52000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f5ce1c4e000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f5ce1a49000)