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. Create portable Qt application for linux
QtWS25 Last Chance

Create portable Qt application for linux

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 5.7k 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.
  • N Offline
    N Offline
    nnead
    wrote on last edited by
    #1

    Hello my friendly Qt devs,
    i have (a maybe stupid) question. I have developed my Qt5 application on windows only and have just be in touch with linux for a few days. I windows i could easily create a portable application, with a few very simple step.

    Release -> copy .exe to a folder -> add missing .dlls to folder -> create subfolder platforms -> add .dll

    With this i had a portable application which could be started even on PCs which have never seen Qt bevor.
    I would like to do the same for linux. At the moment i have an Raspberry Pi, on which i have compiled Qt5, as my developing platform. I have already created my executable with

    make -clean -> qmake -config release -> make

    After this i have a folder with a executable and i am able to start it on this system. I have read that the .dll in windows are called .so in linux and that i can find all dependencies with

    ldd ./application

    I have no other linux system to test this, so would it be enough to copy all .so into this folder (like in windows?) and the executable will find them? I have read that in linux the .so should be installed in the /usr/lib directory, but i want to start the application without any install.

    The desired aim is to plug a usb in, start the application and be ready to go.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andreyc
      wrote on last edited by
      #2

      There are two options to test your installation

      1. Install VirtualBox or another virtual machine and install Linux under VirtualBox
        You will have clean system and can test usbdrive

      2. Copy exec to another directory and try to run it
        a. Copy you executable to some directory
        b. Make sure that ldd ./yourexec shows missing libraries
        c. Copy all necessary libraries and try again.

      If you will find that running exec in the same directory with the libraries does not work then create a shell script to setup LD_LIBRARY_PATH and start your app.
      @
      !#/bin/sh
      export LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH
      ./yourexec
      @
      NOTE: This example will not find your exec if started from another directory.

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

        Hi,

        "Here":http://qt-project.org/doc/qt-5/linux-deployment.html#creating-the-application-package you can find the explanation on how to do it

        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
        0
        • hskoglundH Online
          hskoglundH Online
          hskoglund
          wrote on last edited by
          #4

          I also use a USB thumb drive to copy Qt apps for Linux, sometimes I forget to export LD_LIBRARY_PATH and my app does not launch :-(

          But I want the same behavior as in Windows (no script or export needed). I change the "RPATH":http://en.wikipedia.org/wiki/Rpath setting of my Qt app, so that it looks for the .so (DLL) files in the same directory as itself. I use the chrpath command for this, I've written about it "here":http://www.tripleboot.org/?p=138#Linux

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nnead
            wrote on last edited by
            #5

            Thank you very very much, this helps a great deal :)

            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