2024-04-25 18:59 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004733Spring enginepublic2017-06-10 14:32
ReporterUnitedMarsupials 
Assigned TojK 
PrioritynormalSeverityfeatureReproducibilityalways
StatusassignedResolutionopen 
Product Version98.0 
Target VersionFixed in Version 
Summary0004733: remove include/* from spring repo
DescriptionTrying to compile rts/lib/headlessStubs/sdlstub.c without the top-level include/SDL subdirectory present causes an error:

/home/ports/games/spring/work/spring_98.0/rts/lib/headlessStubs/sdlstub.c:8:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
         ^
1 error generated.
Additional InformationFor some reason, the system's location of SDL.h is not added to the compiler's include-path. (Interestingly, glstub.c does not have this problem...)
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
has duplicate 0004731closedabma headlessStubs/glstub.c out of sync with the lastest GL/glext.h 
related to 0005033resolvedjK Dedicated / headless builds still need glu.h 
related to 0005611resolvedKloot wrong vram reported 
+Relationships

-Notes

~0014292

abma (administrator)

Last edited: 2015-04-08 20:47

View 2 revisions

because only sdlstub.c includes SDL.h?

we don't want to include system SDL.h because spring uses its own implementation for spring-headless.

whats the full path of system SDL.h?

~0014293

UnitedMarsupials (reporter)

Last edited: 2015-04-08 20:50

View 2 revisions

> we don't want to include system SDL.h because spring
> uses its own implementation for spring-headless.

Well, the implementation (definitions) can still be spring's own, but the declarations must be the same as the real SDL is using, or bad things are likely to happen...

> whats the full path of system SDL.h?

cmake is able to find it at configure-time -- and the headlessStubs/CMakeLists.txt is using it even:

FIND_PACKAGE(SDL2 REQUIRED)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})

but only in case of WIN32, for some reason, rather than always...

~0014295

abma (administrator)

for some reason we support spring-headless beeing built without SDL installed. on windows mingwlibs are used https://github.com/spring/mingwlibs which contains SDL2.h, i guess thats why this exception exists.

~0014298

UnitedMarsupials (reporter)

Here is another piece caught trying to use the bundled header-file:
/home/ports/games/spring/work/spring_98.0/rts/System/Platform/Linux/CrashHandler.cpp:19:10: fatal error: 'SDL_events.h' file not found
#include <SDL_events.h>
         ^
1 error generated.

Unlike headless stubs -- which should not even be necessary -- this has the real danger of getting out of sync with SDL2 causing bad things...

~0014299

UnitedMarsupials (reporter)

And another:

/home/ports/games/spring/work/spring_98.0/rts/Rendering/Textures/Bitmap.cpp:9:10: fatal error: 'SDL_video.h' file not found
#include <SDL_video.h>
         ^

~0014300

abma (administrator)

these files exist:
https://github.com/spring/spring/tree/develop/include/SDL2

are you compiling spring or spring-headless?

~0014301

abma (administrator)

Last edited: 2015-04-08 21:46

View 4 revisions

> whats the full path of system SDL.h?

that question is unanswered.

also whats the full output of a clean "cmake ." ?

for me it looks like you did something wrong at configure time or you hit some bug in springs CMakeLists.txt.

~0014302

UnitedMarsupials (reporter)

> these files exist

Yes, they exist. But if Spring's own copies of the headers are used, there may be a discrepancy between what the header advertises and what the library offers. For this reason -- unless compiling headless -- the bundled headers should not be used. I had them removed here deliberately to catch these errors.

> are you compiling spring or spring-headless?

spring (I think). Here is the full list of cmake-arguments used here:

-DDATADIR:STRING="share/spring" -DAI_TYPES:STRING="NATIVE" -DDOCDIR:STRING="share/doc/spring" -DCREATE_MAN_PAGES:BOOL=false -DUNITSYNC_PYTHON_WRAPPER:BOOL=false -DCUSTOM_CFLAGS:BOOL=true -DCREATE_MAN_PAGES:BOOL=true -DMANDIR:STRING="man" -DCMAKE_C_COMPILER:STRING="cc" -DCMAKE_CXX_COMPILER:STRING="c++" -DCMAKE_C_FLAGS:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing" -DCMAKE_C_FLAGS_DEBUG:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing" -DCMAKE_C_FLAGS_RELEASE:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing" -DCMAKE_CXX_FLAGS:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing -Wno-deprecated -std=c++11" -DCMAKE_CXX_FLAGS_DEBUG:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing -Wno-deprecated -std=c++11" -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O2 -pipe -march=core2 -fstack-protector -fno-strict-aliasing -Wno-deprecated -std=c++11" -DCMAKE_EXE_LINKER_FLAGS:STRING=" -fstack-protector" -DCMAKE_MODULE_LINKER_FLAGS:STRING=" -fstack-protector" -DCMAKE_SHARED_LINKER_FLAGS:STRING=" -fstack-protector" -DCMAKE_INSTALL_PREFIX:PATH="/opt" -DCMAKE_BUILD_TYPE:STRING="Release" -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES

> whats the full path of system SDL.h?

This question was answered: cmake is able to find it at configure-time.

Let me elaborate: on my system the location is /opt/include/SDL2/SDL.h. On a stock FreeBSD /usr/local is used instead of /opt, so it would be /usr/local/include/SDL2. But it does not matter, because, whatever the location is, spring's collection of cmake-files is able to find it -- it is just that the location is not always added to the compiler's include-path.

~0014304

abma (administrator)

> This question was answered: cmake is able to find it at configure-time.

no, it wasn't answered. in CMakeCache.txt, whats the value of SDL2_INCLUDE_DIR ? does it point to /opt/include/SDL2?

also, why is -DCUSTOM_CFLAGS:BOOL=true set? for me it looks like all parameters are from a very ancient version of spring. CUSTOM_CFLAGS doesn't exist any more. the cmake warning "Using custom CXX_FLAGS! this build will very likely not sync in online mode!" should NOT be ignored!!!

can freebsd compile with gcc? very likely when compiled with clang, it won't sync with gcc compiled spring.

~0014305

abma (administrator)

Last edited: 2015-04-09 03:40

View 2 revisions

> whatever the location is, spring's collection of cmake-files is able to find it -- it is just that the location is not always added to the compiler's include-path.

wrong:

https://github.com/spring/spring/blob/develop/rts/builds/legacy/CMakeLists.txt#L13

https://github.com/spring/spring/blob/develop/rts/builds/legacy/CMakeLists.txt#L82

(also side note: spring compiles on windows / linux / osx without any special hints to cmake, please stop guessing...)

~0014309

UnitedMarsupials (reporter)

> no, it wasn't answered.

I quoted the earlier answer. Why must you insist, white is black?

> in CMakeCache.txt, whats the value of SDL2_INCLUDE_DIR ?

This question has not been asked before. But you Here is the answer:

SDL2_INCLUDE_DIR:PATH=/opt/include/SDL2

> does it point to /opt/include/SDL2?

Yes. And you could've gotten this answer earlier, if you looked inside the spring-cmake-dot.txt , which I attached some 5 hours ago.

> wrong:

Those lines add SDL2-header locations to compiler in SOME cases. But not in ALL of them.

Once the bundled obsolete SDL2-headers are removed, the build breaks. The patch patch-use-system-sdl does the necesssary changes to have necessary flags on compiler's command-line everywhere.

I sense some irritation in your replies, so I'll just go away. Sorry to have disturbed your peace.

~0014310

UnitedMarsupials (reporter)

> also, why is -DCUSTOM_CFLAGS:BOOL=true set? for me it looks like all parameters > are from a very ancient version of spring.

Yes, indeed. The current (broken) version of FreeBSD port games/spring pulls in sources from 94.1. I'll be happy to clean-up the parameters.

> the cmake warning "Using custom CXX_FLAGS! this build will very likely
> not sync in online mode!" should NOT be ignored!!!

There is nothing special about the parameters -- everything on FreeBSD is compiled with such. If spring's code acts differently depending on optimization level, then it is broken :-(

> can freebsd compile with gcc? very likely when compiled with clang,
> it won't sync with gcc compiled spring.

As of release 10, FreeBSD standard base compiler is clang. Compiling with GNU is possible, but troublesome because, for example, Boost and Spring, apparently, must be compiled by the same compiler (whichever it is) and so on.

But all of the bundled tests pass, so, maybe, there is no need to worry?

~0014314

abma (administrator)

hm, we talked cross-purposes:

the included SDL.h is used when the headlessStubs is linked. so the benefit of using system installed SDL is just the code removal. but this pulles in the requirement for having SDL installed at build time when spring-headless & spring-dedicated is compiled.

when compiling "spring" the system installed sdl headers are used and libsdl is linked.

~0014317

abma (administrator)

i'm +1 for removing "duplicate" headers at the cost of adding the requirement for having SDL2 / glew / etc... libs installed at compile time.

afaik jk is one/the only one who is against removal of the headers, so the question goes to him:

any complains about removing these headers and not allow compile spring-headless / spring-dedicated without gfx-libraries installed?

afaik only in gentoo-packages this is used but in most cases the official static builds of spring/spring-dedicated/spring-headless could be used, so the need for allowing compile without SDL2+co installed is VERYVERY low.

~0014326

UnitedMarsupials (reporter)

Right. Having mock SDL.h may be fine, when ONLY the headless variant of spring is built (if it can not be helped, that SDL is required in such cases at all).

So it may make sense to keep the private copies of these headers around. But they should not be used, when compiling non-headless variant.

FreeBSD port always compiles both and so I took the liberty of simply excluding include/ at extract time. This allowed me to catch the few cases, where private headers were used without a good reason...
+Notes

-Issue History
Date Modified Username Field Change
2015-04-08 20:40 UnitedMarsupials New Issue
2015-04-08 20:45 abma Note Added: 0014292
2015-04-08 20:47 abma Note Edited: 0014292 View Revisions
2015-04-08 20:50 UnitedMarsupials Note Added: 0014293
2015-04-08 20:50 UnitedMarsupials Note Edited: 0014293 View Revisions
2015-04-08 20:57 abma Note Added: 0014295
2015-04-08 21:22 UnitedMarsupials Note Added: 0014298
2015-04-08 21:39 UnitedMarsupials Note Added: 0014299
2015-04-08 21:41 abma Note Added: 0014300
2015-04-08 21:43 abma Note Added: 0014301
2015-04-08 21:43 abma Assigned To => abma
2015-04-08 21:43 abma Status new => feedback
2015-04-08 21:45 abma Note Edited: 0014301 View Revisions
2015-04-08 21:45 abma Note Edited: 0014301 View Revisions
2015-04-08 21:46 abma Note Edited: 0014301 View Revisions
2015-04-08 21:49 UnitedMarsupials Note Added: 0014302
2015-04-08 21:49 UnitedMarsupials Status feedback => assigned
2015-04-08 21:53 UnitedMarsupials File Added: spring-cmake-dot.txt
2015-04-09 01:36 UnitedMarsupials File Added: patch-use-system-sdl
2015-04-09 03:33 abma Note Added: 0014304
2015-04-09 03:39 abma Note Added: 0014305
2015-04-09 03:40 abma Note Edited: 0014305 View Revisions
2015-04-09 06:32 UnitedMarsupials Note Added: 0014309
2015-04-09 06:37 UnitedMarsupials Note Added: 0014310
2015-04-09 09:29 abma Assigned To abma =>
2015-04-09 09:32 abma Note Added: 0014314
2015-04-09 09:32 abma Status assigned => new
2015-04-09 09:33 abma Severity minor => feature
2015-04-09 09:33 abma Category AI =>
2015-04-09 09:33 abma Summary sdlstub.c does not use system's <SDL.h> => remove include/* from spring repo
2015-04-09 10:31 abma Note Added: 0014317
2015-04-09 10:31 abma Assigned To => jK
2015-04-09 10:31 abma Status new => feedback
2015-04-09 10:37 abma Relationship added has duplicate 0004731
2015-04-09 15:36 UnitedMarsupials Note Added: 0014326
2015-04-09 15:36 UnitedMarsupials Status feedback => assigned
2016-01-13 14:33 abma Relationship added related to 0005033
2017-06-10 14:32 abma Relationship added related to 0005611
+Issue History