Closed Bug 518173 Opened 15 years ago Closed 14 years ago

webgl does not build on Darwin/X11 (bad gl.h)

Categories

(Core :: Graphics: CanvasWebGL, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: niederstrasser, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: 

WebGL does not build on Darwin/X11 due to a bug in the gl.h from Apple.  The check for 'good' toolkits/platforms in content/canvas/src/Makefile.in http://mxr.mozilla.org/mozilla-central/source/content/canvas/src/Makefile.in#58 needs to be modified to disallow Darwin (OS_ARCH=Darwin).

Reproducible: Always

Actual Results:  
Build error:

make[6]: Entering directory `/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/content/canvas/src'
WebGLContext.cpp
/usr/bin/g++-4.2 -o WebGLContext.o -c -fvisibility=hidden -DUSE_GLX -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DZLIB_INTERNAL -DOSTYPE=\"Darwin\" -DOSARCH=Darwin -D_IMPL_NS_LAYOUT  -I/src/mozilla-central/content/canvas/src -I. -I../../../dist/include -I../../../dist/include/nsprpub  -I/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/dist/include/nspr -I/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/dist/include/nss -I/sw/include     -I/src/mozilla-central/content/canvas/src/../../../layout/xul/base/src -I/src/mozilla-central/content/canvas/src/../../../layout/style -I/src/mozilla-central/content/canvas/src/../../../layout/generic -I/src/mozilla-central/content/canvas/src/../../base/src -I/src/mozilla-central/content/canvas/src/../../html/content/src   -fPIC  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-long-long -fno-strict-aliasing -fpascal-strings -fno-common -fshort-wchar -pthread  -DNDEBUG -DTRIMMED -O3 -I/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/dist/include/cairo -I/sw/include/gtk-2.0 -I/sw/lib/gtk-2.0/include -I/sw/include/atk-1.0 -I/sw/include/cairo -I/sw/include/pango-1.0 -I/sw/include/glib-2.0 -I/sw/lib/glib-2.0/include -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/sw/include/gtk-unix-print-2.0 -I/usr/X11R6/include -I/usr/X11/include   -DMOZILLA_CLIENT -include ../../../mozilla-config.h -Wp,-MD,.deps/WebGLContext.pp /src/mozilla-central/content/canvas/src/WebGLContext.cpp
In file included from /usr/X11R6/include/GL/gl.h:1987,
                 from /usr/X11R6/include/GL/glx.h:45,
                 from /src/mozilla-central/content/canvas/src/nsGLPbuffer.h:61,
                 from /src/mozilla-central/content/canvas/src/WebGLContext.h:59,
                 from /src/mozilla-central/content/canvas/src/WebGLContext.cpp:2:
/usr/X11R6/include/GL/glext.h:4020: error: conflicting declaration ‘typedef void (* PFNGLTEXIMAGE3DPROC)(unsigned int, int, int, int, int, int, int, unsigned int, unsigned int, const GLvoid*)’
/usr/X11R6/include/GL/gl.h:1740: error: ‘PFNGLTEXIMAGE3DPROC’ has a previous declaration as ‘typedef void (* PFNGLTEXIMAGE3DPROC)(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, const GLvoid*)’
/usr/X11R6/include/GL/glext.h:4178: error: conflicting declaration ‘typedef void (* PFNGLMULTIDRAWARRAYSPROC)(unsigned int, int*, int*, int)’
/usr/X11R6/include/GL/gl.h:1850: error: ‘PFNGLMULTIDRAWARRAYSPROC’ has a previous declaration as ‘typedef void (* PFNGLMULTIDRAWARRAYSPROC)(unsigned int, const int*, const int*, int)’
make[6]: *** [WebGLContext.o] Error 1
make[6]: Leaving directory `/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/content/canvas/src'
make[5]: *** [src_libs] Error 2
make[5]: Leaving directory `/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/content/canvas'
make[4]: *** [canvas_libs] Error 2
make[4]: Leaving directory `/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser/content'
make[3]: *** [libs_tier_gecko] Error 2
make[3]: Leaving directory `/src/mozilla-central/obj-i386-apple-darwin9.8.0-browser'


This is apparently a bug in Apple's version of gl.h, which differs from the OpenGL.org specs.  See

http://xquartz.macosforge.org/trac/ticket/311

for the background.  Until Apple fixes their gl.h, webgl will not successfully build on Darwin/x11.  This is not Bug 517566, since Apple's X11 does include glx.h and in theory WebGL _should_ work on Darwin/X11, but for their buggy headers.
Depends on: 517566
With the webgl check moved from content/canvas/src/Makefile.in to configure.in, (bug 517566) this patch disables webgl under Darwin/X11-gtk2.  Other cairo-gtk2 platforms and cairo-cocoa are not touched.  This check can be removed once the relevant GL headers are fixed by Apple.
Attachment #408671 - Flags: review?(vladimir)
Could work around this, I bet.
I'll post a patch for that shortly.
Update to correct bitrot from addition of new MOZ_WEBGL_GLX
Attachment #408671 - Attachment is obsolete: true
Attachment #419314 - Flags: review?
Attachment #408671 - Flags: review?(vladimir)
Component: Canvas: 2D → Canvas: WebGL
Attachment #419314 - Flags: review? → review?(vladimir)
Can you check if the problem is still present?
If yes, can you please update the patch (if needed)?
I'll be able to look into this over the weekend (computer with tree is out of house).  If I remember correctly what I did a few months ago, I was able to get WebGL to work (at least Vlad's spore creature viewer rotated, but _very_ slowly) but I had to update X11 to a newer Xquartz release (2.5.0) than what comes with the OS and a change was needed to the glx.h configure check (probably a missing xcflags, but I can't recall for sure now).
OpenGL.framework has multiple differences like this already.

I encourage you to file a bug report at http://bugreport.apple.com if you feel this is an important issue, and you can reference that this is related to  <rdar://problem/6953344>.

You should not blindly disable webgl/webglx on darwin/gtk2.

The latest releases of XQuartz ditch the OpenGL.framework gl.h shim and use mesa's gl.h for improved compatibility.  Additionally, MacPorts will build it just fine since it is in step with the latest XQuartz changes.
Jeremy,

I filed <rdar://problem/7243865> with Apple back in Sept 2009.  In October, it was marked a duplicate of <rdar://problem/7238648>, which I can't access.  I'll note the reference to <rdar://problem/6953344>.

I agree that blindly disabling webgl is not a good solution.  However, until I updated to xquartz 2.5.0, trunk builds failed to build.  I just tried again, and mozilla-central successfully built, although I had to set extra CPPFLAGS so that the configure check for GL/glx.h would work.

WebGL is very slow here (it's using software rendering according to the terminal output), but it does work now that I've updated the deps.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
Your radar was marked as a dupe of 7238648 which was for differences in glMultiDrawArrays ... this is actually a point where Apple was right in following the spec, and others were wrong.   A bug was filed about that with khronos, but it seems to have been lost for some reason.  I'm looking into that right now.

6953344 is the radar for the glTexImage[123]D differences.  So your bug report was actually a dupe of both, but we have no way of really flagging that, so one was chosen over the other.  I hope that clarifies things for you.

What software path is it using to render?  Is it using a mesa software path or an OpenGL.framework software path?

Please feel free to followup with me via email, since this isn't exactly pertinent to this bug report.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: