Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#969128: libmagick++-6.q16-dev includes assert.h inside namespace.

51 views
Skip to first unread message

peter green

unread,
Aug 27, 2020, 7:00:03 PM8/27/20
to
Package: libmagick++-6.q16-dev
Version: 8:6.9.11.24+dfsg-1+b1

This bug is based on testing related to
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966904

Compiling the following simple test program fails.

#include <Magick++.h>
#include <assert.h>
int main() {
assert(1==2);
}

g++ `pkg-config --cflags ImageMagick++` test.cpp

In file included from test.cpp:2:
test.cpp: In function ‘int main()’:
test.cpp:4:5: error: ‘__assert_fail’ was not declared in this scope; did you mean ‘MagickCore::__assert_fail’?
4 | assert(1==2);
| ^~~~~~
In file included from /usr/include/ImageMagick-6/magick/memory_.h:22,
from /usr/include/ImageMagick-6/magick/MagickCore.h:125,
from /usr/include/ImageMagick-6/Magick++/Include.h:45,
from /usr/include/ImageMagick-6/Magick++.h:10,
from test.cpp:1:
/usr/include/assert.h:69:13: note: ‘MagickCore::__assert_fail’ declared here
69 | extern void __assert_fail (const char *__assertion, const char *__file,
|

The same code builds fine in buster.

The issue is that Magick++/Include.h includes the imagemagick headers inside a namespace,
unfortunately the imagemagick headers in turn include the assert.h header which therefore
gets included inside the namespace and breaks other code that tries to use functionality
from assert.h

A possible fix would be to have Include.h include assert.h before opening the namespace.
(a number of other standard C headers are already included by Include.h presumablly
for this very reason).

peter green

unread,
Jan 22, 2022, 10:50:04 AM1/22/22
to
tags 969128 +patch
tags 969128 +fixed-upstream
thanks

> libmagick++-6.q16-dev includes assert.h inside namespace.

Looks like upstream finally fixed this after a duplicate was filed in the
imagemagick 7 issue tracker (they fixed it in both versions 6 and 7)

https://github.com/ImageMagick/ImageMagick6/commit/88543494464bf94ef3430ba33bb34c62ba5050d6#diff-3268ce380c3c96855c30ea8875946bebcb93394c3f6e4b64d18028d73d618316
0 new messages