Skip to content

SEMPR with Qt5

ctieben edited this page Oct 9, 2018 · 4 revisions

Compiling SEMPR with Qt5

The only part restricting the version of qt (and which originally introduced qt to sempr) is the RDF stuff, namely soprano. Soprano 2.9.4 (latest release, quite a few years old) relies on qt4, but on the kde-repo a commit exists that should enable compilation with qt5.

First, make sure that you remove all occurrences of soprano from your system.

sudo apt-get remove soprano-daemon libsoprano4

Check that you have installed qt5:

pkg-config --libs Qt5Core

If not, install qt5.

redland backend

To also compile the redland-backend with qt5, you need the librdf0-dev package. This provides the necessary development files. One problem with installing this through apt-get, though, is that libraptor2-dev depends on libcurl4-gnutls-dev, which conflicts with libcurl4-openssl-dev and thus will uninstall e.g. ROS....

There are 2 possibilities:

  1. You don't need ROS / don't need libcurl4-openssl-dev. In that case, just do sudo apt-get install librdf0-dev and let it handle all the dependencies, which will include libcurl4-gnutls-dev.

  2. You need ROS / or at least libcurl4-openssl-dev . In that case, do the following:

    1. Download libraptor2-dev:

      apt-get download libraptor2-dev
    2. Install it through dpkg, ignoring the libcurl4-gnutls-dev-dependency:

      sudo dpkg --ignore-depends=libcurl4-gnutls-dev -i libraptor2-dev_2.0.14-1_amd64.deb 
    3. This might tell you that other dependencies are not fulfilled. In my case, this was:

      dpkg: dependency problems prevent configuration of libraptor2-dev:
       libraptor2-dev depends on libxslt1-dev (>= 1.0.18); however:
        Package libxslt1-dev is not installed.
       libraptor2-dev depends on libyajl-dev; however:
        Package libyajl-dev is not installed.
      

      So, go ahead and install them. But sudo apt-get install ... will complain about libraptor2-dev, so you will want to remove it again, e.g. using sudo apt-get install -f.

      # install missing deps -- see output of dpkg
      sudo apt-get install libxslt1-dev libyajl-dev # will fail due to "broken" packages
      sudo apt-get install -f # removes libraptor2-dev
      sudo apt-get install libxslt1-dev libyajl-dev # will now work

      And again, install libraptor2-dev:

      sudo dpkg --ignore-depends=libcurl4-gnutls-dev -i libraptor2-dev_2.0.14-1_amd64.deb 

      This should now succeed. However, since the dependency was just ignored, apt-get will now complain about this broken package and refuse to install anything else before fixing this. Sadly, there is not --shut-up-and-install-option in apt-get. So we need to trick it into thinking that it was installed correctly and everything is fine, in the next step.

    4. How to trick apt-get? We are going to change the dependencies of the installed libraptor2-dev package from ...-gnutls-dev to ...-openssl-dev, since that is what ROS uses and conflicts here. Is this "ok"? Certainly not. It's hacky. It's bad. Let's proceed anyway, because: We only do this to compile soprano once. Feel free to revert everything after we are done. sudo apt-get remove libraptor2-dev will remove all this hacky stuff, and it's okay, since we only need it to compile soprano. At runtime we will only need libraptor2-0, which is no problem at all.

      So, to trick apt-get into thinking everything's okay:

      sudo vim /var/lib/dpkg/status
      
      # find this entry:
      [...]
      Package: libraptor2-dev
      Status: install ok installed
      Priority: optional
      Section: libdevel
      Installed-Size: 898
      Maintainer: Ubuntu Developers <[email protected]>
      Architecture: amd64
      Source: raptor2
      Version: 2.0.14-1
      Depends: libraptor2-0 (= 2.0.14-1), libxml2-dev (>= 2.5.10), libcurl4-gnutls-dev, libxslt1-dev (>= 1.0.18), pkg-config, libyajl-dev
      [...]
      # and modify the "Depends:" part:
      # from "libcurl4-gnutls-dev" to "libcurl4-openssl-dev". or delete it altogether, whatever.
    5. No you can install all the redland-dev-stuff:

      sudo apt-get install librdf0-dev
    6. Remember that you may want to clean this mess up (remove libraptor2-dev) after you finished installing soprano.

compile soprano with qt5

Afterwards, clone the soprano repository which is patched for qt5-support, build and install it.

(Patched with qt5-plugin export makros and pkgconfig file. FYI: The export patch is written by Denis Kuplyakov and originally posted on the soprano mailing list.)

mkdir soprano_qt5 && cd soprano_qt5
mkdir install

git clone https://github.com/sempr-tk/soprano_qt5.git
cd soprano

# compile with qt5
mkdir build && cd build
cmake .. -DQT5_BUILD=true -DCMAKE_INSTALL_PREFIX=~/soprano_qt5/install
make -j8 install

# add install dir to pkg-config path
# (e.g. in .bashrc)
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/soprano_qt5/install/lib/pkgconfig

# make sure the correct version of soprano is found
pkg-config --libs soprano # search for -lQt5Core

Now, if you hacked your way around the libcurl4-[gnutls|openssl]-dev problem you might want to do sudo apt-get remove libraptor2-dev since we don't need the hacked-in packed anymore.

Congratulations, you now have soprano with qt5-support. If you now do a fresh build of sempr it will use qt5, too.

Clone this wiki locally