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. Deploying a Qt application on Ubuntu 18.04
Qt 6.11 is out! See what's new in the release blog

Deploying a Qt application on Ubuntu 18.04

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 6 Posters 12.6k Views 2 Watching
  • 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.
  • bunjee207B bunjee207

    Greetings Qt Forums,

    I'm deploying a Qt application on Ubuntu 18.04.

    My binary is built with the following:

    unix:QMAKE_LFLAGS += "-Wl,-rpath,'\$$ORIGIN'"
    

    When I run the application I get the following:

    error while loading shared libraries: libQt5XmlPatterns.so.5 cannot open object file: No such file or directory.
    

    That's strange because the library is actually there along with the binary.

    Also, that shouldn't be related to rpath since libQt5Core.so.5 and a few others are resolved just fine.

    Has anybody got the issue before ?

    Thanks.

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #2

    @bunjee207
    https://stackoverflow.com/questions/38018966/error-while-loading-shared-libraries-libqt5xmlpatterns-so-5
    shows someone long ago with same error message, not resolved, does it give you nay food for thought?

    EDIT:
    Ah, hang on, I believe that you get the "No such file or directory" error on a .so also whenever any of its dependencies are not found, but it reports the original filename, not the dependent one! Do an ldd on it (or your executable) and you get a definitive list of what it wants that is found & not found.

    Here's mine (Ubuntu 17.04, Qt fetched from apt-get not built locally, nothing missing) :) :

    jon@ubuntu:~$ ldd /usr/lib/x86_64-linux-gnu/libQt5XmlPatterns.so.5
    	linux-vdso.so.1 =>  (0x00007fff0da52000)
    	libQt5Network.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Network.so.5 (0x00007fd99ffdf000)
    	libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007fd99f915000)
    	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd99f58d000)
    	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd99f284000)
    	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd99f06d000)
    	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd99eca4000)
    	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd99ea86000)
    	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd99e86a000)
    	libproxy.so.1 => /usr/lib/x86_64-linux-gnu/libproxy.so.1 (0x00007fd99e64a000)
    	libicui18n.so.57 => /usr/lib/x86_64-linux-gnu/libicui18n.so.57 (0x00007fd99e1d0000)
    	libicuuc.so.57 => /usr/lib/x86_64-linux-gnu/libicuuc.so.57 (0x00007fd99de28000)
    	libpcre16.so.3 => /usr/lib/x86_64-linux-gnu/libpcre16.so.3 (0x00007fd99dbbd000)
    	libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007fd99d9ac000)
    	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd99d7a8000)
    	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fd99d494000)
    	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd99d28c000)
    	/lib64/ld-linux-x86-64.so.2 (0x000055736a0d6000)
    	libicudata.so.57 => /usr/lib/x86_64-linux-gnu/libicudata.so.57 (0x00007fd99b80d000)
    	libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd99b59a000)
    jon@ubuntu:~$ 
    
    

    I bet you or your deployment is missing one of those! :)

    1 Reply Last reply
    0
    • hskoglundH Online
      hskoglundH Online
      hskoglund
      wrote on last edited by
      #3

      Hi, the dependency on libQt5XmlPatterns.so.5 can be from one of your plugins, there's one called libqmlxmllistmodelplugin.so that tries to pull in libQt5XmlPatterns.so.5.
      However libqmlxmllistmodelplugin seems to be built with
      $ORIGIN/../../../lib
      so I think libQt5XmlPatterns.so.5 needs to be in that place relative to where libqmlxmllistmodelplugin.so is deployed.

      1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Hi,

        You might want to consider using linuxdeployqt to help you with that matter.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • bunjee207B Offline
          bunjee207B Offline
          bunjee207
          wrote on last edited by
          #5

          Thanks for your replies,

          My application actually depends on a few libraries of my own (SkCore, SkGui...).
          Turns out I have to add the rpath line in the project of each library.

          After that ldd finds the proper dependencies and my application runs.

          PS: That does not seem to be required when building with Qt 4.

          1 Reply Last reply
          2
          • Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #6

            @bunjee207 great!, so if your issue is solved please don't forget to mark your post as such. Thanks.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            1
            • bunjee207B bunjee207

              Greetings Qt Forums,

              I'm deploying a Qt application on Ubuntu 18.04.

              My binary is built with the following:

              unix:QMAKE_LFLAGS += "-Wl,-rpath,'\$$ORIGIN'"
              

              When I run the application I get the following:

              error while loading shared libraries: libQt5XmlPatterns.so.5 cannot open object file: No such file or directory.
              

              That's strange because the library is actually there along with the binary.

              Also, that shouldn't be related to rpath since libQt5Core.so.5 and a few others are resolved just fine.

              Has anybody got the issue before ?

              Thanks.

              B Offline
              B Offline
              borkowsk
              wrote on last edited by borkowsk
              #7

              @bunjee207 I have similar message when I start qtcreator :-/

              B 1 Reply Last reply
              0
              • B borkowsk

                @bunjee207 I have similar message when I start qtcreator :-/

                B Offline
                B Offline
                borkowsk
                wrote on last edited by
                #8

                @borkowsk
                sudo apt install qtcreator
                [sudo] password for borkowsk:
                Reading package lists... Done
                Building dependency tree
                Reading state information... Done
                qtcreator is already the newest version (4.5.2-3ubuntu2).
                0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
                borkowsk@wojciech-CELSIUS-7:~$ qtcreator
                qtcreator: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  Hi and welcome to devnet,

                  Did you modify your PATH environment variable ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  B 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Hi and welcome to devnet,

                    Did you modify your PATH environment variable ?

                    B Offline
                    B Offline
                    borkowsk
                    wrote on last edited by borkowsk
                    #10

                    @SGaist
                    I dont think so :-) Should I do it manually?
                    This is my path and result of calling "konsole" (similar for krusader etc...)

                    borkowsk@wojciech-CELSIUS-7:~$ echo $PATH
                    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
                    borkowsk@wojciech-CELSIUS-7:~$ konsole
                    konsole: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory

                    All this library exist but are not visible...
                    borkowsk@wojciech-CELSIUS-7:~$ ls /usr/lib/x86_64-linux-gnu/libQt5*
                    /usr/lib/x86_64-linux-gnu/libQt5Concurrent.prl /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5
                    /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5.9
                    /usr/lib/x86_64-linux-gnu/libQt5Concurrent.so.5 /usr/lib/x86_64-linux-gnu/libQt5QuickTest.so.5.9.5
                    ...
                    /usr/lib/x86_64-linux-gnu/libQt5Widgets.prl
                    ...
                    /usr/lib/x86_64-linux-gnu/libQt5Widgets.so
                    ...
                    /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.9 /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5.9
                    /usr/lib/x86_64-linux-gnu/libQt5Quick.so.5.9.5 /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5.9.5

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      borkowsk
                      wrote on last edited by
                      #11

                      borkowsk@wojciech-CELSIUS-7:~$ file /usr/lib/x86_64-linux-gnu/libQt5Widgets.so
                      /usr/lib/x86_64-linux-gnu/libQt5Widgets.so: broken symbolic link to libQt5Widgets.so.5.9.5

                      Looks like something is missing during installation. How to fix this?

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        borkowsk
                        wrote on last edited by
                        #12

                        @borkowsk
                        This is probably due the grub crashing during installation od 18.04:

                        sudo apt-get install libQt*
                        Reading package lists... Done
                        Building dependency tree
                        Reading state information... Done
                        Note, selecting 'libqtscript4-opengl' for glob 'libQt*'
                        Note, selecting 'libqtcore4-perl' for glob 'libQt*'
                        ...
                        libqt5xmlpatterns5 is already the newest version (5.9.5-0ubuntu1).
                        libqt5xmlpatterns5 set to manually installed.
                        Some packages could not be installed. This may mean that you have
                        requested an impossible situation or if you are using the unstable
                        distribution that some required packages have not yet been created
                        or been moved out of Incoming.
                        The following information may help to resolve the situation:
                        The following packages have unmet dependencies:
                        libqtdee3 : Conflicts: libqtdee2 but 0.2.4-0ubuntu1 is to be installed
                        E: Unable to correct problems, you have held broken packages.

                        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