mmatyas / openblok

A customizable, cross platform, open-source falling block game, packed with a bunch of features.
GNU General Public License v3.0
99 stars 15 forks source link

OpenBlok does not compile in RPiOS lite Bookworm 64-bit #59

Closed ParadoxGBB closed 1 year ago

ParadoxGBB commented 1 year ago

I think it may be due to v12 of the compiler. Thanks so much if anyone can help get this working!

Start of retropie build log:

-- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Git: /usr/bin/git (found version "2.39.2") -- Found Gettext: /usr/bin/msgmerge (found version "0.21") -- Found SDL2: /usr/lib/aarch64-linux-gnu/libSDL2.so
-- Found SDL2_image: /usr/lib/aarch64-linux-gnu/libSDL2_image.so
-- Found SDL2_ttf: /usr/lib/aarch64-linux-gnu/libSDL2_ttf.so
-- Found SDL2_mixer: /usr/lib/aarch64-linux-gnu/libSDL2_mixer.so
-- Checking for -Wmissing-prototypes: no -- Checking for -Wtautological-compare: yes -- Checking for -Wshorten-64-to-32: no -- Checking for experimental/optional header: no -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- libSDL2pp 0.16.0 bundled build -- Found Intl: built in to C library
-- Performing Test Iconv_IS_BUILT_IN -- Performing Test Iconv_IS_BUILTIN - Success -- Found Iconv: built in to C library
-- Performing Test CXX
[-Wall]SUPPORTED -- Performing Test CXX[-Wall]_SUPPORTED - Success

[.... error is:]

[ 30%] Building CXX object src/system/CMakeFiles/module_system.dir/InputConfigFile.cpp.o /home/pi/RetroPie-Setup/tmp/build/openblok/src/system/InputConfigFile.cpp: In member function ‘void InputConfigFile::save(const std::map<std::__cxx11::basic_string, DeviceData>&, const std::string&)’: /home/pi/RetroPie-Setup/tmp/build/openblok/src/system/InputConfigFile.cpp:135:76: error: ‘ostream_iterator’ is not a member of ‘std’ 135 | std::copy(sorted_values.begin(), sorted_values.end() - 1, std::ostream_iterator(ss, ", ")); | ^~~~ /home/pi/RetroPie-Setup/tmp/build/openblok/src/system/InputConfigFile.cpp:10:1: note: ‘std::ostream_iterator’ is defined in header ‘’; did you forget to ‘#include ’? 9 | #include +++ |+#include 10 | /home/pi/RetroPie-Setup/tmp/build/openblok/src/system/InputConfigFile.cpp:135:93: error: expected primary-expression before ‘int’ 135 | std::copy(sorted_values.begin(), sorted_values.end() - 1, std::ostream_iterator(ss, ", ")); | ^~~ make[2]: [src/system/CMakeFiles/module_system.dir/build.make:118: src/system/CMakeFiles/module_system.dir/InputConfigFile.cpp.o] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:283: src/system/CMakeFiles/module_system.dir/all] Error 2 make: [Makefile:156: all] Error 2 Could not successfully build openblok - OpenBlok: A Block Dropping Game (/home/pi/RetroPie-Setup/tmp/build/openblok/src/openblok not found).

cmitu commented 1 year ago

It's not clear from the pasted error message, but gcc suggests the actual fix:

...
[ 32%] Building CXX object src/system/CMakeFiles/module_system.dir/Localize.cpp.o
/home/pi/src/openblok/src/system/InputConfigFile.cpp: In member function ‘void InputConfigFile::save(const std::map<std::__cxx11::basic_string<char>, DeviceData>&, const std::string&)’:
/home/pi/src/openblok/src/system/InputConfigFile.cpp:135:76: error: ‘ostream_iterator’ is not a member of ‘std’
  135 |             std::copy(sorted_values.begin(), sorted_values.end() - 1, std::ostream_iterator<int>(ss, ", "));
      |                                                                            ^~~~~~~~~~~~~~~~
/home/pi/src/openblok/src/system/InputConfigFile.cpp:10:1: note: ‘std::ostream_iterator’ is defined in header ‘<iterator>’; did you forget to ‘#include <iterator>’?
    9 | #include <assert.h>
  +++ |+#include <iterator>
   10 |
/home/pi/src/openblok/src/system/InputConfigFile.cpp:135:93: error: expected primary-expression before ‘int’
  135 |             std::copy(sorted_values.begin(), sorted_values.end() - 1, std::ostream_iterator<int>(ss, ", "));
      |                                                                                             ^~~
[ 33%] Building CXX object src/system/CMakeFiles/module_system.dir/Log.cpp.o

Adding a

#include <iterator>

in src/system/InputConfigFile.cpp should fix the build.

mmatyas commented 1 year ago

Fixed, thanks!