Skip to content

Instantly share code, notes, and snippets.

@scribhneoir
Last active February 25, 2024 13:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scribhneoir/f26369519174f223d6e275707b106f27 to your computer and use it in GitHub Desktop.
Save scribhneoir/f26369519174f223d6e275707b106f27 to your computer and use it in GitHub Desktop.
Build aseprite 1.3.1 on Raspberry Pi 4 aarch64 bit

System: Raspberry Pi 4, 4GB RAM, Debian Linux 11 (bullseye) aarch64

Setup

# install required packages:
sudo apt-get install -y g++ clang libc++-dev libc++abi-dev cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev

Build skia-m102 for aarch64

Aseprite doesn't provide an aarch64 linux build of skia, so we will need to build it ourselves.

mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m102 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps

Running python tools/git-sync-deps will fail, but before it fails, we will . This is because emsdk does not have aarch64 builds for all of its releases. skia-m102 requires emsdk 3.1.3. The closest available aarch64 build is 3.1.33. Because I am an idiot, I don't know what to change in skia's source to change the dependency requirement to 3.1.33. So instead, we are going to do this:

Setup emsdk 3.1.33

# clone esmdk
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk

# download and install 3.1.33
./emsdk install 3.1.33
./emsdk activate 3.1.33

skia expects emsdk to be located inside $HOME/deps/skia/third_party/externals

# move emsdk to third_party/externals
cd ../
cp -r emsdk third_party/externals

Finish skia-m102 build

# Generate rules for compiling skia using clang
gn gen out/Release-arm64 --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_sfntly=false skia_use_freetype=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_freetype2=false skia_use_system_harfbuzz=false target_cpu=\"arm64\" cc=\"clang\" cxx=\"clang++\" extra_cflags_cc=[\"-stdlib=libc++\"] extra_ldflags=[\"-stdlib=libc++\"]"

If for some reason this fails (due to gn not being found), try running these commands again.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="${PWD}/depot_tools:${PATH}"

It happened to me and running those commands worked.

# compile skia
ninja -C out/Release-arm64 skia modules

Build aseprite for aarch64

# go back home
cd ~
# download aseprite 1.3.1 source and extract it
curl -LJO https://github.com/aseprite/aseprite/archive/refs/tags/v1.3.1.zip
unzip aseprite-1.3.1.zip -d aseprite
cd aseprite-1.3.1

# build!
mkdir build
cd build
export CC=clang
export CXX=clang++
cmake \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_CXX_FLAGS:STRING=-stdlib=libc++ \
  -DCMAKE_EXE_LINKER_FLAGS:STRING=-stdlib=libc++ \
  -DLAF_BACKEND=skia \
  -DSKIA_DIR=$HOME/deps/skia \
  -DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-arm64 \
  -DSKIA_LIBRARY=$HOME/deps/skia/out/Release-arm64/libskia.a \
  -G Ninja \
  ..
ninja aseprite

Note: this will put out a lot of warning messages. I don't know what they are or why they be. The build has't blown up yet in my short testing, so they can't be that important.

Once ninja has finished, you will have your executable in build/bin/

# run that puppy
cd bin
./aseprite

If you plan to relocate your executable, make sure you move the entire bin folder. All of the provided files are required.

Rejoice

Hopefully all of that worked for you. If it didn't, or if you have brilliant ideas on how to make this process less janky, feel free to comment below. I'd love to make this easier for future linux nerds who enjoy making pixel art. Have a great life!

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