This question was already asked, 4 years ago, so the High Sierra/Mojave part are new. Here is the link to the unanswered question: compile static version of imagemagick convert util
I am trying to compile portable version of IM that I can include with a script that could be used on other MacOS machines, without the need for developer tools or Mac Ports to first be installed on the machine. I see that ImageMagick.org provide static and portable builds for Windows, but only provide a precompiled binary for OS X/Darwin.
When I try to run the precompiled version on a Mac with a fresh install of Mojave I get the following:
dyld: Library not loaded: /ImageMagick-7.0.8/lib/libMagickCore-7.Q16HDRI.6.dylib
Referenced from: /Users/chrisnorman/Desktop/ImageMagick-7.0.8/bin/./magick
Reason: image not found
When I run otool (which required that I install the command line developer tools) against the precompiled binary ot magick I get the following:
otool -L magick
magick:
/ImageMagick-7.0.8/lib/libMagickCore-7.Q16HDRI.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/ImageMagick-7.0.8/lib/libMagickWand-7.Q16HDRI.6.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
which is a shorter list than I had gotten when I was trying to use a binary that I had compiled on another Mac and run on the fresh install of Mojave Mac.
I would just like some guidance on how to compile a version similar to the portable version of IM that they have precompiled for Windows on the ImageMagick downloads page. Something I can just throw on any Mac and run it without needing to worry about if a bunch of dynamic libraries are already installed on the machine.
Here is my current installation script for trying to build IM on a Mac that already has Xcode on it:
#!/bin/bash
set -e
IMBUILD=/tmp/imbuild/
mkdir -p $IMBUILD/bin
# get IM (Version 7 at the moment)
mkdir im_download && cd im_download
curl -O http://www.imagemagick.org/download/ImageMagick.tar.gz
for file in *.gz ; do tar zxf $file; done
rm *.tar.gz
cd ImageM*
# get delegates
# jpeg
echo ">>>>>>>>>>>>>> JPEG"
curl -O http://www.imagemagick.org/download/delegates/jpegsrc.v9b.tar.gz
tar zxf jpeg*.gz && rm jpeg*.gz && mv jpeg* jpeg && cd jpeg
./configure --disable-shared --disable-dependency-tracking
make
cd ..
# png
echo ">>>>>>>>>>>>>> PNG"
curl -O http://www.imagemagick.org/download/delegates/libpng-1.6.31.tar.gz
tar zxf libpng*.gz && rm libpng*.gz && mv libpng* png && cd png
./configure --disable-shared --disable-dependency-tracking
make
cd ..
# lcms
echo ">>>>>>>>>>>>>> LCMS"
curl -O http://www.imagemagick.org/download/delegates/lcms2-2.8.tar.gz
tar zxf lcms2*.gz && rm lcms2*.gz && mv lcms2* lcms && cd lcms
./configure --disable-shared --disable-dependency-tracking
make
cd ..
# tiff
echo ">>>>>>>>>>>>>> TIFF"
curl -O http://www.imagemagick.org/download/delegates/tiff-4.0.8.tar.gz
tar zxf tiff*.gz && rm tiff*.gz && mv tiff* tiff && cd tiff
./configure --disable-shared --disable-dependency-tracking
make
cd ..
#build imagemagick (YMMV)
echo ">>>>>>>>>>>>>> IMAGEMAGICK"
./configure --disable-shared \
--disable-dependency-tracking \
--disable-shared \
--enable-osx-universal-build \
--enable-delegate-build \
--enable-static \
--disable-installed \
--without-frozenpaths \
--prefix=$IMBUILD \
--with-openexr=no \
--disable-docs \
--with-lcms=yes \
--without-x \
--without-webp \
--without-modules \
--with-zero-configuration \
--with-jpeg \
--without-pango \
--enable-hdri=no \
--without-gvc \
--with-raw
make install
ls $IMBUILD/bin
The configuration above is what I am going for, so what I need most are JPEG, TIFF and LCMS.
So any pointers or tips on what I need to add to this script to get a truly portable version of IM would be fantastic!