[vlc-devel] [PATCH] nvdec: Avoid including glext.h if glew.h has been included

Martin Storsjö martin at martin.st
Mon Sep 23 10:01:38 CEST 2019

glew.h and glext.h conflict due to two legacy and unfinished
extensions with conflicting declarations of the same function
name but with differing types (where one clearly is wrong and
never can have been used in that form).

See https://github.com/nigels-com/glew/pull/239 for an upstream
patch to exclude the broken extension from glew.

This fixes build errors like these:
glext.h:12230:25: error: typedef redefinition with different types ('void (*)(GLenum, GLenum, GLint *)' (aka 'void (*)(unsigned int, unsigned int, int *)') vs 'void (*)(GLenum, GLenum, const GLint *)' (aka 'void (*)(unsigned int, unsigned int, const int *)'))
typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
glew.h:18744:28: note: previous definition is here
typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint* data);

Alternatively the glew package in contribs could be patched to
avoid conflicts.
 modules/hw/nvdec/nvdec_gl.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/hw/nvdec/nvdec_gl.c b/modules/hw/nvdec/nvdec_gl.c
index 6ebf845597..0259ea2bb0 100644
--- a/modules/hw/nvdec/nvdec_gl.c
+++ b/modules/hw/nvdec/nvdec_gl.c
@@ -35,7 +35,11 @@
 #include "nvdec_fmt.h"
 #include "../../video_output/opengl/internal.h"
-#include <GL/glext.h>
+// glew.h conflicts with glext.h, but also makes glext.h unnecessary.
+#ifndef __GLEW_H__
+#  include <GL/glext.h>
 static int Open(vlc_object_t *);
 static void Close(vlc_object_t *);

More information about the vlc-devel mailing list