[Pkg-gmagick-im-team] Bug#969128: libmagick++-6.q16-dev includes assert.h inside namespace.
peter green
plugwash at p10link.net
Thu Aug 27 23:47:47 BST 2020
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).
More information about the Pkg-gmagick-im-team
mailing list