BruceSherwood / vpython-wx

VPython based on wxPython
Other
70 stars 38 forks source link

Compiler error in glext.h/shader_program.cpp (OS X 10.9.2) #46

Closed AprilArcus closed 10 years ago

AprilArcus commented 10 years ago

With Mac OS X 10.9.2, boost 1.55.0, brew install'ed python 2.7.6, gfortran, wxpython, pip install'ed numpy, scipy, ttfquery, fonttools, and https://bitbucket.org/jraedler/polygon2/downloads/Polygon2-2.0.6.zip

Followed build instructions according to vpython-wx/MAC-OSX.txt using

./bootstrap.sh --with-toolset=gcc --with-python-version=2.7 --with-python-root=/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/Current/

to build boost against homebrew's python. Upon

cd vpython-wx
python setup.py install

I received this compiler error:

In file included from /opt/src/vpython-wx/src/core/arrow.cpp:6:
In file included from /opt/src/vpython-wx/include/arrow.hpp:9:
In file included from /opt/src/vpython-wx/include/primitive.hpp:9:
In file included from /opt/src/vpython-wx/include/renderable.hpp:9:
In file included from /opt/src/vpython-wx/include/util/rgba.hpp:9:
In file included from /opt/src/vpython-wx/include/wrap_gl.hpp:21:
/opt/src/vpython-wx/include/GL/glext.h:3411:22: error: typedef redefinition with
      different types ('unsigned int' vs 'void *')
typedef unsigned int GLhandleARB;       /* shader object handle */
                     ^
/System/Library/Frameworks/OpenGL.framework/Headers/gltypes.h:65:15: note: 
      previous definition is here
typedef void *GLhandleARB;
              ^

if I comment out the offending typedef in glext.h, I receive these errors instead:

/opt/src/vpython-wx/src/core/util/shader_program.cpp:22:48: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
                cache = 2 + v.glext.glGetUniformLocationARB( program, name );
                                                             ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:42:10: error: assigning to
      'int' from incompatible type 'GLhandleARB' (aka 'void *')
        program = v.glext.glCreateProgramObjectARB();
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:48:28: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        v.glext.glLinkProgramARB( program );
                                  ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:52:37: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        v.glext.glGetObjectParameterivARB( program, GL_OBJECT_LINK_STATU...
                                           ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:62:38: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
                v.glext.glGetObjectParameterivARB( program, GL_OBJECT_IN...
                                                   ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:64:28: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
                v.glext.glGetInfoLogARB( program, length+1, &length, &temp[0] );
                                         ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:73:30: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
                v.glext.glDeleteObjectARB( program );
                                           ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:80:33: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        v.glext.glUseProgramObjectARB( program );
                                       ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:87:30: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
                v.glext.glDeleteObjectARB( program );
                                           ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:101:6: error: cannot
      initialize a variable of type 'int' with an rvalue of type 'GLhandleARB'
      (aka 'void *')
        int shader = v.glext.glCreateShaderObjectARB( type );
            ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:139:20: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        glDeleteObjectARB(program);
                          ^~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:167:33: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        v.glext.glUseProgramObjectARB( program->program );
                                       ^~~~~~~~~~~~~~~~
/opt/src/vpython-wx/src/core/util/shader_program.cpp:175:33: error: cannot
      initialize a parameter of type 'GLhandleARB' (aka 'void *') with an lvalue
      of type 'int'
        v.glext.glUseProgramObjectARB( oldProgram );
                                       ^~~~~~~~~~
BruceSherwood commented 10 years ago

No clue why this problem arises, since this doesn't happen when building VPython for Python 2.7 from python.org.

AprilArcus commented 10 years ago

What version of OS X are you building under? Apparently the typedef of GLhandleARB was changed from (unsigned int) to (void*) in 10.7. c.f. http://meandmark.com/blog/2011/11/sdl-opengl-typedef-redefinition-error-on-mac-os-x-10-7/

Who is the author of shader_program.cpp? Can we cc them?

BruceSherwood commented 10 years ago

Thanks much for the detailed information. I'm not sure what OSX version Steve Spicklemire used to build the VPython installers available at vpython.org, but those installers work with Python from python.org for all versions of OSX starting with 10.6.

shader_program.cpp was written by David Scherer, the originator of VPython. He is no longer involved.

sspickle commented 10 years ago

Hi Bruce,

The version that on sourceforge was built on OSX 10.8. I've not tried building from source on 10.9, but I'll try soon.

-steve

On Apr 8, 2014, at 10:03 PM, BruceSherwood notifications@github.com wrote:

Thanks much for the detailed information. I'm not sure what OSX version Steve Spicklemire used to build the VPython installers available at vpython.org, but those installers work with Python from python.org for all versions of OSX starting with 10.6.

shader_program.cpp was written by David Scherer, the originator of VPython. He is no longer involved.

— Reply to this email directly or view it on GitHub.

AprilArcus commented 10 years ago

I've added an #ifdef for Mac OS >= 10.7 to glext.h, changed a couple (int)s to (GLhandleARB)s in shader_program.hpp and spammed shader_program.cpp with typecasts until it compiled. Try my pull request and let me know if anything's on fire!