KDevelop/HowToCompile v5: Difference between revisions

From KDE Community Wiki
(Add command for building essential modules of KDevelop)
m (added "Build it" link from kdevelop.org home page)
 
(21 intermediate revisions by 5 users not shown)
Line 1: Line 1:
See also: http://kfunk.org/2016/02/16/building-kdevelop-5-from-source-on-ubuntu-15-10/
See also: http://kfunk.org/2016/02/16/building-kdevelop-5-from-source-on-ubuntu-15-10/


'''NOTE:''' This page is about KDevelop 5, i.e. version that depends on Qt5 and KF5. For instructions on how to build KDevelop 4 against KDELibs4 and Qt4 head over to [[KDevelop/HowToCompile_v4]].
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.
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.
Line 9: Line 9:


     find /usr/ -type f -name "*kdev*.so*"
     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.
If no results are returned, you should be on the safe side.
Line 16: Line 18:
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
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 and all its dependencies is as simple as running
Once done, building KDevelop is as simple as running


     kdesrc-build --include-dependencies kdevelop
     kdesrc-build kdevelop-pg-qt kdevelop


Note though that this will also install the KF5 frameworks. The initial compile step will thus take a bit of time, but subsequent updates using the same command above are usually much faster.
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.


Building only the essential modules of KDevelop is as simple as running
To install the essential non-KDE dependencies, run this command: (the list is not yet complete)


     kdesrc-build kdevplatform kdevelop-pg-qt kdevelop
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) ==
== 2. Get and install plugins (optional) ==
Line 34: Line 43:
== 3. Run KDevelop ==
== 3. Run KDevelop ==


Make sure your environment is setup correctly according to https://community.kde.org/Frameworks/Building#Runtime_setup. Most notably, ensure that you configured <tt>QT_PLUGIN_PATH</tt> properly, otherwise KDevelop won't work properly as it is heavily plugin based.  
Make sure your environment is setup correctly. Most notably, ensure that you configured <tt>QT_PLUGIN_PATH</tt> properly, otherwise KDevelop won't work properly as it is heavily plugin based.  
 
You need to make sure the environment variables <i>PATH</i>, <i>QT_PLUGIN_PATH</i> are set properly before running kdevelop. In order to do so run the source command to load the generated <i>prefix.sh</i> script in KDevelop's build folder.
 
    source ~/kde/build/kdevelop/prefix.sh


Once done, execute KDevelop, either by putting <tt>$KF5/bin</tt> into your <tt>PATH</tt>, or by running it directly:
Once done, start the kdevelop executable from the terminal:


        $KF5/bin/kdevelop
    kdevelop


== 4. Contact the development team, or report bugs or wishes ==
== 4. Contact the development team, or report bugs or wishes ==
Line 46: Line 59:


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 <tt>-DCMAKE_BUILD_TYPE=debug</tt>
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 <tt>-DCMAKE_BUILD_TYPE=debug</tt>
passed to CMake in configuration step. Also be sure to update KDevelop and KDevPlatform to newest version, your bug might be already fixed.
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 ==
== 5. Keeping it up-to-date with the latest fixes ==
Line 52: Line 65:
Just rerun the <tt>kdesrc-build</tt> command above to update KDevelop and its dependencies.
Just rerun the <tt>kdesrc-build</tt> command above to update KDevelop and its dependencies.


You can also see here [https://projects.kde.org/projects/extragear/kdevelop/ the latest changes] in the KDevelop projects.
You can also see here the latest changes in the KDevelop projects:
* [https://commits.kde.org/kdevelop-pg-qt kdevelop-pg-qt]
* [https://commits.kde.org/kdevelop kdevelop]
* [https://commits.kde.org/kdev-python kdev-python]
* [https://commits.kde.org/kdev-php kdev-php]


== 6. Manual compilation without kdesrc-build ==
== 6. Manual compilation without kdesrc-build ==

Latest revision as of 06:35, 19 September 2023

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