Build Aseprite From Source Code in Ubuntu Linux
Get Aseprite for free by building the application yourself from the binaries
- linux
- aseprite
Aseprite is notably one of the best pixel are software out there. It's used to be an open-source software, which is free to use. But a few years back, they changed it into a paid application. However, we can still access the source code and build the application by ourself if we have the will :)
Although in the process I've found some errors here and there, I successfully built aseprite and have it working nicely in my system.
In this article, you will learn the steps to build Aseprite for yourself too. I've written the commands and You will also find some useful info for error-handling as well. However, this is written from my experience while building Aseprite a while back, so you might find errors which I don't specify here.
Well, without any further ado, let's get started building our beloved Aseprite!
Cloning aseprite repo
If you haven't had aseprite in your system, clone the repository and all its submodules using the following command:
git clone --recursive https://github.com/aseprite/aseprite.git
To update an existing aseprite clone, use the following command:
cd aseprite
git pull
git submodule update --init --recursive
Installing / updating dependencies
You will need the following dependencies on Ubuntu/Debian:
sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev
Building Skia
These steps will create a deps folder in your home directory with a couple of subdirectories needed to build Skia (you can change the $HOME/deps with other directory). Some of these commands will take several minutes to finish:
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m81 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
gn gen out/Release-x64 --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"
ninja -C out/Release-x64 skia modules
If you run into a problem saying "Ninja can't find the SkShaper_harfbuzz.cpp file", simply run this command :
sudo apt-get install meson pkg-config ragel gtk-doc-tools gcc g++ libfreetype6-dev libglib2.0-dev libcairo2-dev
sudo apt-get install libharfbuzz-dev
... to install the missing package needed by SkShaper_harfbuzz.cpp file which is the HarfBuzz package.
After installation is done, run ninja -C out/Release-x64 skia modules
again to continue building Skia.
Compiling
Note: cmake must be at least version 3.16. If you're using Ubuntu 18.04 Bionic, follow this link to learn how to update your cmake. Run cmake with the following parameters and then ninja:
cd aseprite
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
-DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
-G Ninja \
..
ninja aseprite
If a "multiple definition error" occurs, you should manually execute the failed subcommand by copying your own error output of the ninja build. This was solved by Aoczs in this github forum. Follow his guidelines, and your issue will probably get solved. It's been approved by a lot of people.
If you're stuck on the last compilation step, with an error like this :
[1/1] Linking CXX executable bin/aseprite
FAILED: bin/aseprite
: && /usr/bin/c++ -Wall -Wno-switch -O2 -g -DNDEBUG src/CMakeFiles/aseprite.dir/main/main.cpp.o -o bin/aseprite lib/libapp-lib.a lib/libclip.a -lxcb -lpthread lib/libdio-lib.a lib/libfilters-lib.a lib/libflic-lib.a lib/libtga-lib.a lib/librender-lib.a lib/libdoc-lib.a lib/libfixmath-lib.a lib/libui-lib.a lib/liblaf-os.a lib/liblaf-gfx.a lib/liblaf-ft.a /home/myname/deps/skia/out/Release-x64/libskia.a /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libfontconfig.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libXcursor.so -lSKSHAPER_LIBRARY-NOTFOUND lib/libobs.a lib/libundo.a lib/libcmark.a lib/libjpeg.a lib/libgiflib.a lib/libwebpdemux.a lib/libwebpmux.a lib/libwebp.a -lpthread -lm lib/libfreetype.a lib/libharfbuzz.a lib/libfreetype.a lib/libharfbuzz.a lib/libpng16.a -lm lib/libjson11.a lib/libarchive.a /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/x86_64-linux-gnu/libexpat.so /usr/lib/x86_64-linux-gnu/libssl.so lib/libfmt.a lib/libtinyexpr.a lib/liblauxlib.a lib/liblua.a lib/liblualib.a lib/libupdater-lib.a lib/libcfg-lib.a lib/libver-lib.a lib/libtinyxml.a lib/libnet-lib.a lib/liblaf-base.a lib/libmodpbase64.a /usr/lib/x86_64-linux-gnu/libdl.so lib/libcurl.a lib/libz.a -ldl && :
/usr/bin/ld: cannot find -lSKSHAPER_LIBRARY-NOTFOUND
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
... try to re-run the last cmake step :
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
-DSKIA_LIBRARY=$HOME/deps/skia/out/Release-x64/libskia.a \
-G Ninja \
..
And after that, run ninja aseprite
again. This works for me, but I'm not really sure why. I'll need to find out about that in the future.
Wrapping up
And that's it. If you find any errors that I didn't talk about in this article, you may find the solutions in the github forums, where they talk about problems while compiling Aseprite.
Now you have Aseprite ready to use in your Linux. Congratulation! It's time to make some art now. Have a good day!