crash when using MagickCore to load images

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?".
Post Reply
_julian_

crash when using MagickCore to load images

Post by _julian_ »

hello all

i'm trying to load images using magick core. i came up with the following code for a image-loading routine:

Code: Select all

namespace MC
{
#include <magick/MagickCore.h>
}
void * vtuLoadImage_IM(const char *imagePath, uint32_t *pic_size)
{
	static int times = 0;
	if (times == 0)
		MagickCoreGenesis("/Users/julian/Documents/Development/_BUILD/Debug/VTDemo.app/Contents/MacOS/VTDemo", MC::MagickFalse);
	MC::ExceptionInfo *exception = MC::AcquireExceptionInfo();

	MC::ImageInfo *image_info = CloneImageInfo((MC::ImageInfo *) NULL);
    strcpy(image_info->filename, imagePath);
	MC::Image *image = ReadImage(image_info, exception);
	char *image_data = (char *)malloc(c.pageMemsize);

	assert(image);

	const MC::PixelPacket *p = GetVirtualPixels(image, 0, 0, image->columns, image->rows, exception);

	memcpy(image_data, p, c.pageMemsize);
	DestroyImage(image);

	return image_data;
}
but it doesn't even make it through the call to MagickCoreGenesis(). wheather i'm useing the mac library binaries from MacPorts or the official precompiled ones for ImageMagick-6.5.9, it always crashes in gomp_resolve_num_threads(). i've searched for that symbol here without avail.

here is the full backtrace:

Code: Select all

#0  0x000000010025ed1c in gomp_resolve_num_threads ()
#1  0x00000001002305ee in ResourceComponentGenesis ()
#2  0x00000001001ecfe5 in MagickCoreGenesis ()
#3  0x0000000100016e8e in vtuLoadImage_IM (imagePath=0x11825dda0 "/Users/julian/Documents/Development/VirtualTexturing/_texdata/32k_b1_jpg/tiles_b1_level1/tile_1_36_35.jpg", pic_size=0x100059bc0) at /Users/julian/Documents/Development/VirtualTexturing/LibVT/LibVT_Utilities.cpp:141
#4  0x000000010002e7fd in vtLoadNeededPages () at /Users/julian/Documents/Development/VirtualTexturing/LibVT/LibVT_PageLoadingThread.cpp:70
any ideas what i'm doing wrong?

thanks a lot! ;-)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: crash when using MagickCore to load images

Post by magick »

Add --disable-openmp to your configure script command line and rebuild / reinstall ImageMagick and rerun your program. Perhaps you have a bug in your instance of the Gomp library.
_julian_

Re: crash when using MagickCore to load images

Post by _julian_ »

thanks that helped!
Post Reply