Ldd outputs statically linked on target pc even when my app was built with shared libraries



  • I want to deploy a simple app I created on a linux machine to another linux machine.

    I have two pc's, both running Ubuntu 12.04. On the development machine I created a simple app using Qt Creator and it runs fine. When I run the ldd command on this machine it outputs a whole bunch of libraries needed. Then I copied the app and the required libraries to the target machine and tried to run the app following the directions for deployment provided here: http://doc.qt.io/qt-5/linux-deployment.html
    but I get a segmentation fault error. When I run the ldd command again on the target machine it outputs: statically linked.

    I have same version of Qt on both machines Qt 5.3

    I am new to Qt and I don't know what I'm doing wrong, please help.



  • Hi, the ldd command doesn't give you a 100% list of all DLLs/.so files, you should run "lsof -c YourAppName" in Terminal to see them all.

    Note that Ubuntu comes with a in built-in version of Qt which usually is older than the one you're using, this can create problems on non-development machines; it could be the reason for your segfaults. Also you can read more about deployment on Linux in my "blog":http://www.tripleboot.org/?p=138#Linux



  • Hello, I read and followed the instructions from your blog and added the instruction to my .pro file to set the rpath to the directory of my app. I also added the required .so libraries to the same directory. I tested the app on my development machine by running it from the deploy directory instead of QtCreator and it runs fine. Then I copied the same directory to the target machine and tried to run the app again. Same result as before, I get a seg fault error. Do you have any idea how to ensure it runs with the correct libraries? Wouldn't it be enough with the rpath setting?

    Also btw, the "lsof -c appName" command doesn't output anything on my machine.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should also set the LD_LIBRARY_PATH variable so it look first to a known directory containing your Qt build

    Hope it helps



  • Hi, I finally solved it! I finally got it running on my target machine. Apparently my app exe file got corrupted somehow when I copied it from one machine to the other. After that I was also missing some libraries that didn't show up with the "ldd" command. And also the platform path was missing.

    Thanks a lot for the help!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.