Page 1 of 1

how to disable assert statements in ImageMagick

Posted: 2010-08-26T20:17:29-07:00
by richard.y
Hello to all,

How to disable assert statements in ImagMagick?

I am using RHL 5.4 and gott the latest source code, I know there is --disable-assert opiton in ./configure, but
I have tried it several times, it does work for me. Later I tried to change the
resulted makefile directly, so that the CXXFlAG has a -NDEBUG option, but
the resulted build library still has assert statement. I am sure the *.a file has
been updated since I have check the time it was created.

I have two ways to check if the library file has assert statement,
first I use nm -a xxx.a | fgrep assert
second I get assert error when running my program.

thanks to all.

Re: how to disable assert statements in ImageMagick

Posted: 2010-08-27T06:28:06-07:00
by magick
If you disable asserts in ImageMagick, you still have asserts in the various delegate libraries (.e.g tiff, png, etc). If you get an assert in your program, you have a logic error. That is what asserts are for, to help detect logic errors.

An easy fix for getting rid of asserts is to define assert in magick/studio.h and wand/studio.h:
  • #define assert(x)
This create a NOOP out of asserts.