Page 1 of 1

Xcode use ImageMagic++ static

Posted: 2012-09-01T11:09:24-07:00
by mham
Hi everyone,
I've set up a Xcode Project and im using libmagic++ for my project. However it works when I link to the dylib. It does not work when I link to the .a lib. I configured ImageMagick like this before building:


Option Value
-------------------------------------------------------------------------------
Shared libraries --enable-shared=yes yes
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
Dejavu fonts --with-dejavu-font-dir=default none
DJVU --with-djvu=yes no
DPS --with-dps=yes no
FFTW --with-fftw=yes no
FlashPIX --with-fpx=yes no
FontConfig --with-fontconfig=yes yes
FreeType --with-freetype=yes yes
GhostPCL None pcl6 (unknown)
GhostXPS None gxps (unknown)
Ghostscript None gs (9.05)
Ghostscript fonts --with-gs-font-dir=default /opt/local/share/ghostscript/fontsx/
Ghostscript lib --with-gslib=no no
Graphviz --with-gvc=no
JBIG --with-jbig=yes yes
JPEG v1 --with-jpeg=yes yes
JPEG-2000 --with-jp2=yes no
LCMS v1 --with-lcms=no no
LCMS v2 --with-lcms2=yes yes
LQR --with-lqr=yes no
LZMA --with-lzma=yes yes
Magick++ --with-magick-plus-plus=yes yes
OpenEXR --with-openexr=yes no
PERL --with-perl=no no
PANGO --with-pango=yes no
PNG --with-png=yes yes
RSVG --with-rsvg=no no
TIFF --with-tiff=yes yes
WEBP --with-webp=yes yes
Windows fonts --with-windows-font-dir= none
WMF --with-wmf=no no
X11 --with-x= yes
XML --with-xml=yes yes
ZLIB --with-zlib=yes yes


These are the error messages Im getting:

http://pastebin.com/N9YNxbLE

I don't know what to do :(

Please help
Thanks in advance!

Re: Xcode use ImageMagic++ static

Posted: 2012-09-01T14:51:10-07:00
by magick
Add --disable-opencl to your configure script command line and rebuild ImageMagick. Now try linking to the MagickCore API.

Re: Xcode use ImageMagic++ static

Posted: 2012-09-02T00:45:09-07:00
by mham
Hi thanks for your answer,

I did the following:

1. Terminal: cd to ImageMagick Sources Folder (ImageMagick-6.7.9-2)
2. ./configure --disable-opencl --enable-static=yes
3. make
4.make install


Now I went to the folder /usr/local/lib. There I have libMagick++.a, libMagickCore.a and libMagickWand.a and the corresponding dylib-Files.
I added the three .a files to my project and set the library search path recursivly to /usr/local/lib.
I tried creating my app, no problem in Debugmode. Then I deleted the 6 dylib-Files out of the /usr/local/lib Folder because Xcode seems to always look for the dylib files first.

Now I get 201 errors again(even in Debug mode), but I think the ones with CL are gone :(

http://pastebin.com/tc3zkqK6


I just want to build my program for another Mac, which doesnt have the ImageMagick Libraries intalled.

Re: Xcode use ImageMagic++ static

Posted: 2012-09-02T01:36:34-07:00
by mham
I tried folllowing your advice on another thread to this topic using:

./configure --disable-shared --enable-delegate-build

but I dont know which delegates I should put in the imagemagick folder in order to compile correctly :(

Re: Xcode use ImageMagic++ static

Posted: 2012-09-02T11:03:45-07:00
by fmw42
mham wrote:I tried folllowing your advice on another thread to this topic using:

./configure --disable-shared --enable-delegate-build

but I dont know which delegates I should put in the imagemagick folder in order to compile correctly :(

I believe that you must install the delegates prior to installing IM. You mostly need jpg, tiff, png

Here is what I have installed == try the ones in blue:


convert -list configure | grep -i "delegates"
DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms2 lqr openexr png tiff x11 xml zlib

You can get then at http://www.imagemagick.org/download/delegates/ or search Google for more current ones.

Re: Xcode use ImageMagic++ static

Posted: 2012-09-03T00:55:43-07:00
by mham
Thanks for your answer. So you say i have to download each delegate, configure each delegate to work static and then import them to my project? Why is that so complicated and nobody has ever done an ImageMagick-Source where it is all included in once? :/

I really only need to open JPEGs or PNGs in my program and scale them. Nothing fancy, no XML, no Zip or whatever Delegates are included.


/configure --enable-shared=no --enable-static=yes --with-modules=no --with-bzlib=no --with-autotrace=no --with-fpx=no --with-fontconfig=no --with-freetype=no --with-magick-plus-plus=yes --with-zlib=no --with-xml=no --with-perl=no --disable-opencl --with-x=no --disable-openmp

Hooray it compiles!
Still getting an error when I open PNG (image corrupt) but JPEG works fine for me. So I built "for archive" and will see if it runs on another mac

Thanks for your help, I will report later

Re: Xcode use ImageMagic++ static

Posted: 2012-09-03T02:33:14-07:00
by mham
Ok no he complains about

Dyld Error Message:
Library not loaded: /usr/local/lib/liblzma.5.dylib
Referenced from: /SignalGenerator.app/Contents/MacOS/SignalGenerator
Reason: image not found

and I fear that there are many errors to come if I solve this one. Does this mean, that I have to configure each delegate to run as a static library? Which means they have delegates too and on and on :( This is bullshit :(

Re: Xcode use ImageMagic++ static

Posted: 2012-09-03T10:28:21-07:00
by fmw42
Thanks for your answer. So you say i have to download each delegate, configure each delegate to work static and then import them to my project? Why is that so complicated and nobody has ever done an ImageMagick-Source where it is all included in once? :/
I am no expert on this. I know the binaries come with many delegates install.

On the Mac, I use MacPorts to install all my delegates and then install IM from source, so I have the latest IM. But you can install all the delegates you want from MacPorts and then install IM from MacPorts.

Re: Xcode use ImageMagic++ static

Posted: 2012-09-04T02:51:39-07:00
by mham
But still if I install the delegates from MacPorts I maybe have to tell each delegate to build static libraries too? And not all Delegates I downloaded manually have configure files with them

Re: Xcode use ImageMagic++ static

Posted: 2012-09-04T10:04:38-07:00
by fmw42
Sorry I know nothing about building static. Best I can suggest is look at http://www.imagemagick.org/script/advan ... lation.php

Re: Xcode use ImageMagic++ static

Posted: 2012-09-07T08:02:00-07:00
by mham
It worked. I just disabled most of the dependencys and only included libjpeg and some others, I coudn't disable. And I had to delete the dylibs for JPEG for example.