Rosalie241 / RMG

Rosalie's Mupen GUI
GNU General Public License v3.0
572 stars 50 forks source link

Can't build on Fedora 37 #171

Closed loganmc10 closed 10 months ago

loganmc10 commented 10 months ago
[8/134] Building CXX object Source/RMG-Core/CMakeFiles/RMG-Core.dir/Cheats.cpp.o
FAILED: Source/RMG-Core/CMakeFiles/RMG-Core.dir/Cheats.cpp.o 
/usr/bin/c++ -DDISCORD_RPC -DPORTABLE_INSTALL -DRMG_Core_EXPORTS -I/var/home/loganmc10/git_stuff/RMG/Build/Release/Source/RMG-Core -I/var/home/loganmc10/git_stuff/RMG/Source/RMG-Core -I/var/home/loganmc10/git_stuff/RMG/Source/RMG-Core/../3rdParty/fmt/include -I/usr/include/minizip -O3 -DNDEBUG -std=gnu++20 -flto=auto -fno-fat-lto-objects -fPIC -MD -MT Source/RMG-Core/CMakeFiles/RMG-Core.dir/Cheats.cpp.o -MF Source/RMG-Core/CMakeFiles/RMG-Core.dir/Cheats.cpp.o.d -o Source/RMG-Core/CMakeFiles/RMG-Core.dir/Cheats.cpp.o -c /var/home/loganmc10/git_stuff/RMG/Source/RMG-Core/Cheats.cpp
/var/home/loganmc10/git_stuff/RMG/Source/RMG-Core/Cheats.cpp:28:10: fatal error: format: No such file or directory
   28 | #include <format>
      |          ^~~~~~~~

I followed these instructions:

sudo dnf install hidapi-devel libsamplerate-devel minizip-compat-devel SDL2-devel freetype-devel mesa-libGL-devel mesa-libGLU-devel zlib-ng-devel binutils-devel speexdsp-devel qt6-qtbase-devel qt6-qtsvg-devel gcc-c++ nasm git ninja-build
./Source/Script/Build.sh Release
loganmc10 commented 10 months ago

Fixed with this patch:

diff --git a/Source/Script/Build.sh b/Source/Script/Build.sh
index ddb7588..aa4325c 100755
--- a/Source/Script/Build.sh
+++ b/Source/Script/Build.sh
@@ -15,7 +15,7 @@ fi

 mkdir -p "$build_dir"

-cmake -S "$toplvl_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_config" -DPORTABLE_INSTALL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G "Ninja"
+cmake -S "$toplvl_dir" -B "$build_dir" -DCMAKE_BUILD_TYPE="$build_config" -DPORTABLE_INSTALL=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DUSE_LIBFMT=ON -G "Ninja"

 cmake --build "$build_dir" --parallel "$threads"
Rosalie241 commented 10 months ago

Is GCC 13 available in fedora yet? If it isn't then that error makes sense, std::format has only been added to GCC since 13.0, and yeah using the -DUSE_LIBFMT=ON option helps, I'll try seeing if I can automate that check in cmake instead.

loganmc10 commented 10 months ago

gcc 13 is included with Fedora 38.

Distros don't typically update something like gcc to a new major version within the same OS release.

So for example, Ubuntu 22.04 is going to be stuck with GCC 11 until it is EOL (same for RHEL9).

You can possibly check in CMAKE with something like:

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13)

and then always set -DUSE_LIBFMT in those cases

Rosalie241 commented 10 months ago

Does this branch work for you? https://github.com/Rosalie241/RMG/tree/cmake-libfmt

Rosalie241 commented 10 months ago

I've tested it with the ubuntu CI, flatpak builder and my archlinux installation and it works fine, so I pushed https://github.com/Rosalie241/RMG/commit/4b99d9de67de56cb346cfb0ca709fb0038aac0a9 to master and it should be fixed for you aswell, thank you for the report!