KDevelop/HowToCompile v5

From KDE Community Wiki
Revision as of 06:35, 19 September 2023 by Brunorcabral (talk | contribs) (added "Build it" link from kdevelop.org home page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

See also: http://kfunk.org/2016/02/16/building-kdevelop-5-from-source-on-ubuntu-15-10/

See also: https://kdevelop.org/build-it/

The way to download, compile, install and run KDevelop depends on how you want to download it and where do you want to install it to. So follow the step by step instructions below.

WARNING: You have to remove all KDevelop packages provided by your distribution. If you don't do that, binary compatibility issues will eventually lead to crashes and undefined behavior. To make sure, you can search for KDevelop libraries with this command:

   find /usr/ -type f -name "*kdev*.so*"

So it is much easier in the beginning to use the ready-made and complete KDevelop AppImage from e.g. https://download.kde.org/stable/kdevelop/5.6.1/bin/linux/KDevelop-5.6.1-x86_64.AppImage. This does not mean that there will be no issues, though.

If no results are returned, you should be on the safe side.

1. Building with kdesrc-build

The recommended way to install KDevelop 5 is using kdesrc-build. You can find more information on how to set it up here: https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source

Once done, building KDevelop is as simple as running

   kdesrc-build kdevelop-pg-qt kdevelop

Note: if you generated the kdesrc-buildrc file using kdesrc-build-setup, this will have set the option "include-dependencies" to "true". As a result also all dependencies developed in the KDE community will be fetched, compiled and installed. If you do not want that, edit the kdesrc-buildrc file and change the option value to "false". Those dependencies developed in the KDE community include e.g. the complete KDE Frameworks. The initial compile step will thus take quite some time and storage space, but subsequent updates using the same command above are usually much faster. Be aware that the KDE Frameworks tend to depend on newer versions of dependencies like Qt5 than KDevelop itself does. So best only include the build of all KDE dependencies yourself if you really need to. KDevelop itself tries to be buildable on the latest LTS versions of the major Linux distributions.

To install the essential non-KDE dependencies, run this command: (the list is not yet complete)

1. deb-based distributions (Debian, Neon, Kubuntu...)

   sudo apt-get install libbz2-dev libxslt-dev libxml2-dev shared-mime-info oxygen-icon-theme libgif-dev libvlc-dev libvlccore-dev doxygen gperf bzr libxapian-dev fontforge libgcrypt20-dev libattr1-dev network-manager-dev libgtk-3-dev xsltproc xserver-xorg-dev xserver-xorg-input-synaptics-dev libpwquality-dev modemmanager-dev libxcb-keysyms1-dev libepoxy-dev libpolkit-agent-1-dev libnm-util-dev libnm-glib-dev libegl1-mesa-dev libxcb-xkb-dev libqt5x11extras5-dev libwww-perl libxml-parser-perl libjson-perl libboost-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libarchive-dev liblmdb-dev cmake git libkomparediff2-dev extra-cmake-modules "libkf5.*-dev" llvm libclang-dev

2. Arch Linux

   pacman -Sy --needed extra-cmake-modules clang llvm

3. openSUSE Tumbleweed

   zypper install libboost_headers-devel grantlee5-devel karchive-devel kcmutils-devel kconfig-devel kcrash-devel kdeclarative-devel kdevelop5-pg-qt kdoctools-devel kf5-filesystem kguiaddons-devel ki18n-devel kiconthemes-devel kio-devel kitemmodels-devel kitemviews-devel kjobwidgets-devel knewstuff-devel knotifications-devel knotifyconfig-devel kparts-devel krunner-devel kservice-devel ktexteditor-devel kwidgetsaddons-devel kwindowsystem-devel kxmlgui-devel libksysguard5-devel llvm-clang-devel pkgconfig plasma-framework-devel shared-mime-info threadweaver-devel libkomparediff2-kf5-devel purpose-devel libQt5Concurrent-devel libQt5Core-devel libQt5DBus-devel  libqt5-qttools-devel libqt5-qtdeclarative-devel libQt5Test-devel libqt5-qtwebengine-devel libQt5Widgets-devel subversion-devel okteta-devel

2. Get and install plugins (optional)

If you need extra functionality, you can get and install additional plugins for KDevelop using kdesrc-build. E.g. to install kdev-php and kdev-python, run

   kdesrc-build kdev-php kdev-python

3. Run KDevelop

Make sure your environment is setup correctly. Most notably, ensure that you configured QT_PLUGIN_PATH properly, otherwise KDevelop won't work properly as it is heavily plugin based.

You need to make sure the environment variables PATH, QT_PLUGIN_PATH are set properly before running kdevelop. In order to do so run the source command to load the generated prefix.sh script in KDevelop's build folder.

    source ~/kde/build/kdevelop/prefix.sh

Once done, start the kdevelop executable from the terminal:

    kdevelop

4. Contact the development team, or report bugs or wishes

If you find any compile problems with KDevelop please report them on our developer mailing-list. If you find problems while using KDevelop, please report these issues to the bugzilla bug database which is only for bugs (not for compilation issues).

If you find bugs that cause program to crash and you are going to make bug report out of it, please re-compile the program with debug symbols. This is done with the option -DCMAKE_BUILD_TYPE=debug passed to CMake in configuration step. Also be sure to update KDevelop and any separate kdev-* plugin you might use to newest version, your bug might be already fixed.

5. Keeping it up-to-date with the latest fixes

Just rerun the kdesrc-build command above to update KDevelop and its dependencies.

You can also see here the latest changes in the KDevelop projects:

6. Manual compilation without kdesrc-build

This approach is useful if you just want to compile and use KDevelop5 on your day to day system. This works on a Debian system, and probably on Debian derived distributions such as Ubuntu or KDE NEON.

Follow instructions at "https://wiki.debian.org/BuildingTutorial" or similar to download & build the source packages of kdevelop + its dependencies, including running these commands:

   sudo apt-get source kdevelop
   sudo apt-get build-dep kdevelop