how to disable assert statements in ImageMagick

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
richard.y

how to disable assert statements in ImageMagick

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

Re: how to disable assert statements in ImageMagick

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