otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.55k stars 1.04k forks source link

Unable to compile due to boost-json/boost-beast #4717

Closed kiletic closed 1 month ago

kiletic commented 1 month ago

With the introduction of boost-json and/or boost-beast dependency from #4706 the project no longer compiles properly following the wiki for Debian 12 while using bookworm (stable). This is due to outdated libboost-all-dev which is at version 1.74.0.3 on apt:bookworm, as far as I know boost-json is introduced in version 1.75.

I tried to solve it by removing the installed libboost-all-dev from apt and manually building the 1.75 version, however it was also outdated --- missing some header files for boost-beast. Then I tried the newest version 1.85 and it also failed because the code is using some deprecated features lol

Anyways, I then picked 1.83 since it is also used on sid (unstable) and the project compiled successfully. Updating the wiki might be a good idea? I'll leave the steps I used to resolve this issue as a temporary solution for anyone else that might have the same issue.

  1. Remove the existing Boost 1.74 from your system:
    sudo apt-get remove libboost-all-dev
  2. Download Boost 1.83 and enter the folder:
    wget https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.gz
    tar -xvzf boost_1_83_0.tar.gz
    cd boost_1_83_0
  3. Install boost (warning: this might take a few minutes):
    ./bootstrap.sh --prefix=/usr/local
    sudo ./b2 install

Note: If you're getting missing libraries errors from boost when running tfs you might need to run sudo ldconfig to update the cache.

ranisalt commented 1 month ago

I would rather recommend Debian and other outdated distro users to use vcpkg instead, so that they can get up-to-date versions of all dependencies, not only Boost. We will add a page with instructions on using vcpkg in Linux/OS X, but meanwhile with vcpkg installed you can run cmake --preset vcpkg followed by cmake --build --preset vcpkg and you're golden.

Alternatively, you can disable the HTTP server by passing -DHTTP=OFF when generating makefiles.

ranisalt commented 1 month ago

I added a page to the wiki documenting how to use vcpkg on Linux:

https://github.com/otland/forgottenserver/wiki/Compiling-on-Linux-%26-Mac-OS-X-%28vcpkg%29