2019-08-23 15:34 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004208Spring engineLinuxpublic2018-02-13 01:39
Reporterapoleon 
Assigned ToKloot 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version95.0 
Target VersionFixed in Version 
Summary0004208: glshaderSource stub signature does not match that in <GL/glext.h>.
DescriptionWhile packaging the official Debian version of spring 95.0, I had to unbundle the libs under includes/GL and to use Debian's system libraries.

However then spring fails to build from source because the glshaderSource stub in headlessStubs/glstub.c is outdated.

I'm attaching a patch that resolved the issue.
TagsNo tags attached.
Checked infolog.txt for lua Errors
Attached Files
  • patch file icon glShaderSource.patch (1,190 bytes) 2013-12-13 16:29 -
    From: Markus Koschany <apo@gambaru.de>
    Date: Sun, 8 Dec 2013 18:05:52 +0100
    Subject: glShaderSource
    
    Fix glshaderSource stub signature to match that in <GL/glext.h>.
    Thanks to Colin Watson.
    ---
     rts/lib/headlessStubs/glstub.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/rts/lib/headlessStubs/glstub.c b/rts/lib/headlessStubs/glstub.c
    index 0d41f15..1ade8a3 100644
    --- a/rts/lib/headlessStubs/glstub.c
    +++ b/rts/lib/headlessStubs/glstub.c
    @@ -130,7 +130,7 @@ GLAPI void APIENTRY glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei *l
     GLAPI void APIENTRY glCompileShader(GLuint shader) {}
     GLAPI void APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint *params) {}
     GLAPI void APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog) {}
    -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length) {}
    +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length) {}
     
     GLAPI void APIENTRY glUniform1fARB(GLint location, GLfloat v0) {}
     GLAPI void APIENTRY glUniform2fARB(GLint location, GLfloat v0, GLfloat v1) {}
    
    patch file icon glShaderSource.patch (1,190 bytes) 2013-12-13 16:29 +
  • patch file icon fix-sdl-build.patch (4,519 bytes) 2013-12-14 11:28 -
    From: Markus Koschany <apo@gambaru.de>
    Date: Sun, 8 Dec 2013 17:30:03 +0100
    Subject: fix sdl build
    
    ---
     rts/builds/dedicated/CMakeLists.txt  | 18 ++----------------
     rts/builds/headless/CMakeLists.txt   | 21 +++------------------
     rts/lib/headlessStubs/CMakeLists.txt | 14 ++------------
     tools/unitsync/CMakeLists.txt        | 14 ++------------
     4 files changed, 9 insertions(+), 58 deletions(-)
    
    diff --git a/rts/builds/dedicated/CMakeLists.txt b/rts/builds/dedicated/CMakeLists.txt
    index ab8fbe8..b74a465 100644
    --- a/rts/builds/dedicated/CMakeLists.txt
    +++ b/rts/builds/dedicated/CMakeLists.txt
    @@ -37,22 +37,8 @@ IF    (UNIX AND NOT MINGW)
     	LIST(APPEND engineDedicatedLibraries dl)
     ENDIF (UNIX AND NOT MINGW)
     
    -IF    (MINGW OR APPLE)
    -	# Windows:
    -	# We still need these header files,
    -	# even if we are not going to link with SDL.
    -	# We have them available anyway (mingwlibs).
    -	# OS X:
    -	# Cocoa requires the SDL libary, whenever the SDL headers are used,
    -	# due to some #define magic, which is practically impossible to workaround.
    -	FIND_PACKAGE(SDL REQUIRED)
    -	INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    -ELSE  (MINGW OR APPLE)
    -	# Use a direct copy of the GL and SDL headers,
    -	# as these may not be available on headless systems.
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL)
    -ENDIF (MINGW OR APPLE)
    -
    +FIND_PACKAGE(SDL REQUIRED)
    +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
     
     ### Assemble the incude dirs
     INCLUDE_DIRECTORIES(${ENGINE_SRC_ROOT_DIR}/)
    diff --git a/rts/builds/headless/CMakeLists.txt b/rts/builds/headless/CMakeLists.txt
    index 38fbc64..72e96b5 100644
    --- a/rts/builds/headless/CMakeLists.txt
    +++ b/rts/builds/headless/CMakeLists.txt
    @@ -12,24 +12,9 @@ ADD_DEFINITIONS(-DNO_SOUND)
     ADD_DEFINITIONS(-DBITMAP_NO_OPENGL)
     REMOVE_DEFINITIONS(-DAVI_CAPTURING)
     
    -IF    (MINGW OR APPLE)
    -	# Windows:
    -	# We still need these header files,
    -	# even if we are not going to link with gl, glu and SDL.
    -	# We have them available anyway (mingwlibs).
    -	# OS X:
    -	# Cocoa requires the SDL libary, whenever the SDL headers are used,
    -	# due to some #define magic, which is practically impossible to workaround.
    -	FIND_PACKAGE(OpenGL REQUIRED)
    -	FIND_PACKAGE(SDL REQUIRED)
    -	INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    -ELSE  (MINGW OR APPLE)
    -	# Use a direct copy of the GL and SDL headers,
    -	# as these may not be available on headless systems.
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL)
    -ENDIF (MINGW OR APPLE)
    -
    +FIND_PACKAGE(OpenGL REQUIRED)
    +FIND_PACKAGE(SDL REQUIRED)
    +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
     
     # headlessstubs are our stubs that replace libGL, libGLU, libGLEW, libSDL (yes really!)
     LIST(APPEND engineHeadlessLibraries headlessStubs)
    diff --git a/rts/lib/headlessStubs/CMakeLists.txt b/rts/lib/headlessStubs/CMakeLists.txt
    index fa63b41..77eaa20 100644
    --- a/rts/lib/headlessStubs/CMakeLists.txt
    +++ b/rts/lib/headlessStubs/CMakeLists.txt
    @@ -6,18 +6,8 @@ SET(headlessStubsSources
     		"sdlstub_cppbit"
     	)
     
    -IF    (WIN32)
    -	# We still need these header files,
    -	# even if we are not going to link with SDL.
    -	# We have them available anyway (mingwlibs).
    -	FIND_PACKAGE(SDL REQUIRED)
    -	INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    -ELSE  (WIN32)
    -	# Use a direct copy of the GL and SDL headers,
    -	# as these may not be available on headless systems.
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL)
    -ENDIF (WIN32)
    +FIND_PACKAGE(SDL_REQUIRED)
    +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
     
     ADD_LIBRARY(headlessStubs STATIC EXCLUDE_FROM_ALL ${headlessStubsSources})
     TARGET_LINK_LIBRARIES(headlessStubs ${Boost_THREAD_LIBRARY} ${Boost_CHRONO_LIBRARY_WITH_RT})
    diff --git a/tools/unitsync/CMakeLists.txt b/tools/unitsync/CMakeLists.txt
    index 2027362..a7a1815 100644
    --- a/tools/unitsync/CMakeLists.txt
    +++ b/tools/unitsync/CMakeLists.txt
    @@ -21,18 +21,8 @@ IF (WIN32)
     	LIST(APPEND unitsync_libs ${WINMM_LIBRARY})
     ENDIF (WIN32)
     
    -IF    (MINGW)
    -	# We still need these header files,
    -	# even if we are not going to link with SDL.
    -	# We have them available anyway (mingwlibs).
    -	FIND_PACKAGE(SDL REQUIRED)
    -	INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    -ELSE  (MINGW)
    -	# Use a direct copy of the GL and SDL headers,
    -	# as these may not be available on headless systems.
    -	INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/SDL)
    -ENDIF (MINGW)
    -
    +FIND_PACKAGE(SDL REQUIRED)
    +INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
     
     ADD_DEFINITIONS(-DUNITSYNC)
     ADD_DEFINITIONS(${PIC_FLAG})
    
    patch file icon fix-sdl-build.patch (4,519 bytes) 2013-12-14 11:28 +

-Relationships
related to 0005033resolvedjK Dedicated / headless builds still need glu.h 
+Relationships

-Notes

~0012377

jK (developer)

The files under include/* are fallbacks (esp. for headless build).
Spring already uses your syslibs when available.

~0012383

apoleon (reporter)

Hmm, interesting. Unfortunately I can't confirm this here for my local build. To reproduce the issue you can remove the complete include/* folder and try to build spring only with system libraries on Debian such as libsdl1.2-dev and libopenal-dev. Spring will FTBFS because of two distinct issues:

1. The buildsystem can't detect the correct include path for the SDL.h header files and errors out in rts/lib/headlessStubs/sdlstub.c for example. In Debian there is currently a patch in place to detect the correct SDL include path. I'm attaching this patch. (It could probably be improved). I'm using the default values of the buildsystem thus I get spring, spring-dedicated and spring-headless in the end.

2. The second one is the already reported glShaderSource bug.

~0012385

jK (developer)

Last edited: 2013-12-14 13:16

View 3 revisions

> The files under include/* are fallbacks (>>esp. for headless build<<).
The errors you get are from the headless build, which is a build without visual output (used for buildbot validation tests, AI testing, dedicated servers with AI support, ...). It uses `stubs` for SDL & GL, so we don't need heavy ifdef-flagging of all rendering code.
It uses just uses the Headers of those libraries, it doesn't link SDL, GL nor OpenAL.

~0012386

apoleon (reporter)

I think I understand the reasoning for the headless build. What I don't understand is why you include those header files at all. I have compared SDL.h in the include directory with the SDL.h version currently shipped with Debian. They are almost identical and the differences are just marginal.

So the build fails because it requires the header files in include to be present but this seems redundant because almost the same header files are present as system libraries.

I suggest that the headless build should not assume that the header files are in include/SDL or include/GL but in /usr/include/SDL/ and should be updated so that glShaderSource is up-to-date with current releases of SDL. I can confirm that both patch addresses this issue.

~0012387

jK (developer)

Last edited: 2013-12-14 14:50

View 5 revisions

> I think I understand the reasoning for the headless build. What I don't understand is why you include those header files at all. I have compared SDL.h in the include directory with the SDL.h version currently shipped with Debian. They are almost identical and the differences are just marginal.

The reasoning is that you want to be able to compile headless builds w/o having any of these libs installed (e.g. you compile headless often on pure servers with just ssh access and no gpu at all).
-> it doesn't link any of these libs, so why should you install them to compile a binary that doesn't link those? esp. when those libs got a HUGE list of dependencies and always result in a full x11 install.

~0012412

apoleon (reporter)

I still don't understand the reasoning. Debian builds spring always on headless servers without gpu, even without internet access. It's true that a lot of dependencies are pulled in but you can mitigate that by using a chroot-environment such as sbuild, pbuilder or cowbuilder for Debian.

So in fact you just have to spend a little bit of disk space but you ensure that you are always compatible with the upstream header files of AL, GL and SDL. That's a huge benefit and you can avoid convenience copies and you still get a synced build.

~0018804

Kloot (developer)

the headless GL headers were updated for 104, resolved afaict.
+Notes

-Issue History
Date Modified Username Field Change
2013-12-13 16:29 apoleon New Issue
2013-12-13 16:29 apoleon File Added: glShaderSource.patch
2013-12-14 00:30 jK Note Added: 0012377
2013-12-14 11:28 apoleon File Added: fix-sdl-build.patch
2013-12-14 11:29 apoleon Note Added: 0012383
2013-12-14 13:14 jK Note Added: 0012385
2013-12-14 13:15 jK Note Edited: 0012385 View Revisions
2013-12-14 13:16 jK Note Edited: 0012385 View Revisions
2013-12-14 14:40 apoleon Note Added: 0012386
2013-12-14 14:44 jK Note Added: 0012387
2013-12-14 14:44 jK Note Edited: 0012387 View Revisions
2013-12-14 14:45 jK Note Edited: 0012387 View Revisions
2013-12-14 14:46 jK Note Edited: 0012387 View Revisions
2013-12-14 14:50 jK Note Edited: 0012387 View Revisions
2013-12-16 19:02 apoleon Note Added: 0012412
2016-01-13 14:33 abma Relationship added related to 0005033
2018-02-13 01:39 Kloot Assigned To => Kloot
2018-02-13 01:39 Kloot Status new => resolved
2018-02-13 01:39 Kloot Resolution open => fixed
2018-02-13 01:39 Kloot Note Added: 0018804
+Issue History