Error building SDL2 [unix]

I’m trying to build SDL2 (hg changeset 7696), but I’m having errors compiling ‘SDL_video.c’:

Code:

libtool: compile: gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude -I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c /home/aggelos/projects/SDL/src/video/SDL_video.c -fPIC -DPIC -o build/.libs/SDL_video.o
In file included from /home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from /home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous declaration of ‘GLintptr’ was here
In file included from /home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from /home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with ‘SDL_opengles2.h’, which in turn causes double definitions. It’s funny though cause this morning ( 5-6 changesets behind) I successfully built the library.

Cheers,
Aggelos Kolaitis------------------------
C is the God’s Programming Language

2013/8/24 neoaggelos

**
I’m trying to build SDL2 (hg changeset 7696), but I’m having errors
compiling ‘SDL_video.c’:

Code:

libtool: compile: gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude
-I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse
-fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0
-I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT
-DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c
/home/aggelos/projects/SDL/src/video/SDL_video.c -fPIC -DPIC -o
build/.libs/SDL_video.o
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous
declaration of ‘GLintptr’ was here
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous
declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with
’SDL_opengles2.h’, which in turn causes double definitions. It’s funny
though cause this morning ( 5-6 changesets behind) I successfully built the
library.

Cheers,
Aggelos Kolaitis

I’m seeing this too, I think it’s not a change on SDL that triggered this
error on your system but rather that you probably installed the GL ES2
headers. From a quick googling, it also seems to be a common problem when
including both GL and GL ES2 headers in a x86 system (not an issue on 64
bits).

Can you try changing in SDLvideo.c, line 42, from

#if SDL_VIDEO_OPENGL_ES2

to

#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL

If this works for you I’ll commit the fix.

BTW, the reason why this doesn’t show in the Buildbot is because it doesn’t
have the ES headers installed (Ryan was working on it though). See here:
http://buildbot.libsdl.org/builders/sdl-linux-x86/builds/1315/steps/configure/logs/stdio--
Gabriel.

gabomdq wrote:

2013/8/24 neoaggelos <@Aggelos_Kolaitis (@Aggelos_Kolaitis)>

   	I'm trying to build SDL2 (hg changeset 7696), but I'm having errors compiling 'SDL_video.c':




Code:

libtool: compile:? gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude -I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT -DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c /home/aggelos/projects/SDL/src/video/SDL_video.c? -fPIC -DPIC -o build/.libs/SDL_video.o
In file included from /home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
? ? ? ? ? ? ? ? ?from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from /home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous declaration of ‘GLintptr’ was here
In file included from /home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
? ? ? ? ? ? ? ? ?from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from /home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with ‘SDL_opengles2.h’, which in turn causes double definitions. It’s funny though cause this morning ( 5-6 changesets behind) I successfully built the library.

Cheers,
Aggelos Kolaitis

I’m seeing this too, I think it’s not a change on SDL that triggered this error on your system but rather that you probably installed the GL ES2 headers. From a quick googling, it also seems to be a common problem when including both GL and GL ES2 headers in a x86 system (not an issue on 64 bits).

Can you try changing in SDLvideo.c, line 42, from?

#if SDL_VIDEO_OPENGL_ES2 ?

to?

#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL

If this works for you I’ll commit the fix.

BTW, the reason why this doesn’t show in the Buildbot is because it doesn’t have the ES headers installed (Ryan was working on it though). See here:?http://buildbot.libsdl.org/builders/sdl-linux-x86/builds/1315/steps/configure/logs/stdio (http://buildbot.libsdl.org/builders/sdl-linux-x86/builds/1315/steps/configure/logs/stdio)


Gabriel.

Yeah, I have the GLES2 headers, and that’s why I said that the double definitions happen. And even if I add ‘&& !SDL_VIDEO_OPENGL’, this should be added for the GLES1 headers, too.

BUT, in the past ( 5-6 hours ago :stuck_out_tongue: ), I successfully built SDL (with GL ES headers, of course).

Anyway, the proposed solution is just a work-around, and could cause problems eventually ??? If an expert can assure that not adding the GL ES 2 headers in favor of the OpenGL ones is ok, well, that’s the way to go

Cheers,
Aggelos Kolaitis------------------------
C is the God’s Programming Language

2013/8/24 neoaggelos

**

gabomdq wrote:

2013/8/24 neoaggelos <>

Quote:

I’m trying to build SDL2 (hg changeset 7696), but I’m having errors
compiling ‘SDL_video.c’:

Code:

libtool: compile: gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude
-I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse
-fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0
-I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT
-DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c
/home/aggelos/projects/SDL/src/video/SDL_video.c -fPIC -DPIC -o
build/.libs/SDL_video.o
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous
declaration of ‘GLintptr’ was here
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous
declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with
’SDL_opengles2.h’, which in turn causes double definitions. It’s funny
though cause this morning ( 5-6 changesets behind) I successfully built the
library.

Cheers,
Aggelos Kolaitis

I’m seeing this too, I think it’s not a change on SDL that triggered this
error on your system but rather that you probably installed the GL ES2
headers. From a quick googling, it also seems to be a common problem when
including both GL and GL ES2 headers in a x86 system (not an issue on 64
bits).

Can you try changing in SDLvideo.c, line 42, from

#if SDL_VIDEO_OPENGL_ES2

to

#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL

If this works for you I’ll commit the fix.

BTW, the reason why this doesn’t show in the Buildbot is because it
doesn’t have the ES headers installed (Ryan was working on it though). See
here:
http://buildbot.libsdl.org/builders/sdl-linux-x86/builds/1315/steps/configure/logs/stdio


Gabriel.

Yeah, I have the GLES2 headers, and that’s why I said that the double
definitions happen. And even if I add ‘&& !SDL_VIDEO_OPENGL’, this should
be added for the GLES1 headers, too.

No, there’s no conflict with the GLES1 headers, at least as far as I know.

BUT, in the past ( 5-6 hours ago :stuck_out_tongue: ), I successfully built SDL (with GL
ES headers, of course).

Anyway, the proposed solution is just a work-around, and could cause
problems eventually ??? If an expert can assure that not adding the GL ES
2 headers in favor of the OpenGL ones is ok, well, that’s the way to go

If you google the issue you’ll see the solution applied everywhere is to
avoid including both headers at the same time. SDL_video.c uses the gl
headers to probe for extensions, and it uses a tiny part of it actually (a
few types such as GLint, GLubyte), so much so that this probably can be
refactored to not include those headers at all or better yet moved into the
corresponding video backend. In the meantime, and while we wait for the
experts to arrive, the fix I gave you should probably solve the problem.–
Gabriel.

Hello!

It seems to happen with older compilers(and it AFAIK in C99 standard) - I
have this error when compiling with a gcc 4.51 toolchain laying around, but
4.7 doesn’t care about double definitions -

$ cat >test.c
typedef int XXX;
typedef int XXX;
int main(void){return 0;}
$ gcc test.c
$ gcc --version
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

KerimOn Sat, Aug 24, 2013 at 9:33 PM, neoaggelos wrote:

**
I’m trying to build SDL2 (hg changeset 7696), but I’m having errors
compiling ‘SDL_video.c’:

Code:

libtool: compile: gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude
-I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse
-fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0
-I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT
-DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c
/home/aggelos/projects/SDL/src/video/SDL_video.c -fPIC -DPIC -o
build/.libs/SDL_video.o
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous
declaration of ‘GLintptr’ was here
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous
declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with
’SDL_opengles2.h’, which in turn causes double definitions. It’s funny
though cause this morning ( 5-6 changesets behind) I successfully built the
library.

Cheers,
Aggelos Kolaitis


C is the God’s Programming Language


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I saw the error with gcc 4.7.3 Ubuntu 64, but only when using “-m32”

2013/8/27 Kerim Borchaev <kerim.borchaev at gmail.com>> Hello!

It seems to happen with older compilers(and it AFAIK in C99 standard) - I
have this error when compiling with a gcc 4.51 toolchain laying around, but
4.7 doesn’t care about double definitions -

$ cat >test.c
typedef int XXX;
typedef int XXX;
int main(void){return 0;}
$ gcc test.c
$ gcc --version
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3

Kerim

On Sat, Aug 24, 2013 at 9:33 PM, neoaggelos wrote:

**
I’m trying to build SDL2 (hg changeset 7696), but I’m having errors
compiling ‘SDL_video.c’:

Code:

libtool: compile: gcc -g -O3 -DUSING_GENERATED_CONFIG_H -Iinclude
-I/home/aggelos/projects/SDL/include -mmmx -m3dnow -msse
-fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0
-I/usr/lib/i386-linux-gnu/dbus-1.0/include -D_REENTRANT
-DHAVE_LINUX_VERSION_H -Wall -MMD -MT build/SDL_video.lo -c
/home/aggelos/projects/SDL/src/video/SDL_video.c -fPIC -DPIC -o
build/.libs/SDL_video.o
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:38:26: error: conflicting types for 'GLintptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5114:19: note: previous
declaration of ‘GLintptr’ was here
In file included from
/home/aggelos/projects/SDL/include/SDL_opengles2.h:32:0,
from /home/aggelos/projects/SDL/src/video/SDL_video.c:43:
/usr/include/GLES2/gl2.h:39:26: error: conflicting types for 'GLsizeiptr’
In file included from
/home/aggelos/projects/SDL/src/video/SDL_video.c:35:0:
/home/aggelos/projects/SDL/include/SDL_opengl.h:5115:19: note: previous
declaration of ‘GLsizeiptr’ was here
make: *** [build/SDL_video.lo] Error 1
make: *** Waiting for unfinished jobs…

What seems to cause the issue is including ‘SDL_opengl.h’ along with
’SDL_opengles2.h’, which in turn causes double definitions. It’s funny
though cause this morning ( 5-6 changesets behind) I successfully built the
library.

Cheers,
Aggelos Kolaitis


C is the God’s Programming Language


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Gabriel.