can't someone conditionalize the code
By the look of things, Im guessing that that 'someone' would have to be you
]]>I had the same problem when compiling desmume, after a tries i compiled it successful (at least it seems to work). Now i'm testing to see if it works correctly.
I modified some lines from OGLRender.cpp, this is the patch
I'm using here Gobolinux and Nvidia drivers + Mesa library
[patch]
--- desmume-0.9.4/src/OGLRender.cpp 2009-07-08 05:11:01.000000000 -0300
+++ desmume-0.9.4-fixed/src/OGLRender.cpp 2009-09-06 09:45:35.000000000 -0300
@@ -27,6 +27,8 @@
#include "OGLRender.h"
#include "debug.h"
+#define GL_GLEXT_PROTOTYPES
+
bool (*oglrender_init)() = 0;
bool (*oglrender_beginOpenGL)() = 0;
void (*oglrender_endOpenGL)() = 0;
@@ -105,7 +107,7 @@
#include <GL/glx.h>
#define INITOGLEXT(x,y) y = (x)glXGetProcAddress((const GLubyte *) #y);
#endif
-
+/*
#ifndef DESMUME_COCOA
OGLEXT(PFNGLCREATESHADERPROC,glCreateShader)
//zero: i dont understand this at all. my glext.h has the wrong thing declared here... so I have to do it myself
@@ -129,6 +131,7 @@
OGLEXT(PFNGLUNIFORM1IPROC,glUniform1i)
OGLEXT(PFNGLUNIFORM1IVPROC,glUniform1iv)
#endif
+*/
#if !defined(GL_VERSION_1_3) || defined(_MSC_VER) || defined(__INTEL_COMPILER)
OGLEXT(PFNGLACTIVETEXTUREPROC,glActiveTexture)
@@ -412,7 +415,7 @@
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#ifndef DESMUME_COCOA
- INITOGLEXT(PFNGLCREATESHADERPROC,glCreateShader)
+/* INITOGLEXT(PFNGLCREATESHADERPROC,glCreateShader)
INITOGLEXT(X_PFNGLGETSHADERSOURCEPROC,glShaderSource)
INITOGLEXT(PFNGLCOMPILESHADERPROC,glCompileShader)
INITOGLEXT(PFNGLCREATEPROGRAMPROC,glCreateProgram)
@@ -426,15 +429,17 @@
INITOGLEXT(PFNGLDELETEPROGRAMPROC,glDeleteProgram)
INITOGLEXT(PFNGLGETPROGRAMIVPROC,glGetProgramiv)
INITOGLEXT(PFNGLGETPROGRAMINFOLOGPROC,glGetProgramInfoLog)
- INITOGLEXT(PFNGLVALIDATEPROGRAMPROC,glValidateProgram)
+ INITOGLEXT(PFNGLVALIDATEPROGRAMPROC,glValidateProgram)*/
#ifdef HAVE_LIBOSMESA
glBlendFuncSeparateEXT = NULL;
#else
- INITOGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC,glBlendFuncSeparateEXT)
+// INITOGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC,glBlendFuncSeparateEXT)
#endif
- INITOGLEXT(PFNGLGETUNIFORMLOCATIONPROC,glGetUniformLocation)
+ /*
+ INITOGLEXT(PFNGLGETUNIFORMLOCATIONPROC,glGetUniformLocation)
INITOGLEXT(PFNGLUNIFORM1IPROC,glUniform1i)
INITOGLEXT(PFNGLUNIFORM1IVPROC,glUniform1iv)
+ */
#endif
#if !defined(GL_VERSION_1_3) || defined(_MSC_VER) || defined(__INTEL_COMPILER)
INITOGLEXT(PFNGLACTIVETEXTUREPROC,glActiveTexture)
~
[end patch]
Greets.
]]>Since I couldn't find the solution thaeron and guillaume are talking about, I found one for myself and wanted to share it with all the other Gentoo guys:
Instead of re-compiling xorg, you can just use eselect (package app-admin/eselect):
eselect opengl set xorg-x11
emerge -DuNa1 desmume
eselect opengl set nvidia
Hope it helps
Ice
]]>Found this in the Gentoo Bugzilla pages:
Seems to be a similar issue with OO.org. They recommend this for the Gentoo ebuild...not sure if it will help with the actual source but may be a step in the right direction.
Add this to src_compile() in the ebuild:
append-flags -DGL_GLEXT_PROTOTYPES
Seems to be worth...
x86_64-linux-gnu-g++ -DGL_GLEXT_PROTOTYPES -DPACKAGE_NAME=\"desmume\" -DPACKAGE_TARNAME=\"desmume\" -DPACKAGE_VERSION=\"0.8\" -DPACKAGE_STRING=\"desmume\ 0.8\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"desmume\" -DVERSION=\"0.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBZ=1 -DHAVE_GL_GL_H=1 -DHAVE_GL_GLU_H=1 -DGLADEUI_UNINSTALLED_DIR=\"/home/perron/packages/desmume/svn/trunk/desmume/src/gtk-glade/glade/\" -DGTKGLEXT_AVAILABLE=1 -DGETTEXT_PACKAGE=\"desmume\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I../src -g -O2 -MT OGLRender.o -MD -MP -MF .deps/OGLRender.Tpo -c -o OGLRender.o OGLRender.cpp
OGLRender.cpp:234: error: 'GLuint (* glCreateShader)(GLenum)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4198: error: previous declaration of 'GLuint glCreateShader(GLenum)'
OGLRender.cpp:237: error: 'void (* glShaderSource)(GLuint, GLsizei, const GLchar**, GLsizei*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4223: error: previous declaration of 'void glShaderSource(GLuint, GLsizei, const GLchar**, const GLint*)'
OGLRender.cpp:238: error: 'void (* glCompileShader)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4196: error: previous declaration of 'void glCompileShader(GLuint)'
OGLRender.cpp:239: error: 'GLuint (* glCreateProgram)()' redeclared as different kind of symbol
/usr/include/GL/glext.h:4197: error: previous declaration of 'GLuint glCreateProgram()'
OGLRender.cpp:240: error: 'void (* glAttachShader)(GLuint, GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4194: error: previous declaration of 'void glAttachShader(GLuint, GLuint)'
OGLRender.cpp:241: error: 'void (* glDetachShader)(GLuint, GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4201: error: previous declaration of 'void glDetachShader(GLuint, GLuint)'
OGLRender.cpp:242: error: 'void (* glLinkProgram)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4222: error: previous declaration of 'void glLinkProgram(GLuint)'
OGLRender.cpp:243: error: 'void (* glUseProgram)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4224: error: previous declaration of 'void glUseProgram(GLuint)'
OGLRender.cpp:244: error: 'void (* glGetShaderiv)(GLuint, GLenum, GLint*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4210: error: previous declaration of 'void glGetShaderiv(GLuint, GLenum, GLint*)'
OGLRender.cpp:245: error: 'void (* glGetShaderInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4211: error: previous declaration of 'void glGetShaderInfoLog(GLuint, GLsizei, GLsizei*, GLchar*)'
OGLRender.cpp:246: error: 'void (* glDeleteShader)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4200: error: previous declaration of 'void glDeleteShader(GLuint)'
OGLRender.cpp:247: error: 'void (* glDeleteProgram)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4199: error: previous declaration of 'void glDeleteProgram(GLuint)'
OGLRender.cpp:248: error: 'void (* glGetProgramiv)(GLuint, GLenum, GLint*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4208: error: previous declaration of 'void glGetProgramiv(GLuint, GLenum, GLint*)'
OGLRender.cpp:249: error: 'void (* glGetProgramInfoLog)(GLuint, GLsizei, GLsizei*, GLchar*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4209: error: previous declaration of 'void glGetProgramInfoLog(GLuint, GLsizei, GLsizei*, GLchar*)'
OGLRender.cpp:250: error: 'void (* glValidateProgram)(GLuint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4244: error: previous declaration of 'void glValidateProgram(GLuint)'
OGLRender.cpp:251: error: 'void (* glBlendFuncSeparateEXT)(GLenum, GLenum, GLenum, GLenum)' redeclared as different kind of symbol
/usr/include/GL/glext.h:6274: error: previous declaration of 'void glBlendFuncSeparateEXT(GLenum, GLenum, GLenum, GLenum)'
OGLRender.cpp:252: error: 'GLint (* glGetUniformLocation)(GLuint, const GLchar*)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4213: error: previous declaration of 'GLint glGetUniformLocation(GLuint, const GLchar*)'
OGLRender.cpp:253: error: 'void (* glUniform1i)(GLint, GLint)' redeclared as different kind of symbol
/usr/include/GL/glext.h:4229: error: previous declaration of 'void glUniform1i(GLint, GLint)'
OGLRender.cpp: In function 'char OGLInit()':
OGLRender.cpp:531: error: assignment of function 'GLuint glCreateShader(GLenum)'
OGLRender.cpp:531: error: cannot convert 'GLuint (*)(GLenum)' to 'GLuint ()(GLenum)' in assignment
OGLRender.cpp:532: error: assignment of function 'void glShaderSource(GLuint, GLsizei, const GLchar**, const GLint*)'
OGLRender.cpp:532: error: cannot convert 'void (*)(GLuint, GLsizei, const GLchar**, GLsizei*)' to 'void ()(GLuint, GLsizei, const GLchar**, const GLint*)' in assignment
OGLRender.cpp:533: error: assignment of function 'void glCompileShader(GLuint)'
OGLRender.cpp:533: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:534: error: assignment of function 'GLuint glCreateProgram()'
OGLRender.cpp:534: error: cannot convert 'GLuint (*)()' to 'GLuint ()()' in assignment
OGLRender.cpp:535: error: assignment of function 'void glAttachShader(GLuint, GLuint)'
OGLRender.cpp:535: error: cannot convert 'void (*)(GLuint, GLuint)' to 'void ()(GLuint, GLuint)' in assignment
OGLRender.cpp:536: error: assignment of function 'void glDetachShader(GLuint, GLuint)'
OGLRender.cpp:536: error: cannot convert 'void (*)(GLuint, GLuint)' to 'void ()(GLuint, GLuint)' in assignment
OGLRender.cpp:537: error: assignment of function 'void glLinkProgram(GLuint)'
OGLRender.cpp:537: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:538: error: assignment of function 'void glUseProgram(GLuint)'
OGLRender.cpp:538: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:539: error: assignment of function 'void glGetShaderiv(GLuint, GLenum, GLint*)'
OGLRender.cpp:539: error: cannot convert 'void (*)(GLuint, GLenum, GLint*)' to 'void ()(GLuint, GLenum, GLint*)' in assignment
OGLRender.cpp:540: error: assignment of function 'void glGetShaderInfoLog(GLuint, GLsizei, GLsizei*, GLchar*)'
OGLRender.cpp:540: error: cannot convert 'void (*)(GLuint, GLsizei, GLsizei*, GLchar*)' to 'void ()(GLuint, GLsizei, GLsizei*, GLchar*)' in assignment
OGLRender.cpp:541: error: assignment of function 'void glDeleteShader(GLuint)'
OGLRender.cpp:541: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:542: error: assignment of function 'void glDeleteProgram(GLuint)'
OGLRender.cpp:542: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:543: error: assignment of function 'void glGetProgramiv(GLuint, GLenum, GLint*)'
OGLRender.cpp:543: error: cannot convert 'void (*)(GLuint, GLenum, GLint*)' to 'void ()(GLuint, GLenum, GLint*)' in assignment
OGLRender.cpp:544: error: assignment of function 'void glGetProgramInfoLog(GLuint, GLsizei, GLsizei*, GLchar*)'
OGLRender.cpp:544: error: cannot convert 'void (*)(GLuint, GLsizei, GLsizei*, GLchar*)' to 'void ()(GLuint, GLsizei, GLsizei*, GLchar*)' in assignment
OGLRender.cpp:545: error: assignment of function 'void glValidateProgram(GLuint)'
OGLRender.cpp:545: error: cannot convert 'void (*)(GLuint)' to 'void ()(GLuint)' in assignment
OGLRender.cpp:549: error: assignment of function 'void glBlendFuncSeparateEXT(GLenum, GLenum, GLenum, GLenum)'
OGLRender.cpp:549: error: cannot convert 'void (*)(GLenum, GLenum, GLenum, GLenum)' to 'void ()(GLenum, GLenum, GLenum, GLenum)' in assignment
OGLRender.cpp:551: error: assignment of function 'GLint glGetUniformLocation(GLuint, const GLchar*)'
OGLRender.cpp:551: error: cannot convert 'GLint (*)(GLuint, const GLchar*)' to 'GLint ()(GLuint, const GLchar*)' in assignment
OGLRender.cpp:552: error: assignment of function 'void glUniform1i(GLint, GLint)'
OGLRender.cpp:552: error: cannot convert 'void (*)(GLint, GLint)' to 'void ()(GLint, GLint)' in assignment
Seems to be a similar issue with OO.org. They recommend this for the Gentoo ebuild...not sure if it will help with the actual source but may be a step in the right direction.
Add this to src_compile() in the ebuild:
append-flags -DGL_GLEXT_PROTOTYPES
First, config failed with: config.status: error: po/Makefile.in.in was not created by intltoolize.
I fixed this with $ ./autogen.sh
Then make failed with
...
...
In file included from OGLRender.h:25,
from OGLRender.cpp:27:
common.h:45:7: warning: no newline at end of file
OGLRender.cpp: In function 'char OGLInit()':
OGLRender.cpp:459: error: 'glActiveTexture' was not declared in this scope
OGLRender.cpp: In function 'void setTexture(unsigned int, unsigned int)':
OGLRender.cpp:572: error: 'glActiveTexture' was not declared in this scope
OGLRender.cpp: In function 'void OGLRender()':
OGLRender.cpp:1029: error: 'glActiveTexture' was not declared in this scope
make[2]: *** [OGLRender.o] Error 1
make[2]: Leaving directory `/home/khamar/tarballs/desmume-0.9/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/khamar/tarballs/desmume-0.9/src'
make: *** [all-recursive] Error 1
I added void glActiveTexture(GLenum texture); in OGLRender.cpp - but that made the make fail sooner with
...
g++ -DPACKAGE_NAME=\"desmume\" -DPACKAGE_TARNAME=\"desmume\" -DPACKAGE_VERSION=\"0.9\" -DPACKAGE_STRING=\"desmume\ 0.9\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"desmume\" -DVERSION=\"0.9\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_LIBZ=1 -DHAVE_GL_GL_H=1 -DHAVE_GL_GLU_H=1 -I. -I../src -g -O2 -MT OGLRender.o -MD -MP -MF .deps/OGLRender.Tpo -c -o OGLRender.o OGLRender.cpp
In file included from OGLRender.h:25,
from OGLRender.cpp:27:
common.h:45:7: warning: no newline at end of file
OGLRender.cpp:34: error: variable or field 'glActiveTexture' declared void
OGLRender.cpp:34: error: 'GLenum' was not declared in this scope
OGLRender.cpp: In function 'char OGLInit()':
OGLRender.cpp:460: error: 'glActiveTexture' cannot be used as a function
OGLRender.cpp: In function 'void setTexture(unsigned int, unsigned int)':
OGLRender.cpp:573: error: 'glActiveTexture' cannot be used as a function
OGLRender.cpp: In function 'void OGLRender()':
OGLRender.cpp:1030: error: 'glActiveTexture' cannot be used as a function
make[2]: *** [OGLRender.o] Error 1
...
ANY IDEAS?
]]>It may just be a missing function definition, could you try to add that line:
void glActiveTexture(GLenum texture);
at the beginning of OGLRender.cpp (somewhere around the #include) and try recompiling?
]]>