Page 1 of 1

Magic++ crash

Posted: 2016-10-30T16:51:04-07:00
by Silver_Sparrow
Hello. I am getting started with Magic++ and am having a problem getting a basic program to run. Here is the code.

Code: Select all

#include <iostream>
#include <Magick++.h>

using namespace std;
using namespace Magick;

int main()
{
    Image hello_image;
    hello_image.read("/media/[myUserName]/Data/test.bmp");
    hello_image.display();
    return 0;
}
I am compiling with Code::Blocks GCC compiler running under Linux Mint, and have successfully gotten the program to compile; however, the program crashes when run giving the following error.

Code: Select all

ImageMagicTest: magick/semaphore.c:531: LockSemaphoreInfo: Assertion `semaphore_info != (SemaphoreInfo *) ((void *)0)' failed.
Aborted

Process returned 134 (0x86)   execution time : 0.006 s
Press ENTER to continue.
I haven't been able to figure out what is going on since googling Magic++ and the error will only give a handful of results, however, I have pinned the issue down to the line where I try to read in the image. I was confident with the code since it matches the examples given, but obviously something isn't working. Can anyone help me with this?

Thanks.

Re: Magic++ crash

Posted: 2016-10-30T17:17:39-07:00
by snibgo
I supposed you've built the IM system with the same compiler etc?

I think LockSemaphoreInfo is used only for multi-threading, so you might rebuild without multithreading.

I should also ask: what version of IM?

Re: Magic++ crash

Posted: 2016-10-30T19:09:48-07:00
by Silver_Sparrow
I downloaded the API using apt-get and don't know the version number, but since this seems to be a problem resident to the build, I will try building my own without multi-threading.

Re: Magic++ crash

Posted: 2016-10-30T20:00:34-07:00
by Silver_Sparrow
Okay, I built from source this time, with the option --without-multithread specified when configuring. (please correct me if did this at the wrong time, I am not used to building from source that often) Anyway, I am using GraphicsMagick-1.3.25/Magick++ now. After making and installing, I changed my include statement to

Code: Select all

#include </home/[myUsername]/Programming/GraphicsMagick-1.3.25/Magick++/lib/Magick++.h>
However, when I compile, I get the same error when trying to run the program.

Re: Magic++ crash

Posted: 2016-10-30T21:00:20-07:00
by fmw42
This is an Imagemagick forum. Imagemagick is not the same as GraphicsMagick. You should consult the GraphicsMagick forum when installing GraphicsMagick.

For Imagemagick IM 7 installs, see

http://www.imagemagick.org/script/insta ... e.php#unix
http://www.imagemagick.org/script/advan ... lation.php

and

http://www.imagemagick.org/script/binary-releases.php

For Imagemagick IM 6 versions, see

http://legacy.imagemagick.org/script/ad ... lation.php
http://legacy.imagemagick.org/script/ad ... lation.php

and

http://legacy.imagemagick.org/script/bi ... leases.php