RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.74k stars 160 forks source link

build fails because of macro from ctype.h #122

Closed omar-polo closed 2 years ago

omar-polo commented 2 years ago

I'm hitting this problem when compiling Godot (which bundles parts of this library) because the OpenBSD the stdlib defines _B in ctype.h

scons: *** [thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jitprofiling/jitprofiling.linuxbsd.tools.64.o] Error 1
In file included from thirdparty/oidn/mkl-dnn/src/cpu/cpu_reorder.cpp:26:
thirdparty/oidn/mkl-dnn/src/cpu/simple_reorder.hpp:482:53: error: expected unqualified-id
            || tag_traits<tag_o>::block_dims == bd::_B)
                                                    ^
/usr/include/ctype.h:52:12: note: expanded from macro '_B'
#define _B      0x80
                ^
1 error generated.

from https://en.cppreference.com/w/cpp/language/identifiers :

the identifiers that begin with an underscore followed by an uppercase letter are reserved;

so nothings stop, say, glibc to define _B (or _A) in some header in the future and break this library.

I tried to do some tricks with the preprocessors to avoid expanding _B to 0x80, but failed to do so.

atafra commented 2 years ago

We currently do not support OpenBSD. Since this issue is present in oneDNN, it would be best to report the issue there, if it's still present in the latest version. If it gets fixed upstream, Open Image Denoise will inherit the fix.