Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Platform plugin libraries on GNU/Linux

Platform plugin libraries on GNU/Linux

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rondog
    wrote on last edited by
    #1

    I am having some problems deploying plugin libraries on GNU/Linux.

    For example the platform library libqxcb.so:

    @
    ldd libqxcb.so
    ...
    libQt5Gui.so.5 => /usr/lib/qt5/lib/libQt5Gui.so.5 (0x00007f1dfc515000)
    libQt5Core.so.5 => /usr/lib/qt5/lib/libQt5Core.so.5 (0x00007f1dfbde3000)
    ...
    @

    This file is hard wired to load the libraries from /usr/lib/qt5/...

    After some research I found a possible solution but I am not sure if this is the right way to do it (or if it would even work for plugin libraries):

    @
    // modify the relative path
    // so the file can load from current or relative path ?
    QMAKE_LFLAGS += -Wl,-rpath,"'$$ORIGIN'"
    @

    What is the preferred way to handle this?

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi,

      This blog post is your friend: http://www.tripleboot.org/?p=138 It describes in great detail a few different ways you can achieve this.

      I would personally recommend the RPATH method.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rondog
        wrote on last edited by
        #3

        Yeah, I had looked at that posting already. This is where the -rpath, $ORIGIN idea came from. I have also looked at articles created for deploying Qt projects on GNU/Linux but they seemed to stop short at the parts I need.

        My first attempt was using a shell script and modifying the LD_LIBRARY_PATH which works fine for the application but doesn't extend to the plugins.

        I am looking at the RPATH option. There is no issue with the application finding the plugins but that the plugins try to load libraries from the fixed path. This is handled by the Qt application when it loads and not by the operating system. The article mentions that RPATH is ignored in this case.

        I am investigating this and will post a solution if I find one. I am looking for a solution that doesn't involve putting libraries outside the folder of the application. I don't want to do a static build if there is another way.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rondog
          wrote on last edited by
          #4

          I found a solution to this problem.

          For all the plugin libraries you need to set a relative search path. I found a utility "PatchElf":http://nixos.org/patchelf.html that did the trick.

          So, in my case, I created a folder for the QtLibraries (qtlibs) and set the relative path like this:

          @
          // one dir up and into qtlibs
          patchelf --set-rpath ../qtlibs libqxcb.so
          @

          The actual executable program can stay with a shell script or can adjusted the same way as the libraries (probably will do it this way) but I don't see an alternative for the plugins (aside from installing in an expected location).

          This seems to be a similar to how macdeployqt works on OS X.

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rondog
            wrote on last edited by
            #5

            I thought this was the answer but it is not.

            I find that using rpath the program will only run when I am in the current directory of the program itself. If I navigate to $HOME it won't work because it is looking for everything relative to $HOME.

            Maybe a combination of shell scripts and rpath (?). Any suggestions are welcome.

            Edit: A combination of a shell script (with 'cd <app folder>') and modifying rpath works. I don't like it though, it seems over the top. Probably will just stick to distributing the source code.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved