Building from Source
Compiling Drawpile from its source code is only necessary if you want to develop on it yourself or if you have a system for which there’s no official releases provided. Those official releases can be found on the download page.
Building stuff from source can be tricky, so if you have any issues, take a look at the help page on where you can ask for help!
Pick the operating system you want to build Drawpile for:
Linux
Compiling software on Linux is usually pretty easy, the setup should only take a few minutes. However, the names of the dependencies tend to be different on the various flavors of Linux.
The following instructions should work on Ubuntu, Debian and anything based on them. For other distributions, you’ll have to find the matching dependencies for the stuff listed in step 1. If you need help with this (or anything else), take a look at the help page on how to get in touch.
- Open a terminal and run
sudo apt install build-essential cmake git libqt6svg6 qt6-base-dev qt6-l10n-tools qt6-multimedia-dev qt6-tools-dev qt6-websockets-dev libxkbcommon-dev libzip-dev zipcmp zipmerge ziptool libmicrohttpd-dev libsodium-dev libsystemd-dev qtkeychain-qt6-dev libwebp-dev
- Install Rust
- Run
git clone https://github.com/drawpile/Drawpile.git
to clone Drawpile - Run
cd Drawpile
to switch into the directory you just cloned - Configure the project by running one of the following, depending on what you want to do:
cmake --preset linux-debug-qt6-all-make
if you want develop on Drawpilecmake --preset linux-release-qt6-all-make
to build everything for use on a desktopcmake --preset linux-release-qt6-server-make
to build the server portion only, without any graphical interface
- Run
cmake --build build
to build it - The resulting applications (client, server, command line tools) will be in
build/bin
and you can run them from there. You can also runsudo cmake --install build
to install Drawpile into your system.
macOS
Building Drawpile on macOS should be reasonably straight-forward, although you have to install a number of external tools first.
- Install Xcode
- Install Homebrew
- Install Rust
- Open Terminal.app and run
brew install cmake libzip qt libmicrohttpd libsodium qtkeychain
to install the dependencies - Run
git clone https://github.com/drawpile/Drawpile.git
to clone Drawpile - Run
cmake -S Drawpile -B Drawpile-build -G Xcode
to generate the Xcode project - Run
open Drawpile-build/Drawpile.xcodeproj
to open the project in Xcode and use normally
Windows
Building software on Windows is a pretty miserable experience. It usually takes at least 3 hours for the development environment to finish installing, possibly more depending on the speed of your computer and network. You should also have at least 50 GB of free disk space, otherwise the process may fail.
Don’t hesitate to ask for help if you’re having trouble, you can find multiple places to do so on the help page.
- Install Rust and Visual Studio Community Edition. Download the Rust installer and run it. You can leave everything on the default options to let in install everything that’s needed.
- Install CMake, Ninja and git.
- Start the Visual Studio Installer. You should be able to find it in your start menu by searching for it.
- Click on the “Modify” button next to the “Visual Studio 2022” entry.
- Switch to the “Individual components” tab at the top.
- Search for “cmake”, then check “C++ CMake tools for Windows”.
- Search for “git”, then check “Git for Windows”.
- At the bottom-right, click on “Modify”.
- Run the Visual Studio x64 Command Line. You should be able to find it in your start menu by searching for “x64”. You should see a black window with white text in it.
- If you haven’t used the Windows command line before: it’s weird and all kinds of terrible.
- Do not press
Ctrl+V
, it won’t paste, it will just write garbage that you have to delete or else it will mess things up. To paste something, you have to useShift+Insert
instead. - Do not click around in the window. Only click the title bar or the entry in the task bar. Else it will get stuck until you press the escape key. You know if you got into this state if it says “Select” in the title bar of the window.
- Don’t try to copy stuff out of the window. That will almost always get it stuck and/or kill whatever is currently running. Just take a screenshot instead if you want to show someone what it says.
- Install vcpkg:
- Run
cd /D C:\
(type it into the command line window and hit enter) to switch to the root of the C drive. (Note: don’t try to be experimental and put it into a different directory. It’s very fragile. If the path is too long, contains a symlink or a space anywhere, vcpkg will not work properly. Save yourself the wasted time and just put it into the root of your C drive.) - Then run
git clone https://github.com/Microsoft/vcpkg.git
to get vcpkg. - Then run
cd vcpkg
to switch into the directory you just cloned. - Then
bootstrap-vcpkg.bat -disableMetrics
to set up vcpkg.
- Run
- Install the dependencies:
- This step takes really long to complete. Again, make sure you have at least 50 GB of free disk space.
- Run
vcpkg --disable-metrics install --clean-after-build qt5-base:x64-windows qt5-multimedia:x64-windows qt5-svg:x64-windows qt5-tools:x64-windows qt5-translations:x64-windows qt5-websockets:x64-windows kf5archive:x64-windows libmicrohttpd:x64-windows libsodium:x64-windows qtkeychain:x64-windows
to install the dependencies.- Note: as of April 2024, xz is broken in vcpkg. If you get an error about
https://github.com/tukaani-project/xz/archive/v5.4.4.tar.gz
not being available, you have to apply this workaround and run the above command again.
- Note: as of April 2024, xz is broken in vcpkg. If you get an error about
- Go do something else for the next several hours while it installs everything.
- Build Drawpile:
- Run
cd /D %HOMEDRIVE%%HOMEPATH%
to switch to your home directory. It is probably underC:\Users\<YOUR NAME>
. - Then run
git clone https://github.com/drawpile/Drawpile.git
to get Drawpile’s source code. - Then
cd Drawpile
to switch into that directory. - Configure the project by running one of the following, depending on what you want to do:
cmake --preset windows-x64-debug-qt5-all-ninja
if you want develop on Drawpilecmake --preset windows-x64-release-qt5-all-ninja
to build everything for use on a desktop
- Build it:
cmake --build build
- this takes a few minutes the first time around. - Install it:
cmake --install build
- this won’t overwrite any existing installation of Drawpile, it will just put the stuff you built and the DLLs, icons and such together so that you can actually run it.
- Run
- Run what you built. The executable should be at
C:\Users\<YOUR NAME>\Drawpile\install\drawpile.exe
Sometimes cmake fails to generate the PDB paths (debug info stuff.) If that happens and you need them, delete the build directory and try again.
Android
Android builds are only supported on Linux. Your mileage will vary on other operating systems.
- Install OpenJDK 17. A different version of Java will likely not work.
- On Ubuntu and Debian, you can install the package
openjdk-17-jdk
. The package exists since Ubuntu 24.04 and Debian bookworm, older versions don’t have it and you’ll need to either upgrade or find some other source. - On Arch, install
jdk17-opendk
. - Other distributions should be similar.
- On Ubuntu and Debian, you can install the package
- Make sure Java 17 is actually enabled by running
java -version
. If it doesn’t print version 17, you may have multiple versions installed and need to switch to it.- On Ubuntu, this can be done with
update-java-alternatives
. - On Arch, run
sudo archlinux-java set java-17-openjdk
. - Other distributions should be similar.
- On Ubuntu, this can be done with
- Install Android Studio.
- Depending on your distribution, there may also be other ways of installing the Android SDK. For example, Arch has some documentation on this.
- Run
git clone https://github.com/drawpile/Drawpile.git
to clone Drawpile. - Run
cd Drawpile
to switch into the directory you just cloned. - Run
BUILD_TYPE=debug ANDROID_ABI=arm64-v8a pkg/android/build.bash setup
to set up and build the Android dependencies. This will take a while. - Run
BUILD_TYPE=debug ANDROID_ABI=arm64-v8a pkg/android/build.bash configure
to configure Drawpile’s build.- This step may balk at conflicting Android packages that you may have installed earlier or were installed automatically. Follow the instructions the error provides you to uninstall those.
- Run
cmake --build buildandroid-arm64-v8a-debug
.
This will give you an APK in buildandroid-arm64-v8a-release/bin/Drawpile-XYZ.apk
, where XYZ is a version and a commit hash.
The above will build for 64-bit ARM devices in debug mode. If you want a release build instead, replace BUILD_TYPE=debug
in steps 6 and 7 with BUILD_TYPE=release
. If you want an 64-bit Intel build instead to run in an emulator, use ANDROID_ABI=x86_64
. The build directory at the end will be called something different accordingly.
WebAssembly
Building on WebAssembly has only been tested on Linux. Your mileage may vary on other operating systems.
You will need to install the prerequisites to build Qt on your host system. On Debian-based systems, this also includes ninja-build
, libfontconfig1-dev
and libssl-dev
.
# Get the Emscripten SDK, version 3.1.50
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 3.1.50
./emsdk activate latest
cd ..
# Grab Drawpile's source code
git clone https://github.com/drawpile/Drawpile.git
cd Drawpile
# Activate Emscripten in your current shell
. ../emsdk/emsdk_env.sh
# Set up the dependencies (will take several hours)
pkg/emscripten/setup.bash debug
# Configure Drawpile
pkg/emscripten/configure.bash debug
# Build it (linking will take several minutes)
cmake --build buildemdebug
# Create a servable directory
cmake --install buildemdebug
You will end up with the application ready in a directory called installemdebug
.
You can use qtwasmserver
to serve it from there, see Qt’s documentation on that. Running it with something like Python’s http.server will not work because that doesn’t set some required headers.
Other Operating Systems
Drawpile should theoretically run on any platform that support the following:
- CMake, at least version 3.18, but 3.24 or newer is recommended.
- Rust, at least version 1.66.1.
- A C++17 compiler.
- Qt, either version 5 or 6. Drawpile only regularly gets built on the latest version of these, so your mileage may vary on older ones.
Refer to the Linux section above with regards to which dependencies you need to install. You can also look at the GitHub Actions workflow for how the official releases are built, but it’s more involved.
If you succeed with build Drawpile on your operating system, it’d be cool to know how you did it! For that and if you need help along the way, take a look at the help page.