Developer Blogs en Building KDevelop 5 from source on Ubuntu 15.10 <blockquote> <p>Note: These instructions apply for Ubuntu 16.04, too</p> </blockquote> <p>Recently, I've got several mails from people desperately trying to compile KDevelop on Ubuntu-based distros. Let's give them a hand by providing them a quick start guide!</p> <p>This is a brief version of what's in <a href=""></a> (which <em>really</em> needs a major overhaul at this point -- lots of outdated or redundant information in there. <em>I</em> also had my trouble setting this up from scratch, believe me or not)</p> <p>I've tested this HOWTO on a fresh <em>Ubuntu 15.10</em> VM.</p> <h1 id="setup">Setup</h1> <p>Disclaimer: This HOWTO will just compile the bare minimum, we're not going to compile either of Qt5, KF5 or LLVM/Clang. We'll happily chose the distro package of a needed dependency when available.</p> <h2 id="installrequireddependencies">Install required dependencies</h2> <p>Start a terminal (konsole, xterm, your choice)</p> <pre><code class="language-bash">$ sudo apt-get build-dep qtbase5-dev $ 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 extra-cmake-modules "libkf5.*-dev" llvm llvm-3.6 libclang-3.6-dev </code></pre> <h2 id="gitremoteprefix">Git remote prefix</h2> <p>Let's setup a "kde:" prefix for git commands. Add the following text to your ~/.gitconfig:</p> <pre><code class="language-ini">[url "git://"] insteadOf = kde: [url "ssh://"] pushInsteadOf = kde: </code></pre> <h2 id="installkdesrcbuild">Install kdesrc-build</h2> <p><em>kdesrc-build</em> is, simply put, a user-space package manager, which compiles KDE-related projects from source and installs them into a designated directory.</p> <p>Let's set up <em>kdesrc-build</em> to install KDevelop into our <em>$HOME</em>:</p> <pre><code class="language-bash">mkdir ~/kdesrc cd ~/kdesrc git clone kde:kdesrc-build cd kdesrc-build cp kdesrc-buildrc-kf5-sample ~/.kdesrc-buildrc # Install a symlink of kdesrc-build to a location in PATH mkdir ~/bin ln -s $PWD/kdesrc-build ~/bin export PATH=~/bin:$PATH </code></pre> <p>You should append the line <code>export PATH=~/bin:$PATH</code> to ~/.bashrc so <code>kdesrc-build</code> is available in PATH everytime you open a terminal.</p> <h3 id="configurekdesrcbuild">Configure kdesrc-build</h3> <pre><code>edit ~/.kdesrc-buildrc </code></pre> <p>Replace <code>/path/to/kdesrc-build/kf5-qt5-build-include</code> with <code>~/kdesrc/kdesrc-build/kf5-qt5-build-include</code> in that file</p> <p>Add <code>ignore-kde-structure true</code> and <code>make-options -jN</code> to the <em>global</em> section in ~/.kdesrc-buildrc (this will make your life easier...):</p> <pre><code class="language-perl">global ... ignore-kde-structure true make-options -j5 # NOTE: 5 is the number of jobs, this should usually be (number-of-cpu-cores + 1) ... end global </code></pre> <h2 id="installingkdevelopanddependencies">Installing KDevelop and dependencies</h2> <p>Let <em>kdesrc-build</em> handle the compilation + installation of KDevelop and its (direct) dependencies</p> <pre><code class="language-bash">$ kdesrc-build --debug libkomparediff2 grantlee kdevplatform kdevelop-pg-qt kdevelop </code></pre> <p>The <em>--debug</em> parameter will give you the verbose output, all command invocations and compiler output. Helpful for trouble-shooting.</p> <p>Note: If you ever want to update+recompile your complete KDevelop checkout(s), you simply run above command again (it'll reuse your old build information, so it'll just recompile the bare minimum)</p> <h2 id="settingupascriptforpreparingtheenvironment">Setting up a script for preparing the environment</h2> <p>Copy these commands to a new file called <em>~/.env-kf5</em>: </p> <pre><code class="language-bash">export KF5=~/kde-5 export QTDIR=/usr export CMAKE_PREFIX_PATH=$KF5:$CMAKE_PREFIX_PATH export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg export PATH=$KF5/bin:$QTDIR/bin:$PATH export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH # (lib64 instead of lib, on OpenSUSE and similar) export QML2_IMPORT_PATH=$KF5/lib/qml:$KF5/lib64/qml:$KF5/lib/x86_64-linux-gnu/qml:$QTDIR/qml export QML_IMPORT_PATH=$QML2_IMPORT_PATH export KDE_SESSION_VERSION=5 export KDE_FULL_SESSION=true </code></pre> <h1 id="runningkdevelop">Running KDevelop</h1> <p>Every time you want to use your self-compiled KDevelop, you simply spawn a new terminal, and then run: </p> <pre><code class="language-bash">$ source ~/.env-kf5 $ kdevelop </code></pre> <p>That's it already! You should have a working version of KDevelop 5 running now!</p> <h1 id="hackingonkdevelop">Hacking on KDevelop</h1> <p>Enter the source directory, edit files (of course you can do that by importing <em>~/kdesrc/kdevelop</em> into KDevelop, too!</p> <pre><code class="language-bash">$ cd ~/kdesrc/kdevelop &lt;edit files&gt; </code></pre> <p>Now, to recompile kdevelop, just invoke kdesrc-build again: </p> <pre><code class="language-bash">$ kdesrc-build --debug kdevelop </code></pre> <p><em>OR</em> just go to the build directory and invoke:</p> <pre><code class="language-bash">$ cd ~/kdesrc/build/kdevelop $ make install </code></pre> <p>Restart KDevelop: </p> <pre><code class="language-bash">$ kdevelop </code></pre> <p>--</p> <p>The same procedure applies for the kdevplatform repository -- in case you need to work on that part of KDevelop: </p> <pre><code class="language-bash">$ cd ~/kdesrc/kdevplatform &lt;edit files&gt; ... </code></pre> <p>You're ready to contribute your patch now!</p> <h2 id="contributingpatches">Contributing patches</h2> <p>The recommended way to contribute patches it to post them to KDE's <em>Phabricator</em> instance. The easiest way to create patches is to use Phabricator's <em>Arcanist</em> command-line tool.</p> <p>The <em>very</em> brief version of what you have to do is: </p> <pre><code class="language-bash">$ cd ~/kdesrc/kdevelop &lt;edit files&gt; $ arc diff &lt;arc will guide you through the required steps&gt; </code></pre> <p>See here for more details: <a href=""></a> (in case you're not familiar with Arcanist at all)</p> <h1 id="troubleshooting">Troubleshooting</h1> <h2 id="problemswithkdesrcbuild">Problems with kdesrc-build</h2> <p>In case kdesrc-build fails it will usually print a few lines like this at the end of the run:</p> <pre><code class="language-bash">&lt;&lt;&lt; PACKAGES FAILED TO BUILD &gt;&gt;&gt; libkomparediff2 - ~/kdesrc/log/2016-02-16-07/libkomparediff2/cmake.log :-( </code></pre> <p>Inspect that log to figure out what's going on:</p> <pre><code class="language-bash">$ cat ~/kdesrc/log/2016-02-16-07/libkomparediff2/cmake.log CMake Error at CMakeLists.txt:5 (find_package): Could not find a package configuration file provided by "ECM" (requested version 0.0.9) with any of the following names: ECMConfig.cmake ecm-config.cmake Add the installation prefix of "ECM" to CMAKE_PREFIX_PATH or set "ECM_DIR" to a directory containing one of the above files. If "ECM" provides a separate development package or SDK, be sure it has been installed. </code></pre> <p>In this case: the ECM (extra cmake modules) package is missing. The way you usually fix these kind of problems is to head over to <a href=""></a> and search for the distro package providing a particular file (<em>ECMConfig.cmake</em> in this case). </p> <p>So the <a href=";keywords=ECMConfig.cmake&amp;mode=exactfilename&amp;suite=wily&amp;arch=any">package search</a> reveals <code>extra-cmake-modules</code> being a hot candidate; to fix above error we simply install the package and the restart the build:</p> <pre><code class="language-bash">$ apt-get install extra-cmake-modules &lt;restart build&gt; $ kdesrc-build ... </code></pre> <p>The error should be gone now.</p> <h1 id="help">Help</h1> <p>We're highly active in IRC, feel free to join us by visiting #kdevelop on Freenode. A web-based client can be found here: <a href=""></a></p> <p>Just contact one of the core developers with the nick names <strong>milian</strong>, <strong>scummos</strong>, <strong>apol</strong> or <strong>kfunk</strong> if you need help.</p> <p>The other way to get in touch is to write a mail to <a href=""></a></p> <p>See here for details on how to reach us: <a href=""></a></p> <p>We're always trying to be as helpful as possible!</p> <p>Enjoy!</p> Tue, 16 Feb 2016 10:11:50 +0000 Kevin Funk add159df-d82f-44a7-b289-ada912fcea33 kdev-python on Windows: try it! <p>I spent the last two or three days playing around with KDE on Windows, with the aim of getting my Python language plugin for KDevelop to run there. In the end, it wasn&#8217;t that hard to get this to work &#8212; not as hard as I would have expected it to be, anyways. Several things needed to be fixed in kdev-python, the build system required a bit of tickling, but finally I produced an installer for KDevelop 4.90.92 which contains kdev-python:</p> <p><a href=""></a> (SHA256: aa12f8b695c391b5b51fbba112d1ea3d10e9f032262cb8181be634387cd75fcc)</p> <p>(Update: I&#8217;ll put future updates to the installer into <a href=""></a>, look there for news; I won&#8217;t update the link in the post every time)</p> <p>Don&#8217;t consider this a beta release or something. It&#8217;s just the current state of things.</p> <p>You can just run this installer, launch KDevelop, and it should all work. To get completion for the Python standard libary, you need to have a Python interpreter (e.g. from installed and in your PATH before you start KDevelop. The kdev-python debugger currently does not work (or actually it does work, but the toolbar to control it is missing *grin*). Also it&#8217;s probably all a bit slow, because I built some components in debug mode &#8230; I think.</p> <p>Note that KDevelop on windows still has a few quirks, and kdev-python on windows probably has a few extra quirks on its own, so don&#8217;t expect this to be too stable. That said, I loaded large amounts of code into it and it didn&#8217;t crash and seemed to work just fine.</p> <p>Here&#8217;s a few screenshots:</p> <figure id="attachment_418" style="width: 800px" class="wp-caption aligncenter"><a href="" rel="attachment wp-att-418"><img class="wp-image-418" src="" alt="completion" width="800" height="500" /></a><figcaption class="wp-caption-text">Code completion</figcaption></figure> <figure id="attachment_419" style="width: 800px" class="wp-caption aligncenter"><a href="" rel="attachment wp-att-419"><img class="wp-image-419" src="" alt="outline" width="800" height="500" /></a><figcaption class="wp-caption-text">Outline view</figcaption></figure> <figure id="attachment_420" style="width: 800px" class="wp-caption aligncenter"><a href="" rel="attachment wp-att-420"><img class="wp-image-420" src="" alt="run" width="800" height="500" /></a><figcaption class="wp-caption-text">Run program (make sure to have python.exe in your PATH or provide the full path to the python interpreter in the &#8220;Configure launches&#8221; dialog)</figcaption></figure> <figure id="attachment_421" style="width: 800px" class="wp-caption aligncenter"><a href="" rel="attachment wp-att-421"><img class="wp-image-421" src="" alt="tooltip" width="800" height="500" /></a><figcaption class="wp-caption-text">variable tooltips</figcaption></figure> <p>Let me know if this works for you, or what problems you encounter.</p> <p>Kudos to Kevin Funk for doing lots of work on KDevelop on Windows and helping me set this up!</p> Sat, 06 Feb 2016 15:19:46 +0000 sven