Stand alone executables for Mac

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?".
kamalsofteng

Stand alone executables for Mac

Postby kamalsofteng » 2009-02-16T12:23:20-07:00

I am trying to redistribute the convert tool and so, need a stand alone that can run without installation. I built the source for windows and was able to get the convert.exe to run without installing anything on the machine. That way, I can just package the exe file to the target machine.
Now my problems is for Mac as I can't get anything done. I tried the binary versions and it seems they are a few KB files and obviously need installtion. A colleague of mine(a linux user) tried to complile it from soruce adn I gave him the directions found on the ImageMagick site and further to the palce for advacne options, we still can not get ti to work. The last thing we arrived is getting a binary file that runs without installation but it can not read or write jpeg files and tells us that it can not find delegate.

Anyone has tried to get these for Mac? Any ideas appreciated.
Kamal

User avatar
fmw42
Posts: 15278
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Stand alone executables for Mac

Postby fmw42 » 2009-02-16T12:34:35-07:00

kamalsofteng wrote:I am trying to redistribute the convert tool and so, need a stand alone that can run without installation. I built the source for windows and was able to get the convert.exe to run without installing anything on the machine. That way, I can just package the exe file to the target machine.
Now my problems is for Mac as I can't get anything done. I tried the binary versions and it seems they are a few KB files and obviously need installtion. A colleague of mine(a linux user) tried to complile it from soruce adn I gave him the directions found on the ImageMagick site and further to the palce for advacne options, we still can not get ti to work. The last thing we arrived is getting a binary file that runs without installation but it can not read or write jpeg files and tells us that it can not find delegate.

Anyone has tried to get these for Mac? Any ideas appreciated.
Kamal



When installing from source, you need to also install all the relevant image delegate libraries before installing IM.

see http://www.imagemagick.org/download/delegates/

You can tell what delegates are installed by

convert -list configure

And looking at the line that starts with DELEGATES

On my system, I install from source (Mac OSX Tiger), but have installed previously a number of delegates to get jpg, tiff, png etc.

DELEGATES bzlib fontconfig freetype gs jpeg jp2 lcms lqr openexr png tiff x11 xml zlib


Sorry, I cannot help with a stand alone version, though. You will need to get a response from the IM folks on that.

User avatar
magick
Site Admin
Posts: 9741
Joined: 2003-05-31T11:32:55-07:00
Contact:

Re: Stand alone executables for Mac

Postby magick » 2009-02-16T12:38:17-07:00

For a portable Mac OS X installation of ImageMagick, follow these steps. You probably want to build everything static so unpack your delegate libraries in the ImageMagick folder. We'll use JPEG as an example. Unpack JPEG delegate library and move it to ImageMagick-6.4.9-4/jpeg. Now build the JPEG delegate library statically with

    ./configure --disable-shared
    make

Next, move to the ImageMagick top level folder and type

    ./configure --enable-delegate-build --disable-shared --prefix=/ImageMagick-6.4.9-4

your prefix can be any directory. You may want to add --enable-osx-universal-binary to build a universal binary. Now build and install:

    make
    make install

In our example you will find everything you need in /ImageMagick-6.4.9-4. As an added step you may want to move everything in the /ImageMagick-6.4.9-4 installation folder to the top level. If you do, you can avoid setting environment variables such as MAGICK_HOME.

kamalsofteng

Re: Stand alone executables for Mac

Postby kamalsofteng » 2009-02-17T08:39:26-07:00

Thank you so much. I gave the tip to my colleague and he said it made a lot of sense. Apparently, he had forgotten to static-build the jpeg delegate the other time because he got a static build and it was working, just not with jpeg :( However, when you talk about unpacking jpeg delegate, do you mean a separate download? Becaue I can see a folder in the source I downloaded got subfolders named jpeg, png,...etc!
Hopefully, he will get it to work soon.
Thanks agian.
Kamal

garside

Re: Stand alone executables for Mac

Postby garside » 2009-02-17T15:17:01-07:00

I've been working with Kamal on this problem, and have tried a number of different ways to get this working, to no avail. I've tried the build on a number of different Macs, and the errors appear to be the same regardless of operating system version or processor type (Work machine is a PowerPC, my laptop is Intel, fails the same way on both). Here's the process I've been following:

curl -O http://www.imagemagick.org/download/del ... -6b.tar.gz
curl -O http://www.imagemagick.org/download/del ... 8.2.tar.gz
Download ImageMagick-6.4.9-4.tar.gz from a mirror

tar xvzf ImageMagic-6.4.9-4.tar.gz
tar xvzf libjpeg-6b.tar.gz
tar xvzf tiff-3.8.2.tar.gz
mv libjpeg-6b ImageMagick-6.4.9-4/jpeg
mv tiff-3.8.2 ImageMagick-6.4.9-4/tiff
cd ImageMagic-6.4.9-4/jpeg
./configure --disable-shared
make
cd ../tiff
./configure --disable-shared
make
cd ..
./configure --disable-shared --enable-delegate-build --enable-osx-universal-binary --disable-dependency-tracking --prefix=/ImageMagic-6.4.9-4

Here is the result of the configure:

Code: Select all

ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

Host system type: i386-apple-darwin9.6.0
Build system type: i386-apple-darwin9.6.0

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=no      no
Static libraries  --enable-static=yes      yes
Module support    --with-modules=no      no
GNU ld            --with-gnu-ld=no      no
Quantum depth     --with-quantum-depth=16   16
High Dynamic Range Imagery
                  --enable-hdri=no      no

Delegate Configuration:
BZLIB             --with-bzlib=yes      yes
Autotrace         --with-autotrace=no      no
DJVU              --with-djvu=yes      no
DPS               --with-dps=yes      no
FlashPIX          --with-fpx=yes         no
FontConfig        --with-fontconfig=yes      no
FreeType          --with-freetype=yes      yes
GhostPCL          None            pcl6 (unknown)
GhostXPS          None            gxps (unknown)
Ghostscript       None            gs (unknown)
result_ghostscript_font_dir='none'
Ghostscript fonts --with-gs-font-dir=default   
Ghostscript lib   --with-gslib=yes      no
Graphviz          --with-gvc=yes      no
JBIG              --with-jbig=yes      no
JPEG v1           --with-jpeg=yes      no (failed tests)
JPEG-2000         --with-jp2=yes      no
LCMS              --with-lcms=yes      no
LQR               --with-lqr=yes      no
Magick++          --with-magick-plus-plus=yes   yes
OpenEXR           --with-openexr=yes      no
PERL              --with-perl=no      no
PNG               --with-png=yes      yes
RSVG              --with-rsvg=yes      no
TIFF              --with-tiff=yes      no (failed tests)
Windows fonts     --with-windows-font-dir=   
WMF               --with-wmf=no      no
X11               --with-x=         yes
XML               --with-xml=yes      yes
ZLIB              --with-zlib=yes      yes

X11 Configuration:
      X_CFLAGS        = -I/usr/X11/include
      X_PRE_LIBS      = -lSM -lICE
      X_LIBS          = -L/usr/X11/lib -R/usr/X11/lib
      X_EXTRA_LIBS    =

Options used to compile and link:
  PREFIX          = /ImageMagic-6.4.9-4
  EXEC-PREFIX     = /ImageMagic-6.4.9-4
  VERSION         = 6.4.9
  CC              = gcc -std=gnu99
  CFLAGS          = -g -O2 -Wall -W -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -D_THREAD_SAFE
  MAGICK_CFLAGS   = -g -O2 -Wall -W -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -D_THREAD_SAFE
  CPPFLAGS        = -I/ImageMagic-6.4.9-4/include/ImageMagick
  PCFLAGS         =
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -L/Users/garside/Desktop/ImageMagick-6.4.9-4/jpeg/.libs -L/Users/garside/Desktop/ImageMagick-6.4.9-4/jpeg -L/Users/garside/Desktop/ImageMagick-6.4.9-4/magick -L/Users/garside/Desktop/ImageMagick-6.4.9-4/tiff/libtiff/.libs -L/Users/garside/Desktop/ImageMagick-6.4.9-4/tiff/libtiff -L/Users/garside/Desktop/ImageMagick-6.4.9-4/wand -L/usr/X11/lib -R/usr/X11/lib -L/usr/X11/lib -lfreetype -lz -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
  MAGICK_LDFLAGS  = -L/ImageMagic-6.4.9-4/lib -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -L/Users/garside/Desktop/ImageMagick-6.4.9-4/jpeg/.libs -L/Users/garside/Desktop/ImageMagick-6.4.9-4/jpeg -L/Users/garside/Desktop/ImageMagick-6.4.9-4/magick -L/Users/garside/Desktop/ImageMagick-6.4.9-4/tiff/libtiff/.libs -L/Users/garside/Desktop/ImageMagick-6.4.9-4/tiff/libtiff -L/Users/garside/Desktop/ImageMagick-6.4.9-4/wand -L/usr/X11/lib -R/usr/X11/lib -L/usr/X11/lib -lfreetype -lz -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices
  LIBS            = -lMagickCore -lfreetype -lpng -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lm -lpthread
  CXX             = g++
  CXXFLAGS        = -g -O2 -Wall -W -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386 -D_THREAD_SAFE


The errors which occur on the JPEG delegate library:

Code: Select all

-------------------------------------------------------------
checking for JPEG...
checking jconfig.h usability... yes
checking jconfig.h presence... yes
checking for jconfig.h... yes
checking jerror.h usability... yes
checking jerror.h presence... yes
checking for jerror.h... yes
checking jmorecfg.h usability... yes
checking jmorecfg.h presence... yes
checking for jmorecfg.h... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for jpeg_read_header in -ljpeg... no
checking for JPEG library is version 6b or later... yes
checking if JPEG package is complete... no -- some components failed test
-------------------------------------------------------------


And for TIFF

Code: Select all

-------------------------------------------------------------
checking for TIFF...
checking tiff.h usability... yes
checking tiff.h presence... yes
checking for tiff.h... yes
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking for TIFFOpen in -ltiff... no
checking for TIFFClientOpen in -ltiff... no
checking for TIFFIsByteSwapped in -ltiff... no
checking for TIFFReadRGBATile in -ltiff... no
checking for TIFFReadRGBAStrip in -ltiff... no
checking if TIFF package is complete... no -- some components failed test
-------------------------------------------------------------


I've tried a number of different ways to compile and configure, I've looked up, tried, and failed duplicating successful results on a number of tutorials, and I'm basically out of ideas, options, and posted solutions. If you've got any idea what the possible cause could be, please let me know. If you've got any alternate solutions, (like if someone has already solved this issue themselves), that'd be awesome, too.

Just to recap, what we're trying to achieve (seems simple enough, but I can't get it to work...)

Compile standalone universal binaries for Mac OS X with delegate support for JPEG and TIFF to redistribute as part of a package to our users. We don't want to need the users to install a full copy of ImageMagick on their machine, as we only really need the functionality of the Convert binary.

User avatar
magick
Site Admin
Posts: 9741
Joined: 2003-05-31T11:32:55-07:00
Contact:

Re: Stand alone executables for Mac

Postby magick » 2009-02-17T17:10:35-07:00

Suppose you want a static universal binary build of ImageMagick with JPEG support. Download ImageMagick and unpack. Download JPEG and unpack it into the ImageMagick folder. Rename the JPEG folder to 'jpeg'. Now build the JPEG library:

    export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
    export CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
    export LDFLAGS="-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
    ./configure --disable-shared --disable-dependency-tracking
    make

Now move to the top-level ImageMagick directory and type

    ./configure --disable-shared --disable-dependency-tracking --enable-delegate-build --enable-osx-universal-binary
    make

garside

Re: Stand alone executables for Mac

Postby garside » 2009-02-24T11:14:27-07:00

Is that the only help you can provide on this topic? Without links or some kind of direction, I can't imagine it would be a quick process to scan the OSX forums looking for information specific to ImageMagick. Do you know what environment variables need to be set, or where to look to find out?

And if you've built a static universal build of ImageMagick under OSX, why not release it, or at least publish relevant documentation to help out on this topic? Directing users asking for help to the support forums for an operating system when you've gone through the process before seems like a dodge more than assistance.

User avatar
magick
Site Admin
Posts: 9741
Joined: 2003-05-31T11:32:55-07:00
Contact:

Re: Stand alone executables for Mac

Postby magick » 2009-02-24T11:24:50-07:00

This forum is about ImageMagick and we barely have enough time to support ImageMagick questions. Building a universal binary is a Mac OS X specific question and has little to do with ImageMagick. Use Google to track down sites that discuss this subject in detail.

Regarding a Mac OS X specific static build. We don't see us offering that anytime soon. We simply don't have the staff and time to support off-by-one builds. However, any user can build ImageMagick and offer custom builds at any time. Generate a binary distribution and post its location here so others can download it and benefit from your work.

garside

Re: Stand alone executables for Mac

Postby garside » 2009-02-24T11:28:46-07:00

I'm not even concerned with a universal build. I'd be pleased if I was able to compile Imagemagick at all on the Mac, which I have yet been able to do. If you're not able to assist further with simply configuring a non-universal build of a standalone library on OSX, let me know so we can look into other libraries to achieve our goal.

User avatar
fmw42
Posts: 15278
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Stand alone executables for Mac

Postby fmw42 » 2009-02-24T11:46:36-07:00

I am by no means an expert on building IM on any platform. I struggled with it on Mac OSX Tiger. I finally got it installed manually. Here is a link to my experience. Perhaps it will help. viewtopic.php?f=1&t=10442

Have you tried a simple default install? ./configure

Here is the current config that I use on my Mac G4 Mini OSX Tiger system.

Default Q16
./configure --enable-delegate-build --enable-shared --disable-static \
--with-modules --with-quantum-depth=16 --without-wmf \
--enable-libtool-verbose --disable-dependency-tracking \
--with-gs-font-dir=/usr/local/share/ghostscript/fonts/ --with-lqr

The last two regard installation of ghostscript and liquid-resize delegates, which you do not need.

Then make and then sudo make install.

Hope this helps.

P.S.

You have to actually install the JPEG and TIFF libraries (./configure, make, sudo make install). You cannot just unpack them and move them somewhere. Then install IM. Perhaps I misunderstand your printout above?

To see what delegates are actually installed and understood by IM, use

convert -list configure

look for the line like this on my system

DELEGATES bzlib fontconfig freetype jpeg jp2 lcms lqr openexr png tiff x11 xml zlib


Note: you can also use MacPorts or Fink to install the delegates and IM. But I have had no experience with them.


Also see http://www.imagemagick.org/download/www ... ation.html

I think Magick means IM 6.4.9-6 below as -7 is not official, but may be downloaded as beta at this time. Also on a Mac, I believe you need to use sudo make install
Last edited by fmw42 on 2009-02-24T12:05:23-07:00, edited 3 times in total.

User avatar
magick
Site Admin
Posts: 9741
Joined: 2003-05-31T11:32:55-07:00
Contact:

Re: Stand alone executables for Mac

Postby magick » 2009-02-24T11:59:47-07:00

Try the following. Download ImageMagick and unpack. Next type

    cd ImageMagick-6.4.9-7
    ./configure
    make
If you want a static release, type

    ./configure --disable-shared

Does ImageMagick compile without complaint? If so you can install it with this command:

    make install

garside

Re: Stand alone executables for Mac

Postby garside » 2009-02-25T12:40:16-07:00

Alright, that worked fine, but it only has support for the PNG library. :\

User avatar
magick
Site Admin
Posts: 9741
Joined: 2003-05-31T11:32:55-07:00
Contact:

Re: Stand alone executables for Mac

Postby magick » 2009-02-25T12:58:56-07:00

See http://www.imagemagick.org/script/advan ... lation.php for instructions on how to include additional delegate library support when building ImageMagick.

User avatar
fmw42
Posts: 15278
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: Stand alone executables for Mac

Postby fmw42 » 2009-02-25T13:30:31-07:00

see my comments above and also you can get the delegates at http://www.imagemagick.org/download/delegates/ but you should check if more current version are available elsewhere. Google search helps.

morth

Re: Stand alone executables for Mac

Postby morth » 2010-06-16T01:10:40-07:00

I'd like to distribute ImageMagick inside my application. Unless I'm mistaken, ImageMagick contains hard coded paths to for example the coder.xml file, which makes this a bit difficult. Has anyone been looking at making ImageMagick into a framework together with the delegate libraries, and using the CFBundle functions to get the paths?


Return to “Users”

Who is online

Users browsing this forum: Bing [Bot] and 16 guests