These are instructions for building Pencil2D on Linux. If you are using Windows go here, and macOS go here. This guide is primarily targeted towards developers. If you just want to use the latest version you can just download one of our nightly builds.
This tutorial was made with Ubuntu and Arch Linux in mind, however you should be able to adapt this guide to other distributions if necessary.
There are a few things that must be installed in order to build Pencil2D. In this section, we will go over the installation of each of these components in detail. For Ubuntu we describe both graphical and command-line methods of installation, choose whichever one you feel more comfortable with (and if you don't know the difference, choose graphical). For Arch Linux we describe only the command-line method since that is what most Arch users are used to.
Pencil2D relies on the Qt application framework so you must install it before you can successfully build the program.
Pencil2D must be built with the Qt framework, version 5.6 or newer. Therefore, you will need at least Ubuntu 16.10 (Yakkety Yak) to use this method, as Canonical does not provide recent enough versions of Qt for older versions of Ubuntu. To install Qt 5, run this command:
sudo apt install qt5-default qtbase5-dev qtmultimedia5-dev qttools5-dev-tools libqt5svg5-dev
If you are using Ubuntu 22.04 (Jammy Jellyfish) or later, you can alternatively install Qt 6 by running this command:
sudo apt install qt6-base-dev qt6-l10n-tools qt6-multimedia-dev libqt6svg6-dev
For a more pleasant development experience, you might want to install Qt Creator as well (recommended). To do so, run the following command:
sudo apt install qtcreator
Pencil uses the Qt framework, version 5.6 or newer. To install all required components of Qt 5, run this command:
sudo pacman -S --needed qt5-base qt5-multimedia qt5-svg qt5-tools gst-plugins-good
If you would like to use Qt 6 instead, simply replace the version number in the command above.
For a more pleasant development experience, you might want to install Qt Creator as well (recommended). To do so, run the following command:
sudo pacman -S --needed qtcreator
You will need GNU Make and either GCC or Clang to build Pencil2D.
These are usually installed by default, so you don't have to worry about them. If however you encounter issues, you can run the following commands.
sudo apt install make g++
sudo apt install make clang
On most Arch systems, these are installed early on, but if your system does not have them yet, you can install them by running the following commands.
sudo pacman -S --needed make gcc
sudo pacman -S --needed make clang
Now it's time to build the application.
Ctrl+R
works, too). A small progress bar will show up on the bottom right and console output will appear in the bottom section.If there is an error, the issues tab will open up at the bottom and display the error messages. Try searching it on the Pencil2D Issue tracker or create an issue If you can't find anything. Be sure to include as much detail as you can in your report!
If you do not have or do not want to use Qt Creator for some reason then you can follow this two-step process. First you have to use QMake to let Qt do its preprocessing and generate the Makefiles. Cd to the root git directory for Pencil2D. To avoid cluttering the source directories with generated files, we’ll create a subdirectory named build for those. For the next step you will need to know the correct mkspec for your computer. Use the table below to find it.
Compiler | 32-bit | 64-bit |
---|---|---|
GCC | linux-g++-32 | linux-g++-64 |
Clang | linux-clang | linux-clang |
Substitute <mkspec> for the mkspec of your desired configuration and run the command below:
mkdir build; pushd build; qmake -r -spec <mkspec> CONFIG+=debug ..; popd
qmake
with qmake6
.Next you have to use GNU Make to actually compile the source code. Run the command:
make -C build
You can then open Pencil2D by running this from the source directory:
./build/bin/pencil2d
Now that you can build Pencil2D, the next step is to learn about navigating the source code.