Results 1 to 17 of 17

Thread: Qt 5 - Linux deployment - can you dynamically link dependencies?

  1. #1
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Qt 5 - Linux deployment - can you dynamically link dependencies?

    I have a Linux Qt 5 app I'm trying to deploy on other Linux systems. I'm using VirtualBox machines develop and test. My app runs with the dependencies on the devoper machine, but not on a non-developer test machine. I have a script which loads the dependencies identified by using the ldd command. Are there any dependencies not listed by the ldd command? I'm trying to dynamically link the dependencies. Is that possible? Or do I have to configure and build from the source code with the static option? Any help would be appreciated. Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    How does the script "load" dependencies?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Here's the script:

    #!/bin/sh

    if [ `getconf LONG_BIT` = "64" ]
    then
    LIBS=./data/libs_64
    BIN=./data/bin/Lottery_64
    else
    LIBS=./data/libs_32
    BIN=./data/bin/Lottery_32
    fi

    # Run your app
    export LD_LIBRARY_PATH=$LIBS:"$LD_LIBRARY_PATH"
    $BIN $@


    It's for both 32 bit and 64 bit deployment. My test machine is 32 bit, so the dependencies are in libs_32. The script works on the deveopment machine (32 bit), but nothing happens when I execute the script on the test machine. The app is Lottery_32 and is in the appropriate folder.
    Last edited by te777; 9th March 2013 at 19:52.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    This doesn't "load" anything. It just sets library search path. If you add Qt libs (and their dependencies) to one of those paths, it will be ok.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    How do you do that? Do I have to install Qt 5 on the test machine? Or copy the lib directory to the test machine? I'm trying to enable deployment any 32-bit Linux machine by supplying the dependencies, without having Qt 5 having to be installed on the deployment machine. Here are the dependencies I have in the libs_32 folder:

    linux-gate.so.1 => (0xb77c1000) (Not in folder)
    libQt5Widgets.so.5 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libQt5Widgets.so.5 (0xb7197000)
    libQt5Gui.so.5 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libQt5Gui.so.5 (0xb6d81000)
    libQt5Core.so.5 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libQt5Core.so.5 (0xb6936000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb6837000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6819000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb666f000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb6654000)
    libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb6603000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6507000)
    libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb63d1000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb63a5000)
    libGL.so.1 => /usr/lib/i386-linux-gnu/mesa/libGL.so.1 (0xb6347000)
    libicui18n.so.49 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libicui18n.so.49 (0xb612e000)
    libicuuc.so.49 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libicuuc.so.49 (0xb5fb4000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb5faf000)
    libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb5fac000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb5fa3000)
    /lib/ld-linux.so.2 (0xb77c2000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb5f9b000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5f5b000)
    libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb5f39000)
    libglapi.so.0 => /usr/lib/i386-linux-gnu/libglapi.so.0 (0xb5f23000)
    libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb5f11000)
    libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb5f0c000)
    libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb5f05000)
    libX11-xcb.so.1 => /usr/lib/i386-linux-gnu/libX11-xcb.so.1 (0xb5f02000)
    libxcb-glx.so.0 => /usr/lib/i386-linux-gnu/libxcb-glx.so.0 (0xb5eea000)
    libXxf86vm.so.1 => /usr/lib/i386-linux-gnu/libXxf86vm.so.1 (0xb5ee4000)
    libdrm.so.2 => /usr/lib/i386-linux-gnu/libdrm.so.2 (0xb5ed6000)
    libicudata.so.49 => /home/tom/Qt5.0.0/5.0.0/gcc/lib/libicudata.so.49 (0xb4db5000)
    libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb4db1000)
    libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb4daa000)
    Last edited by te777; 9th March 2013 at 21:37.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Qt is a set of regular C++ libraries. It works exactly the same as any other library and is governed by exactly the same rules. So all that applies to any other library applies to Qt as well.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Which output do you get for ldd when you setup LD_LIRBARY_PATH on the deployment machine?

    e.g. something like

    Qt Code:
    1. # Run your app
    2. export LD_LIBRARY_PATH=$LIBS:"$LD_LIBRARY_PATH"
    3. ldd $BIN > /tmp/ldd-output.txt
    4. $BIN $@
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  8. #8
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Here's what I get using the ldd addition to the script on the deployment machine:

    linux-gate.so.1 => (0xb77b7000)
    libQt5Widgets.so.5 => ./data/libs_32/libQt5Widgets.so.5 (0xb718d000)
    libQt5Gui.so.5 => ./data/libs_32/libQt5Gui.so.5 (0xb6d76000)
    libQt5Core.so.5 => ./data/libs_32/libQt5Core.so.5 (0xb692c000)
    libstdc++.so.6 => ./data/libs_32/libstdc++.so.6 (0xb6843000)
    libgcc_s.so.1 => ./data/libs_32/libgcc_s.so.1 (0xb6825000)
    libc.so.6 => ./data/libs_32/libc.so.6 (0xb667b000)
    libpthread.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libpthread.so.0 (0xb665f000)
    libgobject-2.0.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libgobject-2.0.so.0 (0xb660f000)
    libglib-2.0.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libglib-2.0.so.0 (0xb6513000)
    libX11.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libX11.so.6 (0xb63dd000)
    libm.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libm.so.6 (0xb63b0000)
    libGL.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libGL.so.1 (0xb6352000)
    libicui18n.so.49 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libicui18n.so.49 (0xb613a000)
    libicuuc.so.49 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libicuuc.so.49 (0xb5fc0000)
    libdl.so.2 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libdl.so.2 (0xb5fbb000)
    libgthread-2.0.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libgthread-2.0.so.0 (0xb5fb7000)
    librt.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/librt.so.1 (0xb5fae000)
    /lib/ld-linux.so.2 (0xb77b8000)
    libffi.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libffi.so.6 (0xb5fa7000)
    libpcre.so.3 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libpcre.so.3 (0xb5f67000)
    libxcb.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libxcb.so.1 (0xb5f44000)
    libglapi.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libglapi.so.0 (0xb5f2e000)
    libXext.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXext.so.6 (0xb5f1c000)
    libXdamage.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXdamage.so.1 (0xb5f18000)
    libXfixes.so.3 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXfixes.so.3 (0xb5f11000)
    libX11-xcb.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libX11-xcb.so.1 (0xb5f0e000)
    libxcb-glx.so.0 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libxcb-glx.so.0 (0xb5ef5000)
    libXxf86vm.so.1 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXxf86vm.so.1 (0xb5eef000)
    libdrm.so.2 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libdrm.so.2 (0xb5ee2000)
    libicudata.so.49 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libicudata.so.49 (0xb4dc1000)
    libXau.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXau.so.6 (0xb4dbc000)
    libXdmcp.so.6 => /home/tom/LotteryAnalyzerExpertQL_32bit/./data/libs_32/libXdmcp.so.6 (0xb4db5000)

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    So what exactly is the problem? It seems all dependencies are resolved.

    Note that you will probably want to deploy some plugins as well.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #10
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    When i click on the script, I choose RUN, and nothing happens. I have the platforms folder in the binary directory. Are there any other plugins that I need?

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    "Nothing happens" is a bit vague description of a problem. Maybe you are using some relative paths in your program?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #12
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    The program doesn't execute or start. I'm using QStandardPaths::HomeLocation to create user files and QCoreApplication::applicationDirPath to initially find user files and copy them to HomeLocation. The program then uses HomeLocation to operate from, both input and output files. The GUI should still execute since I check in the program for existence of needed files. If the program is executing then I should get a GUI and a "Cannot find input file" message box.
    Last edited by te777; 10th March 2013 at 13:12.

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Quote Originally Posted by te777 View Post
    The program doesn't execute or start.
    How did you verify that?

    If the program is executing then I should get a GUI and a "Cannot find input file" message box.
    Not if it crashes before reaching this code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #14
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    I tend to not think the program is crashing. The script works on the development machine where Qt 5 is installed. The program works correctly there in every way. I tend to think there is a dependency problem. Maybe I'm wrong. How do I verify if the program is executing at all?

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Quote Originally Posted by te777 View Post
    Maybe I'm wrong. How do I verify if the program is executing at all?
    One way would be to replace its main() function with something that returns a known error code and check in the script that the code returned is or is not equal to what you expect.

    Something along the lines of

    bash Code:
    1. ...
    2.  
    3. $BIN $@
    4. if [ $? eq "42" ] ...
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. int main() { return 42; }
    To copy to clipboard, switch view to plain text mode 

    Another would be to intercept and log stderr of the script in a well known place.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #16
    Join Date
    Feb 2013
    Posts
    65
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    I installed Qt 5 on the test machine and the application works perfectly. So it is a dependency issue. Now just to figure out what else is needed.

  17. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt 5 - Linux deployment - can you dynamically link dependencies?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 0
    Last Post: 16th November 2012, 09:36
  2. Replies: 3
    Last Post: 11th February 2011, 13:59
  3. Linux deployment issue, dependency not satisfiable.
    By skepticalgeek in forum General Programming
    Replies: 1
    Last Post: 29th November 2010, 14:23
  4. How to link a Qt .exe to a dll dynamically?
    By babygal in forum Newbie
    Replies: 5
    Last Post: 18th November 2010, 18:33
  5. Linux dependencies
    By LMZ in forum Qt Programming
    Replies: 6
    Last Post: 21st May 2007, 08:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.