Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error building on mac osx 10.7 (lion) #45

Closed
borisbat opened this issue Oct 1, 2011 · 4 comments
Closed

error building on mac osx 10.7 (lion) #45

borisbat opened this issue Oct 1, 2011 · 4 comments

Comments

@borisbat
Copy link

borisbat commented Oct 1, 2011

mkdir build
cd build
cmake ..
make

gets me

/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:21991: error: declaration of C function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2742: error: previous declaration ‘void glTexImage1D(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:22032: error: declaration of C function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2743: error: previous declaration ‘void glTexImage2D(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:29140: error: declaration of C function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2744: error: previous declaration ‘void glTexImage3D(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:21991: error: declaration of C function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2742: error: previous declaration ‘void glTexImage1D(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:22032: error: declaration of C function ‘void glTexImage2D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2743: error: previous declaration ‘void glTexImage2D(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp: In function ‘void glTexImage1D(GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’:
/Users/bbatkin/Projects/apitrace-apitrace-e2c4320/build/cgltrace.cpp:29140: error: declaration of C function ‘void glTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ conflicts with
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2744: error: previous declaration ‘void glTexImage3D(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid_)’ here
lipo: can't figure out the architecture type of: /var/folders/yr/s06w52pd27ngk05n92dl0vn40000gn/T//cc3aVDhq.out
make[2]: *** [CMakeFiles/cgltrace.dir/cgltrace.cpp.o] Error 1
make[1]: *** [CMakeFiles/cgltrace.dir/all] Error 2

@orkunozbek
Copy link

i received same error.

@borisbat
Copy link
Author

borisbat commented Oct 2, 2011

Modifying line 63, 64, and and 399 of glapi.py to match the API fixes the compilation issue.

However, images do not look like they trace correctly - Image data is not displayed, retrace looks buggy (with wrong images).
Looks like we need more help here.

// line 63
GlFunction(Void, "glTexImage1D", [(GLenum, "target"), (GLint, "level"), (GLint, "internalformat"), (GLsizei, "width"), (GLint, "border"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(GLvoid), "__glTexImage1D_size(format, type, width)"), "pixels")]),

// line 64
GlFunction(Void, "glTexImage2D", [(GLenum, "target"), (GLint, "level"), (GLint, "internalformat"), (GLsizei, "width"), (GLsizei, "height"), (GLint, "border"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(GLvoid), "__glTexImage2D_size(format, type, width, height)"), "pixels")]),

// line 399
GlFunction(Void, "glTexImage3D", [(GLenum, "target"), (GLint, "level"), (GLint, "internalformat"), (GLsizei, "width"), (GLsizei, "height"), (GLsizei, "depth"), (GLint, "border"), (GLenum, "format"), (GLenum, "type"), (Blob(Const(GLvoid), "__glTexImage3D_size(format, type, width, height, depth)"), "pixels")]),

@jrfonseca
Copy link
Member

Could you please try this patch:

diff --git a/glimports.hpp b/glimports.hpp
index a24e20f..0ec1957 100644
--- a/glimports.hpp
+++ b/glimports.hpp
@@ -34,6 +34,15 @@
 // Prevent including system's glext.h
 #define __glext_h_

+// Some functions take GLenum disguised as GLint.  Apple noticed and fixed it
+// in the Mac OS X 10.6.x gl.h headers.  Regardless, C++ typechecking rules
+// force the wrappers to match the prototype precisely.
+#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_7)
+#define GLenum_int GLenum
+#else
+#define GLenum_int GLenum
+#endif
+

 #if defined(_WIN32)

diff --git a/specs/gltypes.py b/specs/gltypes.py
index e25cd7e..e187688 100644
--- a/specs/gltypes.py
+++ b/specs/gltypes.py
@@ -91,13 +91,12 @@ GLenum = Enum("GLenum", [
     # Parameters are added later from glparams.py's parameter table
 ])

-# Some functions take GLenum disguised as GLint.  Apple noticed and fixed it in
-# the gl.h header.  Regardless, C++ typechecking rules force the wrappers to
-# match the prototype precisely.
-if platform.system() == 'Darwin':
-    GLenum_int = GLenum
-else:
-    GLenum_int = Alias("GLint", GLenum)
+# Some functions take GLenum disguised as GLint, and need special treatment so
+# that symbolic names are traced correctly.  Apple noticed and fixed it in the
+# gl.h header, which further complicates things.  C++ typechecking rules force
+# the wrappers to match the prototype precisely, so the precise type is defined
+# in glimports.hpp
+GLenum_int = Alias("GLenum_int", GLenum)

 GLenum_mode = FakeEnum(GLenum, [
     "GL_POINTS",                         # 0x0000

This should hopefully work both for 10.7 and 10.6

Concerning the bad retracing, I haven't done extensive testing on Mac OS X 10.6, and I did no testing on 10.7 so far.

One thing I know is that 10.7 supports GL 3.2 on the core profile, and GL 2.1 on the compatibility profile, and apitrace doesn't take that in consideration, neither when recording or replaying.

jrfonseca added a commit that referenced this issue Oct 4, 2011
@jrfonseca
Copy link
Member

I've commited the fix.

borisbat, please open a new bug for the issues you're seeing, with the necessary info to reproduce them (see BUGS.markdown for details)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants