ShivaVG
ShivaVG copied to clipboard
Undefined GLEXT symbols when compiling
Problem:
on recent Arch linux, this isn't compiling as-is. Basically problem finding the symbol definition of GLintptr
(error: unknown type name 'GLintptr'
). Googling this found a similar problem filed on libreoffice. That ticket pointed to GL_GLEXT_LEGACY
being defined, having an effect on all this. And in this project, in src/sdDefs.h
it is defined for non-windows, non-apple platforms.
Steps to reproduce:
sh autogen.sh
./configure
make
Platform info (I don't know what's relevant):
GLX version: 1.4 GL_GLEXT_VERSION (found in /usr/include/glext.h): 20140810 OpenGL version string: 4.4.0 NVIDIA 343.22 Kernel: 3.17.1
Full error:
make all-recursive
make[1]: Entering directory '/home/dan/tmp/ShivaVG'
Making all in src
make[2]: Entering directory '/home/dan/tmp/ShivaVG/src'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -ansi -pedantic -I../include/vg -INONE/include -MT libOpenVG_la-shExtensions.lo -MD -MP -MF .deps/libOpenVG_la-shExtensions.Tpo -c -o libOpenVG_la-shExtensions.lo `test -f 'shExtensions.c' || echo './'`shExtensions.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -ansi -pedantic -I../include/vg -INONE/include -MT libOpenVG_la-shExtensions.lo -MD -MP -MF .deps/libOpenVG_la-shExtensions.Tpo -c shExtensions.c -fPIC -DPIC -o .libs/libOpenVG_la-shExtensions.o
In file included from /usr/include/GL/glx.h:333:0,
from shDefs.h:170,
from shExtensions.c:23:
/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);
^
/usr/include/GL/glxext.h:480:164: error: unknown type name 'GLintptr'
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
^
/usr/include/GL/glxext.h:480:186: error: unknown type name 'GLsizeiptr'
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
^
/usr/include/GL/glxext.h:481:148: error: unknown type name 'GLintptr'
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
^
/usr/include/GL/glxext.h:481:169: error: unknown type name 'GLintptr'
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
^
/usr/include/GL/glxext.h:481:191: error: unknown type name 'GLsizeiptr'
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
^
Makefile:459: recipe for target 'libOpenVG_la-shExtensions.lo' failed
make[2]: *** [libOpenVG_la-shExtensions.lo] Error 1
make[2]: Leaving directory '/home/dan/tmp/ShivaVG/src'
Makefile:393: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/dan/tmp/ShivaVG'
Makefile:324: recipe for target 'all' failed
make: *** [all] Error 2
Fix (for me at least, not sure if this is a total fix)
diff --git a/src/shDefs.h b/src/shDefs.h
index 502ee30..dea34bf 100644
--- a/src/shDefs.h
+++ b/src/shDefs.h
@@ -166,6 +166,7 @@ SHfloat getMaxFloat();
#else
# define GL_GLEXT_LEGACY /* don't include glext.h */
# include <GL/gl.h>
+# include <GL/glext.h>
# include <GL/glu.h>
# include <GL/glx.h>
#endif
I'd issue a PR with this, but the comment above it literally says not to do this. So I'm not sure if this should be the permanent fix.
Huh, it explicitly says /* don't include glext.h */
but without glext.h
it doesn't compiles under linux indeed. I wonder what was the reason behind this comment.
Ok, here's the real fix:
#else
# include <GL/gl.h>
# include <GL/glu.h>
# define GL_GLEXT_LEGACY /* don't include glext.h */
# include <GL/glx.h>
#endif
The original developer placed definition on the wrong line, you should define it just after glx.h
inclusion.