Compilation failure on OS X El Capitan
Created by: msakai
I failed to compile OpenCL-1.0.3.4 on Mac OS X El Capitan (10.11.4) with the following error.
Preprocessing library OpenCL-1.0.3.4...
c2hs: C header contains errors:
/System/Library/Frameworks/OpenGL.framework/Headers/CGLDevice.h:19: (column 28) [ERROR] >>> Syntax error !
The symbol `CGLGetShareGroup' does not fit here.
It seems that the __nullable
annotation confused c2hs.
Here are some code snippet that might be relevant to the problem.
CGLDevice.h:
15 OPENGL_ASSUME_NONNULL_BEGIN
16
17 typedef struct CGLShareGroupRec *CGLShareGroupObj OPENGL_AVAILABLE(10_6);
18
19 CGLShareGroupObj OPENGL_NULLABLE CGLGetShareGroup(CGLContextObj ctx) OPENGL_AVAILABLE(10_6);
20
CGLTypes.h:
14 #if __has_feature(assume_nonnull)
15 #define OPENGL_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
16 #define OPENGL_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
17 #else
18 #define OPENGL_ASSUME_NONNULL_BEGIN
19 #define OPENGL_ASSUME_NONNULL_END
20 #endif
21
22 #if __has_feature(nullability)
23 #define OPENGL_NULLABLE __nullable
24 #define OPENGL_NONNULL __nonnull
25 #else
26 #define OPENGL_NULLABLE
27 #define OPENGL_NONNULL
28 #endif