Kdenlive/Development: Difference between revisions

From KDE Community Wiki
(Moving content to https://invent.kde.org/multimedia/kdenlive/-/blob/master/dev-docs/build.md)
Line 1: Line 1:
Kdenlive is rather easy to build (at least on supported platforms), and this page should show you the simple steps to get there. If you encounter any problem during the process or spot any information that should be added/updated, please don't hesitate to reach out to the [[#Developer_Mailing_List| Developer's mailing list]], on the [https://t.me/kdenlive_dev Telegram Kdenlive Developers' group] or the [https://webchat.kde.org/#/room/#kdenlive-dev:kde.org Developers' Matrix room].
Kdenlive is rather easy to build (at least on supported platforms), and this page should show you the simple steps to get there. If you encounter any problem during the process or spot any information that should be added/updated, please don't hesitate to reach out to the [[#Developer_Mailing_List| Developer's mailing list]], on the [https://t.me/kdenlive_dev Telegram Kdenlive Developers' group] or the [https://webchat.kde.org/#/room/#kdenlive-dev:kde.org Developers' Matrix room].


== Pre-requisites and Supported Platforms ==
== Building Instructions ==


Kdenlive is primarily developed on GNU/Linux. There is an effort to  [[Kdenlive/Development/WindowsBuild|build Kdenlive on Microsoft Windows]], but it's still a work in progress.
The building instructions have been moved to the [https://invent.kde.org/multimedia/kdenlive/-/blob/master/dev-docs/build.md dev-docs folder in the code tree].


Currently supported distributions are:
(the rest of this page should follow)  
 
* Ubuntu 20.04 LTS Focal Fossa and derivatives
* Arch Linux
 
You should be able to build it on any platform that provides up to date versions of the following dependencies  '''Qt >= 5.7''', '''KF5 >= 5.50''','''MLT >= 6.20.0'''.
 
To get a recent enough version fo MLT on Ubuntu, you have to add [https://launchpad.net/~kdenlive/+archive/ubuntu/kdenlive-master Kdenlive's ppa]
 
<pre>
sudo add-apt-repository ppa:kdenlive/kdenlive-master
sudo apt update
</pre>
 
It is recommended to uninstall the official kdenlive packages to avoid potential conflicts.
 
<pre>
sudo apt remove kdenlive kdenlive-data
</pre>
 
== Installing dependencies ==
 
 
=== Development tooling ===
 
You will need classical development tools (like git, gcc ...) but also cmake :
<pre>
sudo apt install build-essential git cmake extra-cmake-modules libsm-dev
</pre>
 
=== KDE Frameworks 5, based on Qt5 ===
 
On Ubuntu the following packages will pull all the necessary dependencies:
 
<pre>
sudo apt install libkf5archive-dev libkf5bookmarks-dev libkf5coreaddons-dev libkf5config-dev \
libkf5configwidgets-dev libkf5dbusaddons-dev libkf5kio-dev libkf5widgetsaddons-dev \
libkf5notifyconfig-dev libkf5newstuff-dev libkf5xmlgui-dev libkf5declarative-dev \
libkf5notifications-dev libkf5guiaddons-dev libkf5textwidgets-dev libkf5purpose-dev \
libkf5iconthemes-dev kdoctools-dev libkf5crash-dev libkf5filemetadata-dev kio \
kinit qtdeclarative5-dev libqt5svg5-dev qml-module-qtquick-controls libqt5networkauth5-dev \
qtmultimedia5-dev qtquickcontrols2-5-dev breeze-icon-theme
</pre>
 
=== Multimedia stack ===
 
If your distribution packages a recent enough version of MLT (>= 6.20.0), you can install it directly along with ffmpeg and frei0r plug-ins. Otherwise, you'll have to add our ppa or compile it yourself (see above)
 
<pre>
sudo apt install libmlt++-dev libmlt-dev melt frei0r-plugins ffmpeg
</pre>
 
=== Dependencies for localization  ===
 
There are some additional dependencies required by the specific script to fetch the translations:
<pre>
sudo apt install ruby subversion gnupg2 gettext
</pre>
 
== Getting the source code ==
 
=== Cloning the git  repo ===
The easiest  way to get Kdenlive source code is to clone the git repo:
 
<pre>
git clone https://invent.kde.org/multimedia/kdenlive.git
</pre>
 
=== Selecting the  branch ===
 
You should generally base your developments on the master branch
 
<pre>
cd kdenlive
git checkout master
</pre>
 
or if you want to get the code for a given release
 
<pre>
cd kdenlive
git checkout release/20.04
</pre>
 
==  Building Kdenlive ==
Create a directory for the build inside the kdenlive directory:
 
<pre>
mkdir build
cd build
</pre>
 
To avoid problems with plugins and libraries, it is easier to install Kdenlive in /usr:
 
<pre>
cmake .. -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_INSTALL_PREFIX=/usr -DRELEASE_BUILD=OFF
</pre>
 
Alternately you can build it with debug flags (advanced users only ;-)  and you need to have clang installed ) :
 
<pre>
cmake .. -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
-DECM_ENABLE_SANITIZERS='address' \
-DBUILD_TESTING=ON -DBUILD_FUZZING=ON -DBUILD_COVERAGE=OFF \
-DRELEASE_BUILD=OFF
</pre>
 
 
To compile the translations of the application, you need KDE Frameworks >= 5.76, make sure to delete the "po" subdirectory from your build folder if it exists, and use this cmake command to configure the project :
<pre>
cmake .. -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_INSTALL_PREFIX=/usr -DKDE_L10N_SYNC_TRANSLATIONS=ON -DRELEASE_BUILD=OFF
</pre>
 
You can automatically build and install a {{Path|*.qch}} file with the doxygen docs about the source code to use it with your IDE like Qt Assistant, Qt Creator or KDevelop. This can be activated in cmake line by appending
 
<pre>
-DBUILD_QCH=ON
</pre>
 
You can find the {{Path|kdenlive.qch}} at {{Path|build/src}} and after installation at {{Path | ${CMAKE_INSTALL_PREFIX}/lib/cmake/kdenlive }}
 
Then build and install:
<pre>
make -j5
sudo make install
</pre>
 
You can then start your compiled version by simply entering:
<pre>
kdenlive
</pre>
 
If you have compiled it in debug mode, you may encounter errors like
<pre>
SUMMARY: AddressSanitizer: new-delete-type-mismatch (/usr/bin/kdenlive+0x643020)  
==6982==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==6982==ABORTING
</pre>
 
As the hint says, the you can solve this with
<pre>
export ASAN_OPTIONS=new_delete_type_mismatch=0
</pre>


== Next Steps ==
== Next Steps ==

Revision as of 11:40, 18 April 2021

Kdenlive is rather easy to build (at least on supported platforms), and this page should show you the simple steps to get there. If you encounter any problem during the process or spot any information that should be added/updated, please don't hesitate to reach out to the Developer's mailing list, on the Telegram Kdenlive Developers' group or the Developers' Matrix room.

Building Instructions

The building instructions have been moved to the dev-docs folder in the code tree.

(the rest of this page should follow)

Next Steps

Once you've got a working dev environment, you should checkout the Contributing Guide and Coding Guide.

Now you can find some nice first issues to solve. Welcome on board!

A instruction of the workflow with KDE's GitLab can be found here. You can also gain more general knowledge by exploring the tutorials on TechBase.

IDE Setup

Pick your favourite!

Setting up KDevelop

Open KDevelop and go to Project > Open/Import project Then select the CMakeLists.txt file in the kdenlive source folder. You can now start hacking on Kdenlive!

Setting up QtCreator

After checking out Kdenlive from git—when working on refactoring, you may want to clone two copies, one with the next branch and another one on the refactoring branch—, you can open the CMakeLists.txt in QtCreator, which will load the project if cmake succeeds. If you run/debug Kdenlive, make sure that kdenlive and not kdenlive_render is selected as an active project.

If you let QtCreator restore the previous session (FileSession manager), it will remember the open documents. Environment variables (see below) can be set in Projects > Build Environment.

If you genearated a kdenlive.qch file, you can add it to Qt Creator with ToolsOptionsHelpDocumentationAdd

MLT documentation

Kdenlive uses MLT’s C++ API called mlt++. This API is not documented as it is simply a wrapper to C functions. For example, the documentation of Mlt::Consumer::position() can be found in framework/mlt_consumer.c:mlt_consumer_position(). The actual C function name is usually a combination of the class name and the function name, but can also be found by consulting mlt++/MltConsumer.cpp:position().

Environment variables

If kdenlive crashes on startup (e.g. in QtCreator) and shows a message like:

   kdenlive(24309) KXMLGUIClient::setXMLFile: cannot find .rc file "kdenliveui.rc" for component "kdenlive"

then you have to ensure the .rc file is found. If CMake is configured to install Kdenlive to /usr/local, the .rc file is put there, but when kdenlive is then run from the build directory, the KXMLGUIClient will not search there. Solution: Set the environment variable KDEDIRS to $KDEDIRS:/usr/local.

You can get more information about the paths that are checked by running kdenlive like this:

   strace build/src/kdenlive 2>&1 | grep kdenliveui.rc

Wayland

To avoid flickering here are some Kdenlive envvars that work with Sway?

QT_QPA_PLATFORM=wayland-egl
SDL_VIDEODRIVER=wayland
XDG_SESSION_TYPE=wayland

Contact

Chat

There are several chat groups on Telegram and Matrix. The groups existing on both services are bridged via a bot so you can choose your preferred one. Not all groups exist an all services.

Telegram

Matrix

Mailing List

The kdenlive developer mailing list archives can be found here

A searchable archive of the kdenlive developer mailing list can be found here

Information on how to subscribe can be found here