Building Kdenlive from Source!

I thought I’d write a bit of a guide on how to set up a development or testing environment for Kdenlive.

Leveling Expectations

It’s important to know that Kdenlive heavily depends on MLT framework to do most of the magic. Kdenlive, however, is just a frontend that provides a bit more functionality to MLT. With that noted, we can expect that a lot of the crashes we see are because of Kdenlive not gracefully handling MLT exits and other issue that occur. Lack of functionality is usually going to be a MLT issue and should be taken up with the MLT development team.

Prereqs

Before installing Kdenlive from git, you’re going to need the latest stable version of MLT, which at the time of writing is 6.6.0. To build that, follow this quick n dirty guide:

git clone https://github.com/mltframework/mlt
cd mlt
git checkout -b 6.6.0
./configure --prefix=/usr/local \
    --avformat-swscale \
    --enable-gpl --enable-gpl3 \
    --qt-libdir=/usr/lib \
    --qt-includedir=/usr/include/qt
make -j16
sudo make install

Alright, down to business

First thing’s first: we need to make sure we’ve got the latest version. Not just the latest version that’s in your package manager, not just the most recent release, but git master.

On Arch, this is easy. install kdenlive-git from the AUR. For those who don’t run arch, I’ll run you through building kdenlive from git master.

Before anything else, we need to clone the repo:

git clone https://anongit.kde.org/kdenlive

Now that we’ve got our repo, we should make sure we have the packages we need from our distro. For Fedora, we need to install the package groups Development Tools and Development Libraries. For Ubuntu, it’s going to be the package build-essential and cmake

from there, let’s get the build dependencies of the package:

Ubuntu users can run the following:

sudo apt build-dep kdenlive

Fedora (or CentOS/RHEL) users can run the following after installing the RPMFusion repos:

sudo dnf builddep kdenlive

Now we’re ready to build the package. We’re going to configure the package with cmake, as below:

mkdir build && cd build
cmake ../ \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DLIB_INSTALL_DIR=lib \
    -DKDE_INSTALL_USE_QT_SYS_PATHS=on \
    -DBUILD_TESTING=on

To educate everyone, I’ll explain what each of these flags we’ve passed to cmake does.

-DCMAKE_BUILD_TYPE=Debug is for specifying that we’re building the package for debug purposes. This will leave debug symbols in the binaries so we can attach debuggers and more easily understand where the problems are occuring.

-DCMAKE_INSTALL_PREFIX=/usr/local specifies that we want to install to /usr/local, instead of /usr, because we don’t want to take over the directories that are managed by the package manager.

-DLIB_INSTALL_DIR=lib specifies the directory for libraries to go. Some builds require you to specify lib32 or lib64, but we’re just using lib

-DKDE_INSTALL_USE_QT_SYS_PATHS=on is to help Kdenlive find the QT components of KDE that we’re going to need to run the program.

-DBUILD_TESTING=on simply builds the test cases which will allow you to run the tests before installing the package. This is helpful in some edge cases.


Once cmake finishes, we can compile! This took my Ryzen 1700 system about 5 minutes.

make -j16

C++ is a very verbose language, so there will be a lot of warnings. Don’t worry about them. As long as the output doesn’t end with an error (check this with echo $?. If it’s nonzero, you’ve got an error) you’re all set.

Once the build is done, your next step is to install the packages.

sudo make install

Now that your packages are all installed, you can run kdenlive with the following command:

/usr/local/bin/kdenlive

If all goes well, Kdenlive should pop right up!


Join the discussion! Building Kdenlive from Source! - Talk Page

2 Likes