Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. linuxdeployqt ldd Error
Forum Updated to NodeBB v4.3 + New Features

linuxdeployqt ldd Error

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
14 Posts 4 Posters 11.8k Views 3 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.
  • hskoglundH hskoglund

    Hi, about that error message "version `Qt_5' not found" occurs when you have built your app using Qt 5.6 or later and the pre-installed Qt on your system (in /usr/lib/x86_64-linux-gnu/) is a version of Qt before 5.6 (you have 5.5.1).

    The reason that error does not occur when you start your app from Qt Creator, is because Qt Creator patches the $PATH variable when in runs your app, so that the first entry points to your Qt installation (making ldd much happier).
    For example, on my Ubuntu the $PATH normally is:
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    but when Qt Creator launches a Qt app it's changed to:
    /home/henry/Qt/5.9/gcc_64/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

    Normally this shouldn't matter because a Qt app executable file gets an RPATH to your Qt installation anyway, on my Ubuntu it's:

    chrpath myapp
    RPATH=/home/henry/Qt/5.9/gcc_64/lib
    

    however a successful run of linuxdeployqt on the app neuters that connection (a wise move which makes it possible to run the app on a PC without Qt installed) and changes it to:

    chrpath myapp
    RUNPATH=$ORIGIN/lib/
    

    and this should suffice provided that the lib subdirectory has had all the necessary Qt files copied into it by linuxdeployqt.

    ModelTechM Offline
    ModelTechM Offline
    ModelTech
    wrote on last edited by ModelTech
    #4

    @hskoglund

    I am not completely sure whether I understand your remark. When I run chrpath for my app (dfm) I get:

    chrpath dfm 
    dfm: RUNPATH=$ORIGIN/lib/
    

    But, I also get that $ORIGIN is empty and my $PATH seems to stay the same (Although echo $PATH does not show inclusion of the standard paths like /usr/local/sbin etc.). I have some settings in .bashrc to extend the standard $PATH using lines like:

    export PATH=$PATH:/home/modeltech/bin
    
    jsulmJ 1 Reply Last reply
    0
    • hskoglundH Online
      hskoglundH Online
      hskoglund
      wrote on last edited by
      #5

      When you start the app, $ORIGIN is replaced with the current directory, where the app is. (Another approach is to add the current directory to the $PATH, but $ORIGIN is more convenient, no clobbering of $PATH is needed)

      If chrpath shows $ORIGIN/lib/ that means you've run linuxdeployqt on your app, and that in the current directory there should be a subdirectory lib with all the needed Qt dlls (copied from the Qt installation by linuxdeployqt).

      To make sure that pre-installed, ancient Qt doesn't rear its ugly head, you could edit your $PATH setting in .bashrc so that the path to your kosher Qt installation's lib directory comes first, on my Ubuntu it would be:

       export PATH=/home/henry/Qt/5.9.1/gcc_64/lib:$PATH
      

      But beware, once version 5.10 of Qt is out, that PATH would be invalid, i.e. it's a short-term solution :-)

      1 Reply Last reply
      0
      • ModelTechM ModelTech

        @hskoglund

        I am not completely sure whether I understand your remark. When I run chrpath for my app (dfm) I get:

        chrpath dfm 
        dfm: RUNPATH=$ORIGIN/lib/
        

        But, I also get that $ORIGIN is empty and my $PATH seems to stay the same (Although echo $PATH does not show inclusion of the standard paths like /usr/local/sbin etc.). I have some settings in .bashrc to extend the standard $PATH using lines like:

        export PATH=$PATH:/home/modeltech/bin
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #6

        @ModelTech $ORIGIN is a variable for the linker it tells it to take the directory where the executable file is located.
        Please DO NOT CHANGE PATH for you app globally!
        Why do you want to have that lib in /usr/lib?
        "I expected the .pro file to state that it should install the library in /usr/lib" - why?
        Usually linuxdeployqt creates a package (just a directory) containing all stuff needed to execute your app, there is no need to pollute the system directories.

        To me it is not completely clear what the issue is: does linuxdeployqt not copy libdfmcore.so.1.0.0 into your package?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        ModelTechM 1 Reply Last reply
        1
        • jsulmJ jsulm

          @ModelTech $ORIGIN is a variable for the linker it tells it to take the directory where the executable file is located.
          Please DO NOT CHANGE PATH for you app globally!
          Why do you want to have that lib in /usr/lib?
          "I expected the .pro file to state that it should install the library in /usr/lib" - why?
          Usually linuxdeployqt creates a package (just a directory) containing all stuff needed to execute your app, there is no need to pollute the system directories.

          To me it is not completely clear what the issue is: does linuxdeployqt not copy libdfmcore.so.1.0.0 into your package?

          ModelTechM Offline
          ModelTechM Offline
          ModelTech
          wrote on last edited by ModelTech
          #7

          @jsulm

          It can't even find libdfmcore.so.1.0.0 ...

          And I just discovered that on my Mac, this libdfmcore library is also not copied to /usr/lib. You ask why I would want that. Well, I do not want that but if I do so, ldd & linuxdeplyqt can actually find it (plus the 'unix { ...}' part at the bottom in the .pro file originates from the template given by Qt Created when I created the project).

          Note that both on linux and mac, I cannot run my app from a terminal, only from qt creator. This already suggests that there is something wrong, but I have no clue what...

          jsulmJ 1 Reply Last reply
          0
          • ModelTechM ModelTech

            @jsulm

            It can't even find libdfmcore.so.1.0.0 ...

            And I just discovered that on my Mac, this libdfmcore library is also not copied to /usr/lib. You ask why I would want that. Well, I do not want that but if I do so, ldd & linuxdeplyqt can actually find it (plus the 'unix { ...}' part at the bottom in the .pro file originates from the template given by Qt Created when I created the project).

            Note that both on linux and mac, I cannot run my app from a terminal, only from qt creator. This already suggests that there is something wrong, but I have no clue what...

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #8

            @ModelTech
            Please read "Creating the Application Package" here: http://doc.qt.io/qt-5/linux-deployment.html
            That ldd does not find the lib is normal (as the lib is not located in any directories where ldd is looking for libs). It will find it if you do the deployment as described in the link above. You will then have a shell script used to start your app. This script sets LD_LIBRARY_PATH variable before starting your app to tell linker where to look for your libs.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            ModelTechM 1 Reply Last reply
            1
            • jsulmJ jsulm

              @ModelTech
              Please read "Creating the Application Package" here: http://doc.qt.io/qt-5/linux-deployment.html
              That ldd does not find the lib is normal (as the lib is not located in any directories where ldd is looking for libs). It will find it if you do the deployment as described in the link above. You will then have a shell script used to start your app. This script sets LD_LIBRARY_PATH variable before starting your app to tell linker where to look for your libs.

              ModelTechM Offline
              ModelTechM Offline
              ModelTech
              wrote on last edited by ModelTech
              #9

              @jsulm

              Now, there is something interesting. LD_LIBRARY_PATH is set in my .bashrc for compiling another tool. Removing that from my .bashrc makes linuxdeployqt find the libdfmcore (without cluttering the /usr/lib directory).

              Nevertheless, linuxdeployqt still gives:

              linuxdeployqt dfm
              Not using FHS-like mode
              app-binary: "/home/.../dfm/build/release/gui/dfm"
              appDirPath: "/home/.../dfm/build/release/gui"
              relativeBinPath: "dfm"
              ERROR: ldd outputLine: "/home/.../dfm/build/release/gui/dfm: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /home/.../dfm/build/release/gui/dfm)"
              ERROR: Please ensure that all libraries can be found by ldd. Aborting.
              

              So, it seems that I have an issue with an old Qt version? What is the best approach to solve that?

              jsulmJ 1 Reply Last reply
              0
              • ModelTechM ModelTech

                @jsulm

                Now, there is something interesting. LD_LIBRARY_PATH is set in my .bashrc for compiling another tool. Removing that from my .bashrc makes linuxdeployqt find the libdfmcore (without cluttering the /usr/lib directory).

                Nevertheless, linuxdeployqt still gives:

                linuxdeployqt dfm
                Not using FHS-like mode
                app-binary: "/home/.../dfm/build/release/gui/dfm"
                appDirPath: "/home/.../dfm/build/release/gui"
                relativeBinPath: "dfm"
                ERROR: ldd outputLine: "/home/.../dfm/build/release/gui/dfm: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: version `Qt_5' not found (required by /home/.../dfm/build/release/gui/dfm)"
                ERROR: Please ensure that all libraries can be found by ldd. Aborting.
                

                So, it seems that I have an issue with an old Qt version? What is the best approach to solve that?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #10

                @ModelTech Looks like you need take care of this (https://github.com/probonopd/linuxdeployqt/blob/master/README.md):
                "QMake configuration

                Important: linuxdeployqt deploys the Qt instance that qmake on the $PATH points to, so make sure that it is the correct one. Verify that qmake finds the correct Qt instance like this before running the linuxdeployqt tool:

                qmake -v

                QMake version 3.0
                Using Qt version 5.7.0 in /tmp/.mount_QtCreator-5.7.0-x86_64/5.7/gcc_64/lib

                If this does not show the correct path to your Qt instance that you want to be bundled, then adjust your $PATH to find the correct qmake."

                Probably linuxdeployqt takes the qmake delivered with your Linux distribution. You can adjust PATH before calling linuxdeployqt so it picks the correct qmake.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • ModelTechM Offline
                  ModelTechM Offline
                  ModelTech
                  wrote on last edited by ModelTech
                  #11

                  After undoing all the polluting of /usr/lib, I have tried most suggestions. Also qmake -v gives something totally different than what it should be.

                  Nevertheless, I did find a way that works but it is not very user-friendly. First of all, I have prepared the package with all the required libraries (including my own libdfmcore.so.1) in a lib subfolder. So, it looks like:

                  /dfm                              // Executable
                  /lib/libdfmcore.so.1              // My own lib to the executable
                  /lib/libQt5Gui.so.5               // Example of a required Qt library
                  /lib/...                          // More of them (all identified through linuxdeployqt)
                  /platforms/libqxcb.so             // Qt platform library
                  /plugins/libsdf3.so               // A plugin
                  /plugins/libbasictools.so         // Another plugin
                  

                  With all this in place, run the application by executing the following commands from a terminal at the location of the executable:

                  LD_LIBRARY_PATH=$PWD/lib/
                  export LD_LIBRARY_PATH
                  ./dfm
                  

                  I tried to script the above, but for some reason that doesn't work. For now this approach is ok, but suggestions for a more user-friendly solution are appreciated.

                  jsulmJ 1 Reply Last reply
                  0
                  • ModelTechM ModelTech

                    After undoing all the polluting of /usr/lib, I have tried most suggestions. Also qmake -v gives something totally different than what it should be.

                    Nevertheless, I did find a way that works but it is not very user-friendly. First of all, I have prepared the package with all the required libraries (including my own libdfmcore.so.1) in a lib subfolder. So, it looks like:

                    /dfm                              // Executable
                    /lib/libdfmcore.so.1              // My own lib to the executable
                    /lib/libQt5Gui.so.5               // Example of a required Qt library
                    /lib/...                          // More of them (all identified through linuxdeployqt)
                    /platforms/libqxcb.so             // Qt platform library
                    /plugins/libsdf3.so               // A plugin
                    /plugins/libbasictools.so         // Another plugin
                    

                    With all this in place, run the application by executing the following commands from a terminal at the location of the executable:

                    LD_LIBRARY_PATH=$PWD/lib/
                    export LD_LIBRARY_PATH
                    ./dfm
                    

                    I tried to script the above, but for some reason that doesn't work. For now this approach is ok, but suggestions for a more user-friendly solution are appreciated.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #12

                    @ModelTech Did you actually read the links I provided (http://doc.qt.io/qt-5/linux-deployment.html and https://github.com/probonopd/linuxdeployqt/blob/master/README.md)? As I said you're using wrong qmake, do it like described in my previous post: "If this does not show the correct path to your Qt instance that you want to be bundled, then adjust your $PATH to find the correct qmake."
                    "I tried to script the above, but for some reason that doesn't work" - what does not work?
                    In the link above, if you read it, you will find ready made script to start your app, all you have to do is to copy this script into a text file, name this file NAME_OF_YOUR_APP.sh and put it in the same directory where NAME_OF_YOUR_APP is.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    2
                    • ModelTechM Offline
                      ModelTechM Offline
                      ModelTech
                      wrote on last edited by ModelTech
                      #13

                      Calling qmake from the command line does not work in my environment. Changing the $PATH does not help in any way. I tried hard.

                      I solved the scripting problem by studying one of the referred pages in more details, but it did't work as it was described there. I did however give me the right inspiration. Thanks :)

                      Anyway, on my Mac, I basically experience the same problem! It all has clearly to do with the fact that I use a library that I build myself (as a subproject for the whole project) and which is not accessible from /usr/lib. I have tried to put this library file at various places in (subfolders of) the Content folder of the application bundle. I also tried to alter the qt.conf file using the Library and LibraryExecutables fields. None of this worked: macdeployqt can't find the library file and it really wants it at /usr/lib. The only thing that I get to work is to put the .dylib file in the MacOs subfolder and run the application by calling the executable from within the MacOs subfolder from the command line. Not the solution that a typical Mac user will like...

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

                        Hi,

                        Take a look at the Linking the application to Qt as a framework chapter of the deployment documentation. It shows how to use macOS tools in order to deploy an application.

                        You can use them in addition to macdeployqt when you have unusual stuff happening.

                        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
                        1

                        • Login

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