Bug 1168 - GLhandleARB redefined in gltypes.h on osx
Summary: GLhandleARB redefined in gltypes.h on osx
Alias: None
Product: Jocl
Classification: JogAmp
Component: opencl (show other bugs)
Version: 2.3.2
Hardware: pc_x86_64 macosx
: --- major
Assignee: Wade Walker
Depends on:
Reported: 2015-06-30 18:06 CEST by Jeffrey Kuhn
Modified: 2015-09-27 01:33 CEST (History)
2 users (show)

See Also:
SCM Refs:
Workaround: ---

Patch file for /jocl/make/stub_includes/GL3/gl3.h (566 bytes, patch)
2015-06-30 18:06 CEST, Jeffrey Kuhn
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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