2

Currently I am trying to create a brand new project using KDevelop 4.7.3. I am also targeting Qt5. When I attempt to create a new project using the template for a Qt Gui project it creates a Qt4 project and then I alter the cmake file to Qt5, but in either state Qt4, or Qt5 it doesn't find the library header files to do semantic analysis, or even compile.

Just curious how to fix this issue. I have Qt Creator installed(works fine) and KDevelop on Kubuntu so I am assuming I have the required libraries already, but let me know if I am missing something.

Below is the make file that it automatically creates with a few additions on my part. Please edit as necessary.

cmake_minimum_required(VERSION 2.8)
project(stickykey)
find_package(Qt5Core)

find_package(Qt5 REQUIRED Gui Widgets)
find_package(Qt5Widgets)

# # The Qt5Widgets_INCLUDES also includes the include directories for
#   # dependencies QtCore and QtGui
  include_directories(${Qt5Widgets_INCLUDES})
# 
#   # We need add -DQT_WIDGETS_LIB when using QtWidgets in Qt 5.
  add_definitions(${Qt5Widgets_DEFINITIONS})
# 
#   # Executables fail to build with Qt 5 in the default configuration
#   # without -fPIE. We add that here.
#   set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})

set(StickyKey_SRCS StickyKey.cpp main.cpp)

#qt5_automoc(${StickyKey_SRCS})
add_executable(stickykey ${StickyKey_SRCS})
target_link_libraries(stickykey ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} Qt5::Widgets)

install(TARGETS stickykey RUNTIME DESTINATION bin)
Goddard
  • 4,860

1 Answers1

0

UPDATE PPA

Supposedly this PPA will do the trick, but I haven't tried it as I am just using the git version so I can more easily build newer version in the future. If you want a nice packaged version then here is the launchpad. https://launchpad.net/~blaze/+archive/ubuntu/kf5/

CONTINUE BELOW FOR SOURCE COMPILE FROM KDE

I figured out how to solve the problem and it is pretty simple given the steps are written out and you can follow along. If you aren't comfortable compiling yourself though you might want to just wait for either a PPA, or backports at least if you are going to stick with 16.04.

In order to fix this issue you can either manually add all the correct paths while using the packaged version of Kdevelop, or you can build it from source.

I am using a version built from source and I can use it while still having the old version installed so if you follow the directions you should have two working version of KDevelop that do not conflict.

I will post the important bits here in case something happens to the link, but this should help.

Install dependencies

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

Add the following text to your ~/.gitconfig:

[url "git://anongit.kde.org/"]
   insteadOf = kde:
[url "ssh://git@git.kde.org/"]
   pushInsteadOf = kde:

Install Kde Src Build

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  

Configure kdesrc-build

edit ~/.kdesrc-buildrc  

Replace /path/to/kdesrc-build/kf5-qt5-build-include with ~/kdesrc/kdesrc-build/kf5-qt5-build-include in that file

Add ignore-kde-structure true and make-options -jN to the global section

install more dependencies

kdesrc-build --debug libkomparediff2 grantlee kdevplatform kdevelop-pg-qt kdevelop

Copy these commands to a new file called ~/.env-kf5:

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  

Run KDevelop

source ~/.env-kf5
kdevelop

source

Goddard
  • 4,860