After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692420 - Build fails on Mac OS Mountain Lion: error: 'GL_NUM_EXTENSIONS' undeclared
Build fails on Mac OS Mountain Lion: error: 'GL_NUM_EXTENSIONS' undeclared
Status: RESOLVED OBSOLETE
Product: cogl
Classification: Platform
Component: Quartz
git master
Other Mac OS
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-01-23 23:04 UTC by Leo Singer
Modified: 2021-06-10 11:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.44 KB, patch)
2013-01-23 23:05 UTC, Leo Singer
none Details | Review

Description Leo Singer 2013-01-23 23:04:47 UTC
I'm trying to get started with cogl on Mac OS X Mountain Lion, working from either 1.13.2 or git master. I ran configure with the following arguments:

./configure --without-x --disable-glx --enable-quartz-image

The build fails here:
./cogl-context.c: In function '_cogl_context_get_gl_extensions':
./cogl-context.c:576: error: 'GL_NUM_EXTENSIONS' undeclared (first use in this function)
./cogl-context.c:576: error: (Each undeclared identifier is reported only once
./cogl-context.c:576: error: for each function it appears in.)

The problem is that Apple declares GL_NUM_EXTENSIONS in OpenGL/gl3.h, not OpenGL/gl.h. The attached patch fixes this. With this patch, the build finishes with no errors.

However, I am unable to run any of the examples. cogl-hello, for instance, crashes with the following stack trace:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000000003b0
0x00007fff8bdeb97a in glGetString ()
(gdb) bt
  • #0 glGetString
  • #1 _cogl_context_get_gl_extensions
    at cogl-context.c line 592
  • #2 _cogl_driver_update_features
    at cogl-driver-gl.c line 378
  • #3 _cogl_winsys_context_init
    at cogl-winsys-stub.c line 104
  • #4 cogl_context_new
    at cogl-context.c line 206
  • #5 main
    at cogl-hello.c line 52

Comment 1 Leo Singer 2013-01-23 23:05:44 UTC
Created attachment 234263 [details] [review]
Proposed patch
Comment 2 Neil Roberts 2013-01-24 11:37:57 UTC
Thanks for the patch. We normally assume that people are using the latest GL headers from khronos when building Cogl. When I build for OS X I normally use the glext.h header from here:

http://www.opengl.org/registry/api/glext.h

I'm not sure whether it makes sense to include both gl.h and gl3.h. It might be simpler to just have a #ifndef GL_NUM_EXTENSIONS in the code and define it manually. We have already done that in a few other places. We need to do something here anyway because it currently doesn't compile if the GLES2 driver is built without the GL driver.

I think the reason you are getting that crash is because you don't have a real winsys enabled in the configure and instead you are using the ‘stub’ winsys which doesn't really do anything. The --enable-quartz-image option isn't a winsys and it just enables using the Quartz API for loading images from files. Cogl doesn't currently have a native winsys for OS X, but the SDL winsys is known to work.
Comment 3 Neil Roberts 2013-01-24 12:10:42 UTC
I've posted a different patch to the mailing list which should also fix the problem:

http://lists.freedesktop.org/archives/cogl/2013-January/000862.html
Comment 4 Leo Singer 2013-01-24 16:30:46 UTC
(In reply to comment #2)
> Thanks for the patch. We normally assume that people are using the latest GL
> headers from khronos when building Cogl. When I build for OS X I normally use
> the glext.h header from here:
> 
> http://www.opengl.org/registry/api/glext.h

You are very welcome. Thank you for the speedy reply.
 
> I'm not sure whether it makes sense to include both gl.h and gl3.h. It might be
> simpler to just have a #ifndef GL_NUM_EXTENSIONS in the code and define it
> manually. We have already done that in a few other places. We need to do
> something here anyway because it currently doesn't compile if the GLES2 driver
> is built without the GL driver.

What about bundling Khronos' copy of glext.h with cogl? Is it possible to use Apple's OpenGL/gl.h and Khronos' glext.h at once?

> I think the reason you are getting that crash is because you don't have a real
> winsys enabled in the configure and instead you are using the ‘stub’ winsys
> which doesn't really do anything. The --enable-quartz-image option isn't a
> winsys and it just enables using the Quartz API for loading images from files.
> Cogl doesn't currently have a native winsys for OS X, but the SDL winsys is
> known to work.

I installed libsdl, libsdl_gfx, and libsdl_image from MacPorts and then configured cogl with --enable-sdl:

Cogl - 1.99.1 (git)

 • Global:
        Prefix: /Users/lady3jane/local

 • Features:
        Drivers:  gl
        GL Window System APIs: sdl
        Support GLES under SDL: no
        Build libcogl-gles2 GLES 2.0 frontend api: no
        Image backend: gdk-pixbuf
        Cogl Pango: yes
        Profiling: no

 • Compiler options:
        Cogl debug: yes
        Enable deprecated symbols: no
        Compiler flags: -g -O2  -DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_ENABLE_DEBUG -Wall -Wcast-align -Wuninitialized -Wno-strict-aliasing -Wempty-body -Wformat -Wformat-security -Winit-self -Wundef -Wdeclaration-after-statement -Wpointer-arith -Wmissing-declarations -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES
        Linker flags: -L/Users/lady3jane/local/lib   -framework OpenGL

 • Extra:
        Build API reference: no
        Build introspection data: auto
        Enable internationalization: no

Now type 'make' to compile Cogl.

The examples give me a different error message now:

$ ./cogl-info 
Failed to create context: SDL_SetVideoMode failed: X11 driver not configured with OpenGL

Same thing if I install libsdl-framework, libsdl_gfx-framework, and libsdl_image-framework. Evidently the MacPorts build of SDL wants to use X11.

If, instead, I configure with X11 and glx, i.e., without the options --without-x and --disable-glx, the build fails with the following error message:

  CC       cogl-sdl.lo
In file included from /Users/lady3jane/src/cogl/cogl/cogl-glx-renderer-private.h:82,
                 from /Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx.c:38:
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:171:58: error: macro "COGL_WINSYS_FEATURE_BEGIN" passed 7 arguments, but takes just 6
In file included from /Users/lady3jane/src/cogl/cogl/cogl-glx-renderer-private.h:82,
                 from /Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx.c:38:
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:166: error: expected specifier-qualifier-list before 'COGL_WINSYS_FEATURE_BEGIN'
In file included from /Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx.c:110:
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:171:58: error: macro "COGL_WINSYS_FEATURE_BEGIN" passed 7 arguments, but takes just 6
In file included from /Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx.c:110:
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:172: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:172: error: expected identifier or '(' before ',' token
In file included from /Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx.c:129:
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:171:58: error: macro "COGL_WINSYS_FEATURE_BEGIN" passed 7 arguments, but takes just 6
/Users/lady3jane/src/cogl/cogl/winsys/cogl-winsys-glx-feature-functions.h:166: error: 'COGL_WINSYS_FEATURE_BEGIN' undeclared here (not in a function)

I think that this brings up an issue for another bug report.
Comment 5 André Klapper 2021-06-10 11:19:00 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of cogl, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a ticket at
  https://gitlab.gnome.org/GNOME/cogl/-/issues/

Thank you for your understanding and your help.