Lyle-Tafoya / Omega

My C++ fork of the 1987 roguelike "Omega"
GNU General Public License v3.0
29 stars 3 forks source link

Won't build in gcc 11.4.0 under Ubuntu 22.04 #24

Closed xihr closed 9 months ago

xihr commented 9 months ago
[  1%] Building CXX object CMakeFiles/omega.dir/src/abyss.cpp.o
/home/max/other/Omega/src/abyss.cpp:25:10: fatal error: format: No such file or directory
   25 | #include <format>
      |          ^~~~~~~~
compilation terminated.

Just so you know.

Lyle-Tafoya commented 9 months ago

I currently use GCC 13 to compile on Linux. I suppose you have 3 possible options:

  1. Find a way to install GCC 13. I would be willing to bet there is a way to get GCC 13 on Ubuntu 22.04 without having to compile it yourself.
  2. Use GCC 11 with the "fmt" library (libfmt-dev in Ubuntu 22.04 repo) and replace #include <format> with #include <fmt/core.h> and std::format with fmt::format. You would probably need to use sed or some other utility to perform the find/replace operations. It may also be necessary to link against fmt with the linker flag -lfmt, but I'm not 100% sure about that.
  3. Use Clang 14 with the -fexperimental-library compile flag (or Clang 17 without that flag). I see that Ubuntu 22.04 has Clang 14 in the official repo, so this might be the easiest option, although I have not tested this.
Lyle-Tafoya commented 9 months ago

Actually, I just tried with Clang 14 and the -fexperimental-library compile flag on Ubuntu 22.04, and it seems that flag isn't supported. I'm not sure why. I was basing my information off of https://en.cppreference.com/w/cpp/compiler_support

Lyle-Tafoya commented 9 months ago

On Ubuntu 22.04, the following steps can be performed:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-13
git clone https://github.com/Lyle-Tafoya/Omega.git
mkdir Omega/build
cd Omega/build
CXX=g++-13 cmake ..
make

I will update the README with this information shortly

SilearFlare commented 9 months ago

Can confirm you can actually get it to compile properly if you bother with actually hunting for and installing that specific test GCC 13 repository on ubuntu and ubuntu-adjacent distributions. Thanks for the README addition, it was a bit of an annoying rabbit hole to find it in the first place.

Lyle-Tafoya commented 9 months ago

Closing this, since the necessary steps to compile on Ubuntu 22.04 are now in the README

xihr commented 9 months ago

Sorry, was out of town for the weekend. Yep, works after installing g++-13. Good to go.