Skip to content

Instantly share code, notes, and snippets.

@stevepdp
Last active December 10, 2021 21:48
Show Gist options
  • Save stevepdp/18b8d2c4f18e051672ae98e7051a7724 to your computer and use it in GitHub Desktop.
Save stevepdp/18b8d2c4f18e051672ae98e7051a7724 to your computer and use it in GitHub Desktop.
How to compile Godot 2.1.4 on a Raspberry Pi 400

Compile Godot 2.1.4 on a Raspberry Pi 400

You'll ideally be running an environment that defaults to Python 2. To make things easy, use the recently released Raspberry Pi OS (Legacy) with desktop, which is derived from Debian Buster.

  1. Install dependencies:
    sudo apt install build-essential clang libasound2-dev libgl1-mesa-dev libglu-dev libpulse-dev libssl-dev libssl1.0-dev libudev-dev libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev pkg-config scons yasm

  2. Download the 2.1.4 source from Github, unpack and change into it:
    wget https://github.com/godotengine/godot/archive/refs/tags/2.1.4-stable.tar.gz
    tar xvf 2.1.4-stable.tar.gz
    cd godot-2.1.4-stable

  3. Swap uint8_t references to int16_t in ./drivers/alsa/audio_driver_alsa.cpp:

    sed -i 's/uint8_t/int16_t/g' drivers/alsa/audio_driver_alsa.cpp

    This addresses an audio bug documented by @hiulit here.

  4. Update the certificates with the version from Godot master:
    curl https://raw.githubusercontent.com/godotengine/godot/master/thirdparty/certs/ca-certificates.crt > thirdparty/certs/ca-certificates.crt

  5. Compile the Editor:
    scons platform=x11 target=release_debug tools=yes use_llvm=yes openssl=builtin CCFLAGS="-mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -mlittle-endian -munaligned-access -Wno-c++11-narrowing" -j4

The editor build can then be found at ./bin/godot.x11.opt.tools.32.llvm.

  1. Compile the Export Templates:
    scons platform=x11 target=release tools=no use_llvm=yes openssl=builtin CCFLAGS="-mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -mlittle-endian -munaligned-access -Wno-c++11-narrowing" -j4

The export templates can then be found at ./bin/godot.x11.opt.32.llvm.

  1. Compile the Headless version: scons platform=server target=release_debug tools=yes use_llvm=yes openssl=builtin CCFLAGS="-mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -mlittle-endian -munaligned-access -Wno-c++11-narrowing" -j4

The headless build can then be found at ./bin/godot_server.server.opt.tools.32.

  1. Compile the Server version:
    scons platform=server target=release tools=no use_llvm=yes openssl=builtin CCFLAGS="-mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard -mlittle-endian -munaligned-access -Wno-c++11-narrowing" -j4

The binaries will then be available at ./bin/godot_server.server.opt.32.

Credit and thanks to @hiulit and @w84death for figuring much of this out :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment