I'm on macOS 10.14 and I'm trying to install ImagMagick.
I followed the steps described on [https://www.imagemagick.org/script/install-source.php].
I downloaded ImageMagick.tar.gz and could successfully run
$ cd ImageMagick-7.0.8
$ ./configure
However when I ran $ make I got the following error message:
...
CC MagickCore/libMagickCore_7_Q16HDRI_la-property.lo
CC MagickCore/libMagickCore_7_Q16HDRI_la-profile.lo
MagickCore/profile.c:84:12: fatal error: 'libxml/parser.h' file not found
# include <libxml/parser.h>
^~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [MagickCore/libMagickCore_7_Q16HDRI_la-profile.lo] Error 1
make: *** [all] Error 2
Look for libxml-2.0.pc. It is telling ImageMagick the XML delegate library is available with paths to the requisite header files. Apparently the header files are not there. You can try to properly install the XML delegate library on your system or disable XML support with the --without-xml configure script command-line option.
My fix to this issue was to add:
--with-xml=/usr/local/opt/libxml2
to the ./configure command, whereas the dir is my libxml2 root.
It's a shame that the ( ./configure --help ) command does not have anything about the ( --with-xml ) option, I had to look at the source code to figure this out. No need to mess about with the XCODE nor install anything additional.
I hope this helps.
Kind Regards
Heider
When using homebrew, the pkg-config setting fixed to /usr/include.
% head -4 /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
But /usr/include has been lost, Xcode 10 and later.
Heider's idea is so good, and I have three other workarounds.
1) Using xml2-config (apply macOS bundle libxml)
env CFLAGS="$(xml2-config --cflags)" XML_CFLAGS="$(xml2-config --cflags)" XML_LIBS="$(xml2-config --libs)" ./configure
2) Using pkgconfig setting of libxml2 installed with homebrew
env PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig" ./configure
3) Xcode10 can restore /usr/include, not possible with Xcode11
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
(# you can D/L it from https://developer.apple.com/download/more/)
Most helpful comment
My fix to this issue was to add:
--with-xml=/usr/local/opt/libxml2
to the ./configure command, whereas the dir is my libxml2 root.
It's a shame that the ( ./configure --help ) command does not have anything about the ( --with-xml ) option, I had to look at the source code to figure this out. No need to mess about with the XCODE nor install anything additional.
I hope this helps.
Kind Regards
Heider