Source: openexr Version: 1.6.1-5 Severity: serious Tags: patch Justification: fails to build from source (but built successfully in the past)
Hi, most probably due to GCC 4.7, openexr does not compile when large stacks are disabled, which is done by default on any non-Linux architecture (see also configure.ac). The problem can also be seen in a recent rebuild on hurd-i386[1], or just when trying to compile it on e.g. kfreebsd; for example on kfreebsd-amd64: | g++ -DHAVE_CONFIG_H -I. -I. -I../config -I/usr/include/OpenEXR -I.. -I../config -D_FORTIFY_SOURCE=2 -pipe -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -c ImfHuf.cpp -fPIC -DPIC -o .libs/ImfHuf.o | In file included from ImfHuf.cpp:50:0: | ./ImfAutoArray.h: In instantiation of 'Imf::AutoArray<T, size>::AutoArray() [with T = int; int size = 65537]': | ImfHuf.cpp:298:34: required from here | ./ImfAutoArray.h:60:39: error: 'memset' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] | In file included from /usr/include/string.h:642:0, | from ImfHuf.cpp:52: | /usr/include/x86_64-kfreebsd-gnu/bits/string3.h:77:1: note: 'void* memset(void*, int, size_t)' declared here, later in the translation unit | In file included from ImfHuf.cpp:50:0: | ./ImfAutoArray.h: In instantiation of 'Imf::AutoArray<T, size>::AutoArray() [with T = long unsigned int*; int size = 65537]': | ImfHuf.cpp:299:38: required from here | ./ImfAutoArray.h:60:39: error: 'memset' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] | In file included from /usr/include/string.h:642:0, | from ImfHuf.cpp:52: | /usr/include/x86_64-kfreebsd-gnu/bits/string3.h:77:1: note: 'void* memset(void*, int, size_t)' declared here, later in the translation unit | In file included from ImfHuf.cpp:50:0: | ./ImfAutoArray.h: In instantiation of 'Imf::AutoArray<T, size>::AutoArray() [with T = long unsigned int; int size = 65537]': | ImfHuf.cpp:361:36: required from here | ./ImfAutoArray.h:60:39: error: 'memset' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] | In file included from /usr/include/string.h:642:0, | from ImfHuf.cpp:52: | /usr/include/x86_64-kfreebsd-gnu/bits/string3.h:77:1: note: 'void* memset(void*, int, size_t)' declared here, later in the translation unit | In file included from ImfHuf.cpp:50:0: | ./ImfAutoArray.h: In instantiation of 'Imf::AutoArray<T, size>::AutoArray() [with T = Imf::{anonymous}::HufDec; int size = 16384]': | ImfHuf.cpp:1050:37: required from here | ./ImfAutoArray.h:60:39: error: 'memset' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] | In file included from /usr/include/string.h:642:0, | from ImfHuf.cpp:52: | /usr/include/x86_64-kfreebsd-gnu/bits/string3.h:77:1: note: 'void* memset(void*, int, size_t)' declared here, later in the translation unit | make[3]: *** [ImfHuf.lo] Error 1 Attached there is a patch that fixes the issue, by including <cstring> in ImfAutoArray.h only with no large stacks enabled, and making sure to call memset from the std namespace. (Note: it seems openexr 1.7.0 will no more memset() the data array in the "no large stacks" implementation.) [1] https://buildd.debian.org/status/fetch.php?pkg=openexr&arch=hurd-i386&ver=1.6.1-5%2Bb1&stamp=1337862561 Thanks, -- Pino
--- a/IlmImf/ImfAutoArray.h +++ b/IlmImf/ImfAutoArray.h @@ -46,6 +46,10 @@ #include "OpenEXRConfig.h" +#if !defined (HAVE_LARGE_STACK) +#include <cstring> +#endif + namespace Imf { @@ -57,7 +61,7 @@ { public: - AutoArray (): _data (new T [size]) {memset(_data, 0, size * sizeof(T));} + AutoArray (): _data (new T [size]) {::std::memset(_data, 0, size * sizeof(T));} ~AutoArray () {delete [] _data;} operator T * () {return _data;}