Installing IM from source on OSX

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Installing IM from source on OSX

Post by fmw42 »

This is a repeat of a previous note that I made quite some time ago about how I install IM from source on Mac OSX using delegates installed from MacPorts.

This is my original post:

I first install all my delegate libraries via MacPorts. Then rather than waiting for macports to create a version of IM, I install IM from source code available at http://www.imagemagick.org/download/. I modify the normal install instructions for the ./configure command from http://www.imagemagick.org/download/www ... .html#unix and customize it using certain options from http://www.imagemagick.org/script/advan ... #configure. See also http://www.imagemagick.org/script/advan ... php#macosx

so I do

./configure ....
make
sudo make install

My ./configure command is:

./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/

The first two options in blue are the ones that link IM installed at /user/local/bin to my delegates installed by MacPorts at /opt/local/bin
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Installing IM from source on OSX

Post by fmw42 »

This is my update:

Recently, I tried to install IM on a MacPro OSX El Capitan. The install worked fine as above, except that OpenMP was not enabled.

Apparently, last May (2015), Apple changed their compilers on their OSX releases.

With help from Magick, we were able to make the install work to enable OpenMP. The compilers that are needed are at:

/opt/local/bin/gcc-mp-5
/opt/local/bin/g++-mp-5

I suspect these came with an install of gcc5 from MacPorts, but cannot say for sure. They are not from the Apple OSX install.

So the following is what I used for my ./configure command that worked:

Code: Select all

./configure CC='/opt/local/bin/gcc-mp-5' CXX='/opt/local/bin/g++-mp-5'  \
 CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
  --enable-delegate-build --enable-shared --disable-static \
  --with-modules --with-quantum-depth=16 --enable-hdri --with-gslib \
  --disable-silent-rules --disable-dependency-tracking --with-rsvg \
  --with-gs-font-dir=/opt/local/share/ghostscript/fonts/
Hope this is helpful to anyone else trying to install from source.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Installing IM from source on OSX

Post by fmw42 »

I had the same issue with OSX Sierra on my Mac mini. But to get that to compile IM from source, I had to install the Macports port clang-9 (suggested by Ken Cunningham on the MacPorts mailing list).

The following is my ./configure command that worked.

Code: Select all

./configure CC=/opt/local/bin/clang-mp-3.9 CXX=/opt/local/bin/clang++-mp-3.9 \
CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-openmp --with-quantum-depth=16 \
--enable-delegate-build --enable-shared --disable-static \
--with-modules --without-wmf --with-rsvg --with-lqr  \
--disable-silent-rules --disable-dependency-tracking \
--with-gslib --with-gs-font-dir=/opt/local/share/ghostscript/fonts/
stonesteps
Posts: 5
Joined: 2019-03-31T19:12:05-07:00
Authentication code: 1152

Re: Installing IM from source on OSX

Post by stonesteps »

Mahalo for all the helpful responses.
stonesteps
Posts: 5
Joined: 2019-03-31T19:12:05-07:00
Authentication code: 1152

Re: Installing IM from source on OSX

Post by stonesteps »

Aloha. I followed your advice and install MacPorts and managed to build IM with gcc-mp-5. In order to use --enable-modules I also had to load libtool.

The only problem I seem to still have is that the PNG delegate is not being recognized despite the fact that I installed it with macports. I'll try uninstalling and re-installing.
stonesteps
Posts: 5
Joined: 2019-03-31T19:12:05-07:00
Authentication code: 1152

Re: Installing IM from source on OSX

Post by stonesteps »

Update:
I deleted libpng and re-installed with no improvement. Here's the excerpt from the configure console:

-------------------------------------------------------------
checking for libpng >= 1.0.0... no

Any suggestions welcome.
stonesteps
Posts: 5
Joined: 2019-03-31T19:12:05-07:00
Authentication code: 1152

Re: Installing IM from source on OSX

Post by stonesteps »

Update:

I used MacPorts to install IM 6.9 and then re-ran the IM7 build and it found libpng and added all of the other delegates. So this case is closed although I would still like to know why libpng was not being detected.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Installing IM from source on OSX

Post by fmw42 »

I do not understand your question.

Frist IM 6.9 from MacPorts is not the same as IM 7 and doing it that way may not install all the correct delegated for IM 7. You should use MacPorts to install all needed delegates, then install IM 7 from source.

I do not understand the issue about libpng
Post Reply