Xcode use ImageMagic++ static

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Xcode use ImageMagic++ static

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Xcode use ImageMagic++ static

Post by magick »

Add --disable-opencl to your configure script command line and rebuild ImageMagick. Now try linking to the MagickCore API.
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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.
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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 :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Xcode use ImageMagic++ static

Post 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.
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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 :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Xcode use ImageMagic++ static

Post 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.
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Xcode use ImageMagic++ static

Post by fmw42 »

Sorry I know nothing about building static. Best I can suggest is look at http://www.imagemagick.org/script/advan ... lation.php
mham
Posts: 10
Joined: 2012-09-01T11:06:39-07:00
Authentication code: 67789

Re: Xcode use ImageMagic++ static

Post 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.
Post Reply