Bug 1221744

Summary: Mesa 24.0.3 breaks texlive build
Product: [openSUSE] openSUSE Tumbleweed Reporter: Stefan Dirsch <sndirsch>
Component: X.OrgAssignee: Stefan Dirsch <sndirsch>
Status: RESOLVED FIXED QA Contact: Gfx Bugs <gfx-bugs>
Severity: Normal    
Priority: P3 - Medium CC: otto.hollmann, werner
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stefan Dirsch 2024-03-20 09:23:25 UTC
Update from mesa 23.3.6 to Mesa 24.0.3 breaks texlive build

[  544s] In file included from glrender.h:64,
[  544s]                  from drawelement.h:22,
[  544s]                  from drawpath.h:11,
[  544s]                  from drawpath.cc:12:
[  544s] /usr/include/GL/osmesa.h:125:1: error: expected initializer before ‘OSMesaCreateContext’
[  544s]   125 | OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
[  544s]       | ^~~~~~~~~~~~~~~~~~~
[  544s] /usr/include/GL/osmesa.h:138:1: error: expected initializer before ‘OSMesaCreateContextExt’
[  544s]   138 | OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
[  544s]       | ^~~~~~~~~~~~~~~~~~~~~~
[  544s] /usr/include/GL/osmesa.h:167:1: error: expected initializer before ‘OSMesaCreateContextAttribs’
[  544s]   167 | OSMesaCreateContextAttribs( const int *attribList, OSMesaContext sharelist );
[  544s]       | ^~~~~~~~~~~~~~~~~~~~~~~~~~
Comment 1 Stefan Dirsch 2024-03-20 09:32:22 UTC
Seems related to this change

  https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26561

(changes GLAPIENTRY to APIENTRY)

But I don't understand why this change is an issue.

osmesa.h includes gl.h which does

  #define GLAPIENTRY

and later

  #ifndef APIENTRY
  #define APIENTRY GLAPIENTRY
  #endif
Comment 2 Stefan Dirsch 2024-03-20 09:34:03 UTC
https://build.opensuse.org/request/show/1159577
Comment 3 Dr. Werner Fink 2024-03-20 11:02:46 UTC
A simple

#ifndef APIENTRY
# error XXX
#endif

before line 124 in /usr/include/GL/osmesa.h shows

In file included from glrender.h:64,
                 from drawelement.h:22,
                 from drawpath.h:11,
                 from drawpath.cc:12:
/usr/include/GL/osmesa.h:125:3: error: #error XXX
  125 | # error XXX
      |   ^~~~~
/usr/include/GL/osmesa.h:128:1: error: expected initializer before 'OSMesaCreateContext'
  128 | OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
Comment 4 Dr. Werner Fink 2024-03-20 12:30:17 UTC
The problem seems to be glew-devel with its header

  /usr/include/GL/glew.h

which defines __gl_h_

  #define __gl_h_

causing in

  /usr/include/GL/osmesa.h

that the line

  #include <GL/gl.h>

becomes ignored due to the __gl_h_ check in gl.h

Beside this in line 26423 of

  /usr/include/GL/glew.h

there is

  #ifdef GLEW_APIENTRY_DEFINED
  #undef GLEW_APIENTRY_DEFINED
  #undef APIENTRY
  #endif

breaking any previous define of APIENTRY
Comment 5 Dr. Werner Fink 2024-03-20 12:34:18 UTC
Why is request rq#1146491 for glew still pending?
Comment 6 Stefan Dirsch 2024-03-20 12:44:13 UTC
(In reply to Dr. Werner Fink from comment #5)
> Why is request rq#1146491 for glew still pending?

Apparently changelog is missing. But I claim that rq#1146491 will not fix the issue.
Comment 7 Dr. Werner Fink 2024-03-20 12:46:37 UTC
Request #1159837
Comment 8 Stefan Dirsch 2024-03-20 13:12:00 UTC
Thanks a lot Werner. Could you still add the bugnumber to the changelog, please?
Comment 9 Stefan Dirsch 2024-03-20 14:14:38 UTC
(In reply to Stefan Dirsch from comment #8)
> Thanks a lot Werner. Could you still add the bugnumber to the changelog,
> please?

rq#1159858

Also the patch in rq#1159837  wasn't applied at all. It was not mentioned in specfile.
Comment 10 Stefan Dirsch 2024-03-20 14:15:18 UTC
Closing as fixed.