KDEConnect/Build Linux

From KDE Community Wiki

Setting up dependencies

On some distros you will need to install some development packages. Some package managers also feature a command which will automatically fetch the dependencies for you. If yours does not, you will need to procure the dependencies by yourself, in which case you can install/ build those yourself.

  • Ubuntu
    • Go to /etc/apt/source.list and enable the source repositories.
    • Run the following commands:
    # apt update
    # apt-get build-dep kdeconnect
    
  • openSUSE
    • Run the following commands:
    # zypper si -d kdeconnect-kde
    
  • Arch Linux
    • Run the following commands:
    # pacman -S kdeconnect
    
  • Gentoo
    • Run the following commands:
    # emerge --ask kdeconnect
    
    • On Gentoo, you may need to enable pulseaudio and bluetooth USE flags for respective features.
  • Fedora
    • Run the following commands:
    # dnf builddep kde-connect
    # dnf install dbus-devel qt5-qtquickcontrols2-devel
    


Build and install kdeconnect-kde

  • Next, uninstall the distribution-provided version of kdeconnect before continuing, otherwise, you might end up in a confusing situation

where some plugins are being provided by the system-installed version and others are coming from your new build.

  • If you want to build KDE Connect yourself, you'll first need to grab the code from git.
    git clone https://invent.kde.org/network/kdeconnect-kde.git
    
  • Note: if you plan to contribute code to KDE Connect, you're advised to set up your clone for contributing.
  • If you intend to develop KDE Connect or experience a crash and are asked to give a backtrace, build KDE Connect with debugging symbols. Do this by adding the -DCMAKE_BUILD_TYPE=Debug flag before the two dots at the end of the cmake command. For example:
    cmake -DCMAKE_INSTALL_PREFIX=~/kde-prefix -DCMAKE_BUILD_TYPE=Debug ..
    

Installing to ~/kde-prefix

For development, it is recommended to install to your home directory and test changes using prefix.sh. This gives a faster development cycle and avoids clobbering your system-installed version with a potentially unstable WIP version.

  1. To configure:
    cd kdeconnect-kde
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=~/kde-prefix ..
    
  2. To build and install:
    make -j$(nproc) install
    
  3. To run an executable, for example, kdeconnectd:
    source build/prefix.sh
    killall kdeconnectd; ~/kde-prefix/lib64/libexec/kdeconnectd
    
    The daemon is in an obscure location. Other executables, such as the SMS app or the settings app, are on the path provided by prefix.sh, and can be found in ~/kde-prefix/bin, i.e., for example, to test changes to the SMS app, do:
    source build/prefix.sh
    killall kdeconnect-sms; ~/kde-prefix/bin/kdeconnect-sms
    

Installing to /

If you want to daily-drive the latest source code of KDE Connect, you can install it to the system. This is not recommended for day-to-day development since it requires sudo access.

  1. To configure:
    cd kdeconnect-kde
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/usr ..
    
  2. To build and install:
    make
    sudo make install
    


  • NOTE: If you install KDE Connect in a custom location, you'll need to run kdeconnectd manually, since DBus doesn't know about it.