Page 1 of 1

cannot compile

Posted: 2011-05-26T14:59:22-07:00
by tominko
i'm trying to add magick++ to my c++ project, i've install it following the steps on (http://www.imagemagick.org/script/binary-releases.php) - i have mac - there is one small bug - after decompress it is in "ImageMagick-6.6.9" folder instead of "ImageMagick-6.7.0" which is in instructions - but thats not the problem.

my code:

Code: Select all

#include <Magick++.h>
...
Magick::Image iMg();
iMg.read("aa.gif");
my Makefile:

Code: Select all

CC=g++
CFLAGS=-c -Wall ... -m32 -Wall -ansi -pedantic -O3 -Wno-long-long -I /Users/tominko/ImageMagick-6.6.9/include/ImageMagick 
LDFLAGS=... -m32 -pthread -L /Users/tominko/ImageMagick-6.6.9/lib -lMagick++ -ljpeg -lpng -ltiff -lbz2 -lxml2 -lz -lm -lgomp -lclparser -lMagickWand -lMagickCore
...
when i compile my project i've got error:
error: request for member ‘read’ in ‘iMg’, which is of non-class type ‘Magick::Image ()()’
i've tried as well the "Magick++-config ....." option with error:
error: Magick++.h: No such file or directory
if i run "Magick++-config --cppflags --cxxflags --ldflags --libs" there is lots of non-existing directories as well for example "$MAGICK_HOME-10" i have set my $MAGICK_HOME to "/Users/tominko/ImageMagick-6.6.9"

commandline function 'convert' working ok

please help ;-(

Re: cannot compile

Posted: 2011-05-26T16:48:28-07:00
by magick
Let's start with a Magick++ script that we know works:

Code: Select all

#include "Magick++.h"

using namespace std;
using namespace Magick;
void testbild()
{
  Image  image;
  image.read( "logo:");
  Geometry newSize = Geometry(720, 480);
  image.scale(newSize);
  image.write( "logo.png");
}

int main(int argc, char **argv)
{
   InitializeMagick(*argv);
   testbild(); // OK
   return 0;
}

Re: cannot compile

Posted: 2011-05-28T15:08:48-07:00
by tominko
i dont think the problem will be sorted by adding

using namespace std;
using namespace Magick;

...i've tried that as well with the same error

because im specified namespace in initialization Magick::Image iMg();


i think the problem is that the binary distribution is 64bit and i'm using -m32 for compiling my project in 32bit (which i need because i cant get mysql++ proper working on 64bit)

i've tried to install ImageMagick from source in 32bit but without luck, is there any 32bit binary distribution for osx?

Re: cannot compile

Posted: 2011-05-28T15:36:08-07:00
by magick
Have you look at the options available @ http://www.macports.org/ports.php?by=na ... mageMagick?

Re: cannot compile

Posted: 2011-05-29T02:05:48-07:00
by tominko
yes, there is no option to force install 32bit version - it will be 32bit only if its compiled on 32bit system ;-(

Re: cannot compile

Posted: 2011-05-29T06:46:58-07:00
by magick
Isn't the +Universal option 32-bit?

Re: cannot compile

Posted: 2011-05-29T08:35:13-07:00
by tominko
Universal means it's compiled for PowerPC processor as well as for intel (older macs have powerpc processors)

Re: cannot compile

Posted: 2011-05-29T10:10:38-07:00
by magick
Right. We were thinking it might be 32-bit as well. Perhaps not.

Re: cannot compile

Posted: 2011-05-29T11:47:06-07:00
by tominko
I've managed to get running mysql in 64bit, but now it looks like there is some problem with threads and magick ;-(

if i run your testing script in the main procedure it will run fine, but if i put it where i need it - in procedure which is created as a separate thread then i've got segmentation fault ;-(

any ideas?

Re: cannot compile

Posted: 2011-05-29T12:05:16-07:00
by magick
You need a version of ImageMagick that does not include OpenMP support. Under Linux OpenMP and Posix threads are compatible. Not so for Mac OS X.

Re: cannot compile

Posted: 2011-05-30T04:32:42-07:00
by tominko
imagemagick recompiled without threads and without openmp and its working fine now ;-) ...just it takes over hour and half to install all required packages ;-)

Thanx for help