We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3944 - MinGW/MXE/MSYS2: SDL_opengl.h declares conflicting extension prototypes even without -DGL_GLEXT_PROTOTYPES
Summary: MinGW/MXE/MSYS2: SDL_opengl.h declares conflicting extension prototypes even ...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.4
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-06 10:24 UTC by Charlemagne Lasse
Modified: 2017-12-03 16:31 UTC (History)
1 user (show)

See Also:


Attachments
Revert of problematic commit which was taken from MXE (83.28 KB, patch)
2017-11-06 10:35 UTC, Charlemagne Lasse
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charlemagne Lasse 2017-11-06 10:24:00 UTC
I've tried to compile mupen64plus against MXE (mingw crosscompile environment) and found following problem with SDL2 in MXE:

* https://travis-ci.org/charlemagnelasse/mupen64plus-video-glide64/jobs/297566071
* https://travis-ci.org/charlemagnelasse/mupen64plus-video-glide64/jobs/297566072
* https://travis-ci.org/charlemagnelasse/mupen64plus-video-rice/jobs/297566188
* https://travis-ci.org/charlemagnelasse/mupen64plus-video-rice/jobs/297566189

Problem is that SDL_opengl.h is declaring prototypes even when GL_GLEXT_PROTOTYPES is not set. And when you set GL_GLEXT_PROTOTYPES then it declares it twice (one time in SDL_opengl.h and one time in SDL_opengl_glext.h):

> i686-w64-mingw32.shared-g++ -fvisibility-inlines-hidden -std=gnu++0x -O3 -flto -Wall -Wno-unused-function -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/Glitch64/inc -DGCC -mmmx -msse -fno-PIC -I/usr/lib/mxe/usr/i686-w64-mingw32.shared/include   -I/usr/lib/mxe/usr/i686-w64-mingw32.shared/include/libpng16    -I/usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2 -Dmain=SDL_main -DGL_GLEXT_PROTOTYPES "-I/home/travis/build/charlemagnelasse/mupen64plus-video-glide64mk2/deps/mupen64plus-core/src/api/" -MD -MP -DNO_FILTER_THREAD -DTEXTURE_FILTER -DDUMP_CACHE  -c -o _obj/Glitch64/OGLgeometry.o ../../src/Glitch64/OGLgeometry.cpp
> In file included from ../../src/Glitch64/OGLcombiner.cpp:30:0:
> ../../src/Glitch64/glitchmain.h:77:38: error: 'void (__attribute__((__stdcall__)) * glActiveTextureARB)(GLenum)' redeclared as different kind of symbol
>      extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
>                                       ^
> In file included from ../../src/Glitch64/glitchmain.h:76:0,
>                  from ../../src/Glitch64/OGLcombiner.cpp:30:
> /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl.h:2019:23: note: previous declaration 'void glActiveTextureARB(GLenum)'
>  GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
>                        ^
> In file included from ../../src/Glitch64/OGLcombiner.cpp:30:0:
> ../../src/Glitch64/glitchmain.h:78:37: error: 'void (__attribute__((__stdcall__)) * glAttachObjectARB)(GLhandleARB, GLhandleARB)' redeclared as different kind of symbol
>      extern PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
>                                      ^
> In file included from /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl.h:2098:0,
>                  from ../../src/Glitch64/glitchmain.h:76,
>                  from ../../src/Glitch64/OGLcombiner.cpp:30:
> /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl_glext.h:3659:21: note: previous declaration 'void glAttachObjectARB(GLhandleARB, GLhandleARB)'
>  GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);
>                      ^
> In file included from ../../src/Glitch64/OGLcombiner.cpp:30:0:
> ../../src/Glitch64/glitchmain.h:79:40: error: 'void (__attribute__((__stdcall__)) * glBindFramebufferEXT)(GLenum, GLuint)' redeclared as different kind of symbol
>      extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;

The commit introducing this problem is http://hg.libsdl.org/SDL/file/c94127dcbe97/include/SDL_opengl.h . And this commit can be reverted to fix this problem.

Tried to use -DNO_SDL_GLEXT but then even more stuff is undefined (tested with both "-DNO_SDL_GLEXT" and "-DNO_SDL_GLEXT -DGL_GLEXT_PROTOTYPES"):

> /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl.h:2031:23: note: previous declaration 'void glMultiTexCoord2fARB(GLenum, GLfloat, GLfloat)'
>  GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
>                        ^
> ../../src/Glitch64/glitchmain.h:140:34: error: 'void (__attribute__((__stdcall__)) * glActiveTextureARB)(GLenum)' redeclared as different kind of symbol
>  extern PFNGLACTIVETEXTUREARBPROC glActiveTextureARB;
>                                   ^
> In file included from ../../src/Glitch64/glitchmain.h:76:0,
>                  from ../../src/Glitch64/OGLgeometry.cpp:26:
> /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl.h:2019:23: note: previous declaration 'void glActiveTextureARB(GLenum)'
>  GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
>                        ^
> In file included from ../../src/Glitch64/OGLgeometry.cpp:26:0:
> ../../src/Glitch64/glitchmain.h:141:36: error: 'void (__attribute__((__stdcall__)) * glMultiTexCoord2fARB)(GLenum, GLfloat, GLfloat)' redeclared as different kind of symbol
>  extern PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB;
>                                     ^
> In file included from ../../src/Glitch64/glitchmain.h:76:0,
>                  from ../../src/Glitch64/OGLgeometry.cpp:26:
> /usr/lib/mxe/usr/i686-w64-mingw32.shared/include/SDL2/SDL_opengl.h:2031:23: note: previous declaration 'void glMultiTexCoord2fARB(GLenum, GLfloat, GLfloat)'
>  GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
>                        ^
> ../../src/Glitch64/OGLgeometry.cpp: In function 'void grDrawTriangle(const void*, const void*, const void*)':
> ../../src/Glitch64/OGLgeometry.cpp:390:60: error: 'glSecondaryColor3f' was not declared in this scope
>        glSecondaryColor3f((1.0f / *a_q) / 255.0f, 0.0f, 0.0f);
>                                                             ^
> ../../src/Glitch64/OGLgeometry.cpp:392:62: error: 'glSecondaryColor3f' was not declared in this scope
>        glSecondaryColor3f((1.0f / *a_fog) / 255.0f, 0.0f, 0.0f);
                                                              ^

This problem is here since SDL 2.0.4. And users also reported this problem outside of MXE (with MSYS2 as shown in  https://github.com/mupen64plus/mupen64plus-video-glide64mk2/issues/90).
Comment 1 Charlemagne Lasse 2017-11-06 10:35:10 UTC
Created attachment 3070 [details]
Revert of problematic commit which was taken from MXE
Comment 2 Sam Lantinga 2017-11-06 14:54:03 UTC
Ryan, can you review why we made that change and find a better solution than reverting the commit?
Comment 3 Ryan C. Gordon 2017-11-07 06:13:55 UTC
(In reply to Sam Lantinga from comment #2)
> Ryan, can you review why we made that change and find a better solution than
> reverting the commit?

The reason was that we kept having unreliable OpenGL system headers on various platforms.

I'll look into this more; we're definitely not going to revert this header outright.

--ryan.
Comment 4 Charlemagne Lasse 2017-12-03 16:30:59 UTC
Any updates? Would be really nice when SDL could be used again under windows with OpenGL extensions