What I need to run QT App on Ubuntu, which doesn't have QT?
-
Hi,
I would like to create very simple app in the first PC, which has QT and run this app on other PC, which doesn't have installed QT. In both PCs I have Ubuntu OS.
I only do that in windows OS. And In windows I can't run application using only .exe file. I need more things. If I would like to create simple app ( mainWindow + pushButton on it ) I need to create folder, which has:
- app.exe
- qt5Widgets.dll
- qt5Gui.dll
- qt5Core.dll
- libwinpthread-1.dll
- libstdc++-6.dll
- libgcc_s_seh-1.dll
and folder "platforms" which contains: - qminimal.dll
- qwindows.dll
And then, when I open this folder on other pc, which doesn't have QT and run app.exe, it will works.
And I have to do the same for Ubuntu. I think I need libraries like dlls / plugins. But what exactly? Where can I find it?
And 2 important things:
- I would like to build this app dynamic, so I know I will need dlls ( or something simillar in ubuntu )
- I know about apps, which can help me a lot, like linuxdeployqt, but I would like manually move files now
Thank a lot :)
-
@TomNow99 said in What I need to run QT App on Ubuntu, which doesn't have QT?:
And I have to do the same for Ubuntu. I think I need libraries like dlls / plugins. But what exactly? Where can I find it?
First you have to build your app for Linux/Ubuntu, on an Ubuntu OS.
And then you have to deploy your app to another Ubuntu, for which you should look uplinuxdeployqt
.
Just as for Windows in order to distribute/deploy your Qt app to another Windows machine you should look upwindeployqt
.
This is covered in the docs chapter on Deployment.I know about apps, which can help me a lot, like linuxdeployqt, but I would like manually move files now
Don't. If you insist on manually doing stuff, look at what
linuxdeployqt
would do for you. You will need all those.so
files (equivalent of Windows.dll
s), and there is lot of work to get them and their dependencies all sorted out. And don't just go copying your files into Linux system areas!An alternative for all of this under Linux/Ubuntu is to just use the OS version's distribution of Qt (fetchable via
apt install
), both on your development machine and the target machine. Then they will have a consistent set of a particular version of Qt on both machines. -
@JonB Thank you
I have one more question: when I would like to check I have every file needed to execute my app on Windows, I can just move that .exe file to other folder. When there are no other files in this folder I will have errors like "No Qt5Widgets.dll".
How can I do the same on ubuntu? When I move executable file to other folder... I can execute that and it works. So what I have to change?
EDIT And one more :) :
If I compile code under ubuntu 20, it will works under ubuntu 18? -
@TomNow99 said in What I need to run QT App on Ubuntu, which doesn't have QT?:
How can I do the same on ubuntu? When I move executable file to other folder... I can execute that and it works. So what I have to change?
? Depends on where it's finding its required dependent
.so
files. If they are not in current directory it will look along in system area. If it finds good stuff there it will run. This is actually the same as on Windows. A possible difference being that Windows will not have the Qt DLLs in a system area, but Ubuntu might do as it has a Qt included in its distibution.If I compile code under ubuntu 20, it will works under ubuntu 18?
Not sure. Possibly, but quite possibly not. As with most programs, compiled under a newer version of the OS may not work with an older version, but usually compiled under an older version will work under a newer version.
-
We are using
linuxdeployqt
which will create an AppImage containing both the executable and.so
s. At least in a commercial setting it can easily become a mess when.so
s of the wrong version are found on customers Linux system. Hence, having all inside an AppImage with the correct version of the libraries helps a lot. Then there is also just a single file to be copied around.Don't compile under newer Ubuntu versions if you want to use it with older versions. Sooner or later this approach will fail. Set up a virtual machine (we are using VirtualBox) with the oldest Ubuntu version you want to support and compile there. Most of the time compiling on a newer version of the OS will link with newer C/C++ libraries. There are certain tricks you can do with GCC (because libraries have several versions of the same function), but then everything (including Qt) needs to be compiled against that library version. It is too much hassle to get it working properly.