Skip to content

Building

guard3 edited this page Sep 11, 2023 · 3 revisions

Supported compilers

To compile GreekBot, supported compilers are:

  • MSVC
  • Clang version 14 or later

The following compilers are not supported:

  • GCC (Initializer list bug)
  • Apple Clang (no support for C++20 coroutines)

On Windows

The easiest way to install dependencies on Windows is with vcpkg

On macOS

The easiest way to install dependencies on macOS is with Homebrew

brew install boost openssl sqlite3 fmt

Apple Clang and gcc are not supported, so to compile use LLVM Clang

brew install llvm

At the time or writing, Clang 16 is the latest available version, but Boost/ASIO won't compile with it since it introduced a function overload ambiguity bug in C++20 mode.

On Raspberry Pi

Because GreekBot uses new C++ features and libraries, it is recommended to use Ubuntu whose packages are more up-to-date. Debian based distros are likely to offer older versions of packages that are incompatible with GreekBot and make building more difficult.

In the case of Ubuntu, dependencies can be obtained through apt:

sudo apt install libssl-dev libsqlite3-dev zlib1g-dev

At the time of writing, the latest version of Boost is old enough to not include the required Boost.JSON library, so that will have to be built manually. To install:

  • Download the latest version of Boost from https://www.boost.org
  • cd to the root folder of the archive and run:
./bootstrap.sh --with-libraries=json
sudo ./b2 install

On Raspberry Pi (Debian)

I'm filling these as I go...

Updating

Before proceeding, make sure all packages are up-to-date

sudo apt-get update
sudo apt-get full-upgrade

and reboot if needed

Ensure there is enough memory

Make sure the Raspberry Pi has enough memory available, preferably more than 1GB because anything less is likely to cause building to fail later.

free -m

Create a swapfile

  • Disable the existing swapfile
    sudo dphys-swapfile swapoff
    
  • Edit the configuration file
    sudo nano /etc/dphys-swapfile
    
    then find CONF_SWAPSIZE=100 and replace it with a large enough amount (in MBs). 2048 should be more than enough
  • Finally, recreate the swapfile and reboot for changes to take effect
    sudo dphys-swapfile setup
    sudo dphys-swapfile swapon
    sudo reboot
    

MORE TBA...