Deploying Qt applications in Linux properly

前端 未结 1 478
天涯浪人
天涯浪人 2020-12-20 07:37

I have written an application using Qt and I am trying to deploy it. I built my application it and tried distributing it, but I ended up having to build Qt statically so tha

相关标签:
1条回答
  • 2020-12-20 08:23

    FWIW, the way my company packages the Linux build of its Qt app is with the dynamic libraries, as shown in the attached screenshot. Note that the actual executable (shown as "MyApp" in the screenshot, which I have doctored a bit to protect the innocent) is located inside a "bin" sub-directory along with all of the necessary shared-library files. In the main directory is a short shell script ("MyApp.sh") that looks like this:

    #!/bin/bash
    unset QT_PLUGIN_PATH   
    appname=$(basename "$0" .sh)
    dirname=$(dirname "$0")
    cd "$dirname/bin"
    export LD_LIBRARY_PATH=`pwd`
    ./$appname "$@"
    

    ... the user is expected to run the MyApp.sh script, which will set the LD_LIBRARY_PATH variable appropriately and then run the executable file.

    It's not the most elegant thing in the world, but it gets the job done (much like Linux itself, heh).

    0 讨论(0)
提交回复
热议问题