Bug 1168

Summary: GLhandleARB redefined in gltypes.h on osx
Product: [JogAmp] Jocl Reporter: Jeffrey Kuhn <drjrkuhn>
Component: openclAssignee: Wade Walker <wwalker3>
Severity: major CC: sgothel, wwalker3
Priority: ---    
Version: 2.3.2   
Hardware: pc_x86_64   
OS: macosx   
Type: DEFECT SCM Refs:
Workaround: ---
Attachments: Patch file for /jocl/make/stub_includes/GL3/gl3.h

Description Jeffrey Kuhn 2015-06-30 18:06:28 CEST
Created attachment 701 [details]
Patch file for /jocl/make/stub_includes/GL3/gl3.h

OSX Version 10.10.3 (Yosemite)

I tried a fresh build of JOCL on OSX and found a compiler error.

The OSX Framework implementation of OpenGL changed the typedef of GLhanldeARB from 'unsigned int' to 'void *' in /System/Library/Frameworks/OpenGL.framework/Headers/gltypes.h

The version in /jocl/make/stub_includes/GL3/gl3.h tries to redefine GLhandleARB to unsigned int.

I suggest the following change to gl3.h (patch file attached)

#ifndef GL_ARB_shader_objects
/* GL types for program/shader text and shader object handles */
typedef char GLcharARB;
#if defined(__APPLE__)
typedef void *GLhandleARB;
typedef unsigned int GLhandleARB;
Comment 1 Wade Walker 2015-06-30 19:30:05 CEST
Sounds good, I'll check into why this doesn't work on Yosemite. We do nightly builds for Mac, but I think it's using a slightly older version of the OS, so maybe this recently changed.
Comment 2 Wade Walker 2015-07-04 20:54:01 CEST
Confirmed this bug on Mac OS X 10.10.4 with the latest JOCL code compiled under Java 1.8.0_45. It looks like others have run into this problem as well (e.g. GLEW, described at http://sourceforge.net/p/glew/bugs/206/). Checking to see if Jeff's proposed solution will work on older versions of OS X.
Comment 3 Wade Walker 2015-07-05 16:30:43 CEST
OK, it looks like Khronos fixed it just the way Jeff suggested: https://www.khronos.org/bugzilla/show_bug.cgi?id=762

After Atlassian reported it to them: https://bitbucket.org/alfonse/glloadgen/issue/33/mac-compilation-error

So I'll add the same text that you see in https://www.opengl.org/registry/api/GL/glext.h:

#ifdef __APPLE__
typedef void *GLhandleARB;
typedef unsigned int GLhandleARB;
Comment 4 Wade Walker 2015-07-05 17:35:15 CEST
Resolved in commit 5a5a23a533df0ec5f47f94a7bda901e703b25040