Bug 83631 - /usr/include/GL/glxext.h:480:143: error: 'GLintptr' has not been declared
Summary: /usr/include/GL/glxext.h:480:143: error: 'GLintptr' has not been declared
Status: RESOLVED WORKSFORME
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLX (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-08 21:21 UTC by Orion Poplawski
Modified: 2016-02-18 21:53 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Orion Poplawski 2014-09-08 21:21:20 UTC
Starting to see this in Fedora rawhide:

In file included from /usr/include/GL/glx.h:333:0,
                 from /builddir/build/BUILD/VTK-6.1.0/Rendering/OpenGL/vtkXOpenGLRenderWindow.cxx:31:
/usr/include/GL/glxext.h:480:143: error: 'GLintptr' has not been declared

Seems like GL should have defined that.

Version-Release number of selected component (if applicable):
mesa-libGL-devel-10.4-0.devel.2.1.80771e47b6c1e47ab55f17311e1d4e227a9eb3d8.fc22.x86_64
Comment 1 Brian Paul 2014-09-08 22:30:15 UTC
Which version of glext.h (look for "GL_GLEXT_VERSION")?

In version 20140810 it's defined on line 469:

typedef ptrdiff_t GLintptr;
Comment 2 Orion Poplawski 2014-09-08 22:48:10 UTC
/usr/include/GL/glext.h:#define GL_GLEXT_VERSION 20140810

But we're including "GL/glx.h" which includes "GL/glxext.h", not "GL/glext.h".  Too many x's floating around here.

# grep '^typedef .* GLintptr;' /usr/include/GL/*.h
/usr/include/GL/glcorearb.h:typedef ptrdiff_t GLintptr;
/usr/include/GL/glext.h:typedef ptrdiff_t GLintptr;

I'll keep digging.
Comment 3 Brian Paul 2014-09-11 17:56:52 UTC
#include "GL/glx.h" should pull in GL/gl.h (line 32) which should include GL/glext.h  So by time we hit the use of GLintptr, it should have been defined.

When I compile a trivial test program like this:

#include <GL/glx.h>
int main(void)
{
   GLintptr p;
   return 0;
}

it seems to work.
Comment 4 Orion Poplawski 2014-09-15 14:57:51 UTC
It seems that in GL/glx.h, GL/glext.h is only included when
GL_GLEXT_LEGACY is not defined (line 2049).
Unfortunatly, GL_GLEXT_LEGACY is defined in Rendering/OpenGL/vtkOpenGL.h 
(line 22) and 
vtkOpenGL.h is included in vtkXOpenGLRenderWindow.cxx that makes GL/glext.h 
not included and GLintptr not declared.

This seems a little strange to me.
Comment 5 Orion Poplawski 2014-09-16 00:03:31 UTC
So, make the test:

$ cat gltest.c
#define GL_GLEXT_LEGACY
#include <GL/glx.h>
int main(void)
{
   GLintptr p;
   return 0;
}

$ gcc gltest.c
In file included from /usr/include/GL/glx.h:333:0,
                 from gltest.c:2:
/usr/include/GL/glxext.h:480:143: error: unknown type name ‘GLintptr’
 typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
                                                                                                                                               ^
....


Now, I suppose it is kind of strange to define GL_GLEXT_LEGACY (not GLXEXT) and then include glx.h, but...
Comment 6 abortretryfail 2014-09-17 01:16:01 UTC
I ran in to this problem trying to build OpenCASCADE for FreeCAD. Not sure if this is helpful or not, but the comment there says:

// exclude modern definitions and system-provided glext.h, should be defined before gl.h inclusion
#define GL_GLEXT_LEGACY
Comment 7 Tim Ruhland 2014-10-03 06:50:48 UTC
I too ran into this bug when trying to install opencascade for freecad on Arch linux.

I added the following typedefs to a section of code that had been added in 10.3:
# diff glxext.h.saved glxext.h
479a480,481
> typedef ptrdiff_t GLsizeiptr;
> typedef ptrdiff_t GLintptr;

opencascade then compiled, installed with no issues.
Comment 8 Emil Velikov 2015-07-20 16:48:48 UTC
With all due respect guys, should one take a closer look and remove the need for GL_GLEXT_LEGACY and its friends GL_GLEXT_PROTOTYPES/GLX_GLXEXT_PROTOTYPES.

Iirc those were added as a workaround for ABI non-compliant users some ~10 years ago.

Dropping the defines and fixing the build issues (not too many, I hope) seems like a better solution than adding another workaround/hack.
Comment 9 Ian Romanick 2015-07-20 18:32:20 UTC
Emil is correct.  If your code defines GL_EXT_LEGACY you are also certainly doing it wrong.

What happens if you remove that define from your build?
Comment 10 Orion Poplawski 2016-02-18 21:53:35 UTC
Seems to be working now.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.