Bug 1662778

Summary: SDL_opengl.h redefines GL_GLEXT_VERSION
Product: [Fedora] Fedora Reporter: Andrew Schultz <ajschult784>
Component: SDLAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: ppisar, twoerner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: SDL-1.2.15-35.fc30 SDL-1.2.15-35.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-01-18 02:13:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrew Schultz 2019-01-01 22:31:36 UTC
Description of problem:
When trying to compile a program that includes SDL_opengl.h, I get a warning (or an error with -Werror) about "GL_GLEXT_VERSION" redefined:

In file included from src/Basescape/../Engine/OpenGL.h:14,
                 from src/Basescape/../Engine/Screen.h:22,
                 from src/Basescape/CraftEquipmentState.cpp:23:
/usr/include/SDL/SDL_opengl.h:116: error: "GL_GLEXT_VERSION" redefined [-Werror]
 #define GL_GLEXT_VERSION 29
 
In file included from /usr/include/GL/gl.h:2055,
                 from /usr/include/SDL/SDL_opengl.h:46,
                 from src/Basescape/../Engine/OpenGL.h:14,
                 from src/Basescape/../Engine/Screen.h:22,
                 from src/Basescape/CraftEquipmentState.cpp:23:
/usr/include/GL/glext.h:54: note: this is the location of the previous definition
 #define GL_GLEXT_VERSION 20180725

This from attempting to compile OpenXcom
https://github.com/SupSuper/OpenXcom

I can get it to compile by dropping -Werror, but it seems there are real problems.  SDL_opengl.h attempts to suppress inclusion of glext.h on line 37

#define __glext_h_  /* Don't let gl.h include glext.h */

That doesn't work.  glext.h checks __gl_glext_h_

Version-Release number of selected component (if applicable):
SDL-devel-1.2.15-33.fc29.x86_64
mesa-libGL-devel-18.2.8-1.fc29.x86_64

This used to work, but I don't know if this broke because of changes to SDL or mesa.

Comment 1 Petr Pisar 2019-01-02 16:23:24 UTC
There was no change in SDL in Fedora 28. This has to be triggered by some mesa update.

I will try to find a fix, but since SDL is completely dead, I recommend you to migrate to SDL2. There is a zero chance my fix will get into the SDL upstream and from there to other distributions.

Affected versions in Fedora 30:

SDL-1.2.15-34.fc30.x86_64
mesa-libGL-devel-18.3.1-3.fc30.x86_64

Reproducer:

[test@fedora-30 tmp]$ printf '#include <SDL_opengl.h>\n' | gcc $(sdl-config --cflags) -x c -c - 
In file included from <stdin>:1:
/usr/include/SDL/SDL_opengl.h:116: warning: "GL_GLEXT_VERSION" redefined
 #define GL_GLEXT_VERSION 29
 
In file included from /usr/include/GL/gl.h:2055,
                 from /usr/include/SDL/SDL_opengl.h:46,
                 from <stdin>:1:
/usr/include/GL/glext.h:54: note: this is the location of the previous definition
 #define GL_GLEXT_VERSION 20180725

Comment 2 Petr Pisar 2019-01-14 11:39:15 UTC
This is triggered by upgrading mesa-libGL-devel from 18.2.4-2.fc29 to 18.2.6-1.fc29.

Comment 3 Petr Pisar 2019-01-14 12:32:24 UTC
The cause is that SDL contains a copy of glext.h because some systems are delivered without it. The bundled copy then conflicts with a version provided by a system (mesa-libGL-devel package).

I will fix in Fedora ≥ 29 it by disabling the bundled copy, so that only the system one is used.

Comment 4 Fedora Update System 2019-01-14 13:43:11 UTC
SDL-1.2.15-35.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2cc409f1ce

Comment 5 Fedora Update System 2019-01-15 02:23:29 UTC
SDL-1.2.15-35.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-2cc409f1ce

Comment 6 Fedora Update System 2019-01-18 02:13:22 UTC
SDL-1.2.15-35.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.