andrewtweber / umoria-color

Moria: a roguelike Dungeon Crawler game | Umoria - now with COLOR!
https://andrew.cool/moria
GNU General Public License v3.0
18 stars 4 forks source link

Compile umoria-color on OpenBSD 7.3 (also on all recent linux systems) #11

Closed lea2501 closed 1 year ago

lea2501 commented 1 year ago

Hi! i wanted to compile in OpenBSD 7.3 (latest stable) and i get the following error:

lea@latitude5480 umoria-color $ cd build/
lea@latitude5480 build $ cmake ..
-- Build type set to 'Release'
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:27 (project):
  The CMAKE_CXX_COMPILER:

    g++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
See also "/home/lea/src/umoria-color/build/CMakeFiles/CMakeOutput.log".
See also "/home/lea/src/umoria-color/build/CMakeFiles/CMakeError.log".

i added this packages already: doas pkg_add autoconf-2.71 gcc-11.2.0p6 gmake

i also tried with this commands with same error: cmake .. -DCMAKE_MAKE_PROGRAM=gmake -DCMAKE_CXX_COMPILER=/usr/local/bin/eg++

Thanks for mantaining this amazing game!

lea2501 commented 1 year ago

I managed to compile https://github.com/dungeons-of-moria/umoria successfully with this changes, but could not compile umoria-color.

I modified 'CMakeLists.txt' with this:

-set(CMAKE_CXX_COMPILER g++)
+set(CMAKE_CXX_COMPILER eg++)

And also file 'src/headers.h'

-#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__
+#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__ || __OpenBSD__

but now i'm getting:

/home/lea/src/umoria-color/src/game_save.cpp: In function 'bool loadGame(bool&)':
/home/lea/src/umoria-color/src/game_save.cpp:814:29: error: array subscript 66 is above array bounds of 'Tile_t [66][198]' [-Werror=array-bounds]
  814 |                 if (tile >= &dg.floor[MAX_HEIGHT][0]) {
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/lea/src/umoria-color/src/headers.h:60,
                 from /home/lea/src/umoria-color/src/game_save.cpp:8:
/home/lea/src/umoria-color/src/dungeon.h:56:12: note: while referencing 'Dungeon_t::floor'
   56 |     Tile_t floor[MAX_HEIGHT][MAX_WIDTH];
      |            ^~~~~
cc1plus: all warnings being treated as errors
gmake[2]: *** [CMakeFiles/umoria.dir/build.make:384: CMakeFiles/umoria.dir/src/game_save.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/umoria.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
lea2501 commented 1 year ago

Just to tell that it happens also in debian unstable, and arch linux boxes

[ 43%] Building CXX object CMakeFiles/umoria.dir/src/game_save.cpp.o
/root/umoria-color/src/game_save.cpp: In function 'bool loadGame(bool&)':
/root/umoria-color/src/game_save.cpp:814:29: error: array subscript 66 is above array bounds of 'Tile_t [66][198]' [-Werror=array-bounds]
  814 |                 if (tile >= &dg.floor[MAX_HEIGHT][0]) {
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/umoria-color/src/headers.h:60,
                 from /root/umoria-color/src/game_save.cpp:8:
/root/umoria-color/src/dungeon.h:56:12: note: while referencing 'Dungeon_t::floor'
   56 |     Tile_t floor[MAX_HEIGHT][MAX_WIDTH];
      |            ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/umoria.dir/build.make:384: CMakeFiles/umoria.dir/src/game_save.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/umoria.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
andrewtweber commented 1 year ago

I think you’re the one who emailed me and this is now working with the fork up-to-date with the upstream. Let me know if not!