KDevelop/HowToCompile v4: Difference between revisions

From KDE Community Wiki
No edit summary
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
'''NOTE:''' This page is about KDevelop 4, i.e. version that depends on Qt4 and KDELibs4. For instructions on how to build KDevelop 5 against KF5 and Qt5 head over to [[KDevelop/HowToCompile_v5]]


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 10: Line 11:


== 1. Get the requirements ==
== 1. Get the requirements ==
Make sure to install the required KDE development packages, see [[KDevelop4/requirements]] for a list of requirements. In particular make sure to install KDE4 kdelibs development packages. At least following packages are required:
Make sure to install the required KDE development packages, see [[KDevelop4/requirements]] for a list of requirements. In particular make sure to install KDE4 kdelibs development packages.
 
===Ubuntu (Virtualised)===
*Download Kubuntu 14.10 Plasma Release:
    wget http://ftp5.gwdg.de/pub/linux/kde/extrafiles/snapshots/kubuntu-plasma5/kubuntu-plasma5-14.10-desktop-amd64.iso
 
*Install on KVM or Virtualbox
 
*Install dependencies
    sudo apt-get install cmake gcc g++ kdelibs5-dev zlib1g-dev git aptitude extra-cmake-modules \
        qt5-default qt5-default qtscript5-dev libqt5webkit5-dev  libkf5archive-dev \
        libkf5config-dev libKF5GuiAddons-dev libKF5I18n-dev libKF5ItemModels-dev \
        libKF5ItemViews-dev libKF5JobWidgets-dev libKF5KCMUtils-dev  libKF5NewStuff-dev \
        libKF5NotifyConfig-dev libKF5Parts-dev libKF5Sonnet-dev  libKF5TextEditor-dev \
        libKF5ThreadWeaver-dev  libKF5WindowSystem-dev libKF5Declarative-dev \
        libKF5KDELibs4Support-dev qttools5-dev libkomparediff2-dev libboost-all-dev
 
===Grantlee===
*Download:
    cd $home/src
    wget http://downloads.grantlee.org/grantlee-5.0.0.tar.gz
*Unpack:
    cd $HOME/src
    tar xvjf grantlee-5.0.0.tar.gz
*Build (This will configure to install it to your system)
    cd $HOME/src/grantlee-5.0.0
    mkdir -p $HOME/src/grantlee-5.0.0/build
    cd $HOME/src/grantlee-5.0.0/build
    cmake -DCMAKE_INSTALL_PREFIX=/usr ../
    make
*Install
    sudo make install


===Legacy===
===Legacy===
Line 83: Line 53:
first we'll explain the local install.
first we'll explain the local install.


In both cases you need set the KDEDIRS environment variable to point to the installation directory of both KDE4 and KDevPlatform.
For legacy KDevelop with KDE4, you need to set the KDEDIRS environment variable to point to the installation directory of both KDE4 and KDevPlatform. For the development version based on Frameworks 5, refer to the [https://community.kde.org/Frameworks/Building#Runtime_setup|Frameworks building and runtime setup guide] for hints on how to setup your environment.


This will tell KDE core components where to search for plugins and other data related to KDE apps and contains just a list of paths (aka prefixes) where KDE libraries and/or applications have been installed.
This will tell KDE core components where to search for plugins and other data related to KDE apps and contains just a list of paths (aka prefixes) where KDE libraries and/or applications have been installed.
Line 122: Line 92:


And it needs to have execution permissions. If you want to use it directly, you'll have to logout of your current KDE session and log in again, otherwise this script won't be sourced of course...
And it needs to have execution permissions. If you want to use it directly, you'll have to logout of your current KDE session and log in again, otherwise this script won't be sourced of course...
Also, '''splash.qml''' needs to be found under '''/usr/share/kdevelop''' directory, otherwise the version of kdevelop will crash. You have two options to solve this:
Create a symlink (needs root privileges):
    ln -s /home/<your user name>/kdevelop4/share/kdevelop/ /usr/share
or
Modify XDG_DATA_DIRS:
    export XDG_DATA_DIRS=/home/<your user name>/kdevelop4/share/:$XDG_DATA_DIRS


=== System installation ===
=== System installation ===
Line 170: Line 150:


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 options
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 options
<pre>-DCMAKE_BUILD_TYPE=debugfull</pre>
<pre>-DCMAKE_BUILD_TYPE=Debug</pre>
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 kdevplatform to newest version, your bug might be already fixed.



Latest revision as of 10:52, 11 March 2016

NOTE: This page is about KDevelop 4, i.e. version that depends on Qt4 and KDELibs4. For instructions on how to build KDevelop 5 against KF5 and Qt5 head over to KDevelop/HowToCompile_v5

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*"

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

1. Get the requirements

Make sure to install the required KDE development packages, see KDevelop4/requirements for a list of requirements. In particular make sure to install KDE4 kdelibs development packages.

Legacy

In Fedora 13: kdelibs-devel kdebase-workspace-devel

In Ubuntu 11.04: cmake gcc g++ kdelibs5-dev zlib1g-dev kdebase-workspace-dev libgrantlee-dev

In Debian: same as ubuntu, but you also need to compile at Grantlee in at least version 0.1.7, though I suggest to use the latest stable release. See http://downloads.grantlee.org/ and http://www.gitorious.org/grantlee/pages/Home

When configuring kdevplatform, these packages are needed to remedy the following errors: kdelibs5-dev: ERROR: Could not find KDE4 kde4-config zlib1g-dev: Could NOT find ZLIB

When configuring kdevelop, these packages are needed to remedy the following errors:

Could NOT find KDE4Workspace

2. Get the sources (assumes $HOME/src but you can replace it with something else)

  • By downloading it to $HOME/src
    • download kdevplatform.tar.bz2 and kdevelop.tar.bz2 from http://kdevelop.org/ (see right sidebar for download links)
    • unpack them:
             cd $HOME/src
             tar xvjf kdevplatform.tar.bz2
             tar xvjf kdevelop.tar.bz2
  • Or, by getting the latest master branch sources directly out of the Git server
       git clone git://anongit.kde.org/kdevplatform $HOME/src/kdevplatform
       git clone git://anongit.kde.org/kdevelop $HOME/src/kdevelop

Please note that this branch will depend on MovingRange in Kate, meaning KDE 4.5 and above. This can be updated by doing sudo yum update kdelibs or equivalent.

  • Or, by getting the latest 4.5-branch sources directly out of the Git server. First you need to do clone git reposity as above, and then tell git to use branch 1.5 for kdevplatform and branch 4.5 for kdevelop:
       cd  $HOME/src/kdevplatform ; git checkout -b 1.5 origin/1.5
       cd  $HOME/src/kdevelop ; git checkout -b 4.5 origin/4.5

3. Configure and install

You can do a system install of KDevelop in the default path (/usr/local), which needs root privileges, or you can install it locally for your user only. The instructions for both are slightly different; first we'll explain the local install.

For legacy KDevelop with KDE4, you need to set the KDEDIRS environment variable to point to the installation directory of both KDE4 and KDevPlatform. For the development version based on Frameworks 5, refer to the building and runtime setup guide for hints on how to setup your environment.

This will tell KDE core components where to search for plugins and other data related to KDE apps and contains just a list of paths (aka prefixes) where KDE libraries and/or applications have been installed.

Assuming that you have the KDE4 libraries installed in /usr (these are often from packages and installed in /usr or /opt/kde and is distro specific, if unsure ask your distro where it is), you'll have to append it to the KDEDIRS below.

Local installation

The following commands give instructions to install in $HOME/kdevelop4; you can of course replace it with something else. You don't need root permissions to install KDevelop this way.

First, compile and install KDevPlatform:

   mkdir -p $HOME/src/kdevplatform/build
   cd $HOME/src/kdevplatform/build
   cmake -DCMAKE_INSTALL_PREFIX=$HOME/kdevelop4 ../
   make
   make install

Then compile KDevelop, telling it to use the just-installed KDevPlatform:

   mkdir -p $HOME/src/kdevelop/build
   cd $HOME/src/kdevelop/build
   cmake -DCMAKE_PREFIX_PATH=$HOME/kdevelop4 -DCMAKE_INSTALL_PREFIX=$HOME/kdevelop4 ../
   make
   make install

Before running KDevelop, you need set the KDEDIRS environment variable. Assuming that you want to install KDevelop4 into $HOME/kdevelop4 then you need to run the following:

   export KDEDIRS=$HOME/kdevelop4:$KDEDIRS
   kbuildsycoca4

Note that this will set the KDEDIRS variable only for that shell (so launching kdevelop from desktop launcher will fail). A good solution is to add to a small script to $HOME/.kde/env that sets the KDEDIRS variable to proper. For example you may call it $HOME/.kde/env/kdedirs.sh and it could contain:

   #!/bin/bash
   export KDEDIRS=/usr/local/:$KDEDIRS

And it needs to have execution permissions. If you want to use it directly, you'll have to logout of your current KDE session and log in again, otherwise this script won't be sourced of course...

Also, splash.qml needs to be found under /usr/share/kdevelop directory, otherwise the version of kdevelop will crash. You have two options to solve this:

Create a symlink (needs root privileges):

   ln -s /home/<your user name>/kdevelop4/share/kdevelop/ /usr/share

or

Modify XDG_DATA_DIRS:

   export XDG_DATA_DIRS=/home/<your user name>/kdevelop4/share/:$XDG_DATA_DIRS

System installation

First, compile and install KDevPlatform:

   mkdir -p $HOME/src/kdevplatform/build
   cd $HOME/src/kdevplatform/build
   cmake ../
   make
   sudo make install

Then compile KDevelop:

   mkdir -p $HOME/src/kdevelop/build
   cd $HOME/src/kdevelop/build
   cmake ../
   make
   sudo make install

Before running it, you need to set KDEDIRS properly as in local installation but with path as /usr/local/.

4. Get and install plugins (optional)

If you need extra functionality, you can get and install additional plugins for KDevelop4. Stable plugins can be found in Extragear: https://projects.kde.org/projects/extragear/kdevelop/plugins . Experimental, potentially unstable or even broken plugins can be found in Playground: https://projects.kde.org/projects/playground/devtools/plugins .

Many plugins you can find there (e.g. PHP, CSS, QMake, ...) require the KDevelop-PG-Qt parser generator. You can find that here: https://projects.kde.org/projects/extragear/kdevelop/utilities/kdevelop-pg-qt

Check the sources out and compile the plugin using the same steps as above, e.g. for PHP:

   mkdir -p $HOME/src/kdev-php/build
   cd $HOME/src/kdev-php/build
   cmake -DCMAKE_PREFIX_PATH=$HOME/kdevelop4 -DCMAKE_INSTALL_PREFIX=$HOME/kdevelop4 ../
   make
   make install

Make sure to run kbuildsycoca4 after installation (see above)!

5. Run KDevelop

Just execute:

       $HOME/kdevelop4/bin/kdevelop

(If you want to ease it, you can add $HOME/kdevelop4/bin/ to your $PATH env variable).

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

If you find any compile problems with KDevelop4 please report them on our developer mailing-list. If you find problems while using KDevelop4 use, 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 options

-DCMAKE_BUILD_TYPE=Debug

passed to cmake in configuration step. Also be sure to update kdevelop and kdevplatform to newest version, your bug might be already fixed.

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

If you got the sources from the git repository on step 2. then you can update by issuing the following commands:

  • with root permissions do this
       cd $HOME/src/kdevelop/build && sudo make uninstall
       cd $HOME/src/kdevplatform/build && sudo make uninstall
       cd $HOME/src/kdevplatform && git pull
       cd $HOME/src/kdevplatform/build && make && sudo make install
       cd $HOME/src/kdevelop && git pull
       cd $HOME/src/kdevelop/build && make && sudo make install
       kbuildsycoca4
  • Or if installed in local directory
       cd $HOME/src/kdevelop/build && make uninstall
       cd $HOME/src/kdevplatform/build && make uninstall
       cd $HOME/src/kdevplatform && git pull
       cd $HOME/src/kdevplatform/build && make && make install
       cd $HOME/src/kdevelop && git pull
       cd $HOME/src/kdevelop/build && make && make install
       kbuildsycoca4

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

8. Troubleshooting

  • When running cmake on KDevelop, you get "Could NOT find KDE4Workspace". You need to install the kdebase-workspace-dev package.