Building Qt Application Linux [closed]

这一生的挚爱 提交于 2019-12-13 16:15:04

问题


I am having a TON of trouble deploying an application for Linux on Qt. I know there are a ton of articles on it, but I just feel like everyone is out to get you more confused, and that's why I am here. I have tried a few things, as I will explain below.

First, I just Googled "deploy qt application linux" and ended up with this article that is suppose to make your life so much easier, which it doesn't. I downloaded that LSB SDK, and then tried running the install.sh, but of course ended up with an error:

error: could not find configuration

It is also clearly there, as there is a inst-config in the same directory, and if I view that install.sh script I see that that's what it checks:

if [ \! -e ./inst-config ]; then
echo "error: could not find configuration" >&2
exit 1
fi

I tried editing that path to the direct location, it got passed that error, but just led to more errors with it so I decided that wasn't the easiest way to go.


Next I went to Nokia directly, where I found this article. I read a little, and I saw it was asking if I wanted to build statically or dynamically. All I want is a working application the easiest way, so I figured that Shared Library is easiest because on Windows all I need to do is open Dependency Walker and drag a few DLLs with the application. Of course, this wasn't the case.

One thing that has annoyed me most, is throughout the tutorial it refrences:

path/to/qt

Where I cannot seem to find correctly. I found this path:

/usr/share/qt4

But it obviously wasn't correct, as it doesn't even have an 'examples' folder, as the tutorial says to use "plugandpaint" which is located in there.

I am a very, very new user to Linux, and I am on the latest version of Ubuntu. I don't know much about Linux, and I guess that's why I am here, even though it seems that deploying applications on Qt are just impossible. Thanks.


回答1:


It seems to me that the OP is asking about distributing the app. If this is the case, you may want to have a read here: https://wiki.ubuntu.com/PackagingGuide/Complete.

Alternatively, here is a more quick and dirty guide: http://ubuntuforums.org/showthread.php?t=910717.

The idea is that you will put your application into the .deb archive and specify all the dependencies. The user of the program will then have their package manager download everything they need to run it. With Linux, you don't have to worry about supplying all the libraries yourself if they are in the repositories.

If you want to double-check what libraries your program is using, you can run the ldd command on the binary, or strace if you need a lot of details.

One thing that you have to keep in mind is that different distributions on Linux have different packaging systems. By far the most popular are DEB (Ubuntu, Debian) and RPM (Fedora, Mandriva, OpenSUSE), but there are also systems that distribute tgz files. Typically if you release software for all these distros you want to write a shell script that will run through the steps of generating all the packages your are interested in.




回答2:


If you have problems finding the dynamic libraries of Qt, they can be installed in two possible locations:

  • /usr/lib for the non-multiarchitecture versions (e.g. Ubuntu 11.04), and
  • /usr/lib/x86_64-linux-gnu/ for the multiarchitecture ones (e.g. Ubuntu 11.10).

Search those folders and look at the file names for some libQt....so filename pattern.



来源:https://stackoverflow.com/questions/10776170/building-qt-application-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!