omf2097 / openomf

One Must Fall 2097 Remake
http://www.openomf.org
MIT License
362 stars 35 forks source link

Gentoo compilation issues #350

Closed wmyrda closed 5 years ago

wmyrda commented 6 years ago

While compiling openomf-0.6.5 with media-libs/libsdl2-2.0.8 I stumbled upon two problems.

[ 15%] Building C object CMakeFiles/openomf.dir/src/video/video.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc  -I/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include   -DNDEBUG -Wall -DV_MAJOR=0 -DV_MINOR=6 -DV_PATCH=5 -std=c11   -o CMakeFiles/openomf.dir/src/video/video.c.o -c /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/video/video.c
In file included from /usr/include/SDL2/SDL_config.h:10:0,
                 from /usr/include/SDL2/SDL_stdinc.h:31,
                 from /usr/include/SDL2/SDL_main.h:25,
                 from /usr/include/SDL2/SDL.h:32,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/video/video.c:1:
/usr/include/x86_64-pc-linux-gnu/SDL2/SDL_config.h:33:10: fatal error: SDL_platform.h: No such file or directory
 #include "SDL_platform.h"
          ^~~~~~~~~~~~~~~~
compilation terminated.

That problem is common while building against SLD2 and I fixed with adding "${SDL2_INCLUDE_DIR}/SDL2" to the code removing two white spaces while at it.

diff -Naur openomf-0.6.5.old/CMakeLists.txt openomf-0.6.5/CMakeLists.txt
--- openomf-0.6.5.old/CMakeLists.txt    2018-04-03 11:31:41.228386327 +0200
+++ openomf-0.6.5/CMakeLists.txt        2018-04-03 11:32:44.524384275 +0200
@@ -215,8 +215,9 @@

 set(COREINCS
     include
-    ${SDL2_INCLUDE_DIR} 
-    ${OPENAL_INCLUDE_DIR} 
+    ${SDL2_INCLUDE_DIR}
+    "${SDL2_INCLUDE_DIR}/SDL2"
+    ${OPENAL_INCLUDE_DIR}
     ${CONFUSE_INCLUDE_DIR}
     ${SHADOWDIVE_INCLUDE_DIR}
     ${DUMB_INCLUDE_DIR}

Other problem is way above my idea of what could be wrong. It could be that it is related to libShadowdive-0.9.1 which I compiled separately as external library. I know compiling openomf and using that library from git as submodule is recommended method, but for package to be included in distribution repo it has to rely on numbered versions instead of live packages and I just did not know how to easily manage through Gentoo portage ebuild system mixing of openomf-0.6.5 with git libShadowdive.

[ 42%] Building C object CMakeFiles/openomf.dir/src/resources/sprite.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc  -I/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include -I/usr/include/SDL2   -DNDEBUG -Wall -DV_MAJOR=0 -DV_MINOR=6 -DV_PATCH=5 -std=c11   -o CMakeFiles/openomf.dir/src/resources/pilots.c.o -c /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/pilots.c
/usr/bin/x86_64-pc-linux-gnu-gcc  -I/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include -I/usr/include/SDL2   -DNDEBUG -Wall -DV_MAJOR=0 -DV_MINOR=6 -DV_PATCH=5 -std=c11   -o CMakeFiles/openomf.dir/src/resources/sprite.c.o -c /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/palette.c: In function ‘altpals_init’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/palette.c:14:15: error: too few arguments to function ‘sd_altpal_create’
     altpals = sd_altpal_create();
               ^~~~~~~~~~~~~~~~
In file included from /usr/include/shadowdive/shadowdive.h:28:0,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/palette.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/palette.c:3:
/usr/include/shadowdive/altpal.h:36:5: note: declared here
 int sd_altpal_create(sd_altpal_file *ap);
     ^~~~~~~~~~~~~~~~
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/palette.c:16:9: warning: implicit declaration of function ‘sd_altpal_delete’; did you mean ‘sd_altpal_free’? [-Wimplicit-function-declaration]
         sd_altpal_delete(altpals);
         ^~~~~~~~~~~~~~~~
         sd_altpal_free
make[2]: *** [CMakeFiles/openomf.dir/build.make:570: CMakeFiles/openomf.dir/src/resources/palette.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk.c: In function ‘bk_create’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk.c:25:30: error: ‘sd_bk_file {aka struct <anonymous>}’ has no member named ‘num_palettes’; did you mean ‘palettes’?
     for(int i = 0; i < sdbk->num_palettes; i++) {
                              ^~~~~~~~~~~~
                              palettes
make[2]: *** [CMakeFiles/openomf.dir/build.make:531: CMakeFiles/openomf.dir/src/resources/bk.c.o] Error 1
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_loader.c: In function ‘load_af_file’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_loader.c:10:23: error: too few arguments to function ‘sd_af_create’
     sd_af_file *tmp = sd_af_create();
                       ^~~~~~~~~~~~
In file included from /usr/include/shadowdive/shadowdive.h:27:0,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/palette.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/sprite.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/animation.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/af_move.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/af.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/af_loader.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_loader.c:1:
/usr/include/shadowdive/af.h:52:5: note: declared here
 int sd_af_create(sd_af_file *af);
     ^~~~~~~~~~~~
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c: In function ‘af_move_create’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:10:29: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->next_move = sdmv->unknown[12];
                             ^~~~~~~
                             unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:11:32: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->successor_id = sdmv->unknown[16];
                                ^~~~~~~
                                unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:12:28: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->category = sdmv->unknown[13];
                            ^~~~~~~
                            unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:13:26: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->damage = sdmv->unknown[17] / 2.0f;
                          ^~~~~~~
                          unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:14:26: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->points = sdmv->unknown[20] * 400;
                          ^~~~~~~
                          unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_move.c:15:32: error: ‘sd_move {aka struct <anonymous>}’ has no member named ‘unknown’; did you mean ‘unknown_0’?
     move->scrap_amount = sdmv->unknown[15];
                                ^~~~~~~
                                unknown_0
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/af_loader.c:12:9: warning: implicit declaration of function ‘sd_af_delete’; did you mean ‘sd_af_free’? [-Wimplicit-function-declaration]
         sd_af_delete(tmp);
         ^~~~~~~~~~~~
         sd_af_free
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_info.c: In function ‘bk_info_create’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_info.c:12:54: error: ‘sd_bk_anim {aka struct <anonymous>}’ has no member named ‘unknown_data’
     str_create_from_cstr(&info->footer_string, sdinfo->unknown_data);
                                                      ^~
make[2]: *** [CMakeFiles/openomf.dir/build.make:518: CMakeFiles/openomf.dir/src/resources/af_move.c.o] Error 1
make[2]: *** [CMakeFiles/openomf.dir/build.make:505: CMakeFiles/openomf.dir/src/resources/af_loader.c.o] Error 1
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_loader.c: In function ‘load_bk_file’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_loader.c:10:23: error: too few arguments to function ‘sd_bk_create’
     sd_bk_file *tmp = sd_bk_create();
                       ^~~~~~~~~~~~
In file included from /usr/include/shadowdive/shadowdive.h:26:0,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/palette.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/sprite.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/animation.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/bk_info.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/bk.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/include/resources/bk_loader.h:4,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_loader.c:1:
/usr/include/shadowdive/bk.h:50:5: note: declared here
 int sd_bk_create(sd_bk_file *bk);
     ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/openomf.dir/build.make:544: CMakeFiles/openomf.dir/src/resources/bk_info.c.o] Error 1
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/bk_loader.c:12:9: warning: implicit declaration of function ‘sd_bk_delete’; did you mean ‘sd_bk_free’? [-Wimplicit-function-declaration]
         sd_bk_delete(tmp);
         ^~~~~~~~~~~~
         sd_bk_free
make[2]: *** [CMakeFiles/openomf.dir/build.make:557: CMakeFiles/openomf.dir/src/resources/bk_loader.c.o] Error 1
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c: In function ‘sprite_create’:
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c:19:54: error: ‘sd_sprite {aka struct <anonymous>}’ has no member named ‘img’
     sd_vga_image *raw = sd_sprite_vga_decode(sdsprite->img);
                                                      ^~
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c:19:25: error: too few arguments to function ‘sd_sprite_vga_decode’
     sd_vga_image *raw = sd_sprite_vga_decode(sdsprite->img);
                         ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/shadowdive/shadowdive.h:18:0,
                 from /tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c:1:
/usr/include/shadowdive/sprite.h:139:5: note: declared here
 int sd_sprite_vga_decode(
     ^~~~~~~~~~~~~~~~~~~~
/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5/src/resources/sprite.c:22:5: warning: implicit declaration of function ‘sd_vga_image_delete’; did you mean ‘sd_vga_image_decode’? [-Wimplicit-function-declaration]
     sd_vga_image_delete(raw);
     ^~~~~~~~~~~~~~~~~~~
     sd_vga_image_decode
make[2]: *** [CMakeFiles/openomf.dir/build.make:596: CMakeFiles/openomf.dir/src/resources/sprite.c.o] Error 1
make[2]: Leaving directory '/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5_build'
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/openomf.dir/all] Error 2
make[1]: Leaving directory '/tmp/portage/games-fps/openomf-0.6.5/work/openomf-0.6.5_build'
make: *** [Makefile:152: all] Error 2
 * ERROR: games-fps/openomf-0.6.5::i7woj failed (compile phase):
 *   emake failed

Any hints how to fix it or releasing version 0.6.6 if it is already fixed in master are welcomed.

wmyrda commented 6 years ago

Same problem appears compiling openomf-0.6.5 when shadowdive library present in the system in build from git master which at the moment is at the version fbf4a4e75d113beb2708605b8f30c2f5c180e7e9

wmyrda commented 6 years ago

Just for reference. Current openomf from git master 7450c101e24e20319e08a822b8ad8c42e66d96da compiles and works against current libshadowdive mentioned in previous post.

Currently used patch for libsdl2 looks a bit different as it does not clear any white spaces around patch as they are no longer present there

diff -Naur openomf-9999.old/CMakeLists.txt openomf-9999/CMakeLists.txt
--- openomf-9999.old/CMakeLists.txt     2018-04-03 13:23:52.692168060 +0200
+++ openomf-9999/CMakeLists.txt 2018-04-03 13:24:21.924167112 +0200
@@ -285,6 +285,7 @@
     include
     ${CMAKE_CURRENT_BINARY_DIR}/include/
     ${SDL2_INCLUDE_DIR}
+    "${SDL2_INCLUDE_DIR}/SDL2"
     ${CONFUSE_INCLUDE_DIR}
     ${SHADOWDIVE_INCLUDE_DIR}
     ${LIBINTL_INCLUDE_DIR}

One more thing worth mentioning is that hence Gentoo is source based distro than packages may be build with/without optional features. One of those features in libsdl2 is haptic. Game build fine without it, but I got an error starting the game saying libSDL2 does not contain haptic support. Seems logical that INSTALLATION.md could say few words about that.

Last but not least if one wants to play with Gentoo distro I created bug where installation scripts for the game are located. See here: https://bugs.gentoo.org/652324

katajakasa commented 6 years ago

Hey!

Thanks for the reports. Unfortunately, Gentoo is not an OS any of us really use, so supporting it is also difficult. Compilation currently works fine on debian based systems and MSYS2, so I am going to assume this is some sort of Gentoo-specific oddity. As such, I'm wary of patching the directories since things may break elsewhere (away from my workstation currently, so cannot test).

Also, a warning about libshadowdive. Even though it has some tagged versions, none of those should be considered anything more than pre-alpha test releases. LibShadowdive will break API constantly in the future as we figure out more about the file formats, and there will be no more release tags ever. We guarantee compatibility between openomf and libshadowdive projects only for the version tagged as openomf submodule. Anything outside of that is unsupported, and is likely to break in horrible ways :)

Releasing 0.6.6 is currently not possible due to some regressions after 0.6.5.

wmyrda commented 6 years ago

Hi, I am not programmer so I do not know exactly why some packages using libsdl2 suffer from this problem, but seems there is another way around it in Gentoo as posted in https://bugs.gentoo.org/634370#c3 and running with CPPFLAGS="-I/usr/include/SDL2" ./configure fixes that.

I understand it would be an additional burden, but if once a year You guys make a release that would compile against also released libshadowdive it would be enough if You ask me. Live packages from git can not really make it into repository so I would await for those regression fixed to provide proper installation script for released version.

katajakasa commented 6 years ago

Well, switching to use instead of <SDL2/SDL.h> should not be too difficult, so I guess we can fix that one.

Libshadowdive is not meant to be used as a separate library and is not designed for it, so no, we're not going to make releases. The only reason it is in separate repository right now is because we want to include it in omf2097 toolset also. We don't want to take any sort of responsibility of maintaining a separate library. Also, sooner or later libsd is going to get folded into openomf repository anyways (#327 )

katajakasa commented 5 years ago

This should now be thoroughly fixed with 331513ce2cbde167c35644115eadb7dba14fee67