Deploying Application on Linux
-
Hi,
I am trying to deploy my application on Linux (Ubuntu 20.04.7) .
I am following the guide on Qt for Linux/X11 - Deployment but cannot get it to run.- The executable is build via QtCreator and runs on its own when I start it via the console.
- I have created 2 folders inside the directory,
plugins
andplatforms
. Platforms containslibqxcb.so
and pluginslibqsqlmysql.so
. - I ran ldd appname, checked all libraries containing
Qt
in their name and copied them in my directory (they were in the home/Qt/5.15.2/gcc_64/lib folder. - I copied the startup-script which will (as far as I have understood) add my directory-path as library-path and start the application.
- I also checked
libqxcb.so
with ldd and addedlibxcb-xinerama
andlibQt5XcbQpa.so.5
because they where listed there.
The application is build properly (I guess, I can still execute it on via the console), however I cannot execute it via the script, I get an error-message:
symbol lookup error: /home/*****/Desktop/Qt_BTLE_Mooshi/build-Qt_BTLE_Mooshi-Desktop_Qt_5_15_2_GCC_64bit-Profile/./libQt5XcbQpa.so.5: undefined symbol: _ZN22QWindowSystemInterface24setPlatformFiltersEventsEb, version Qt_5_PRIVATE_API
I guess i have misunderstood some step when adding the libraries because the application runs on its own but I cannot figure it out what I did wrong .. :(
Any experienced users got some hints on what I did wrong/what I have to do?
Thanks in advance
Unzu -
Hi
Seems you did well.
Sounds correct.
And yes. step 4 add your app folder to the paths where the OS will try load So files.did you try ldd on libQt5XcbQpa and see if it needs something also ?
-
@mrjj said in Deploying Application on Linux:
And yes. step 4 add your app folder to the paths where the OS will try load So files.
Could you explain that please? I thought I can put my application folder anywhere I want?I tried some things:
- I am still on the computer where I build the app.
- When I delete all library-files, the application works with the script.
- I started adding 1 library after the other to my application folder and tried running the script. So far I added:
libQt5Gui.so.5.15.2
,libQt5Gui.so.5
(I added both, first is the library itself, second is the link to it.)libQt5Widgets.so.5.15.2
,libQt5Widgets.so.5
(again library and link)
Up to this point, the script still works. I think it takes the libraries that I've provided in my folder and gets the missing ones from the Qt-directory itself.
libtQt5Bluetooth.so.5.15.2
,libQt5Bluetooth.so.5
<- Here it starts to become strange. The script wont work anymore and I get the error-message:
error while loading shared libraries: libQt5Concurrent.so.5: cannot open shared object file: No such file or directory
What is happening here? If it was able to find all libraries before, including the QBluetooth and QConcurrent-libraries, how can it not find the QConcurrent-library anymore? I mean, its still in the Qt-directory..???
- Despite the strange behavior in step 3, I added
libQt5Concurrent.so.5.15.2
,libQt5Concurrent.so.5
and tried executing the script again. Error message:
Cannot mix incompatible Qt library (5.12.8) with this library (5.15.2)
I am really stuck and I don't know what else I could try, help is much appreciated.
Unzu
-
@mrjj said in Deploying Application on Linux:
Did you have 5.12.8 installed at some point?
I dont think so.
I've setup the system a few days ago and I dont think that I have installed multiple Qt Versions.
However, I managed to 'fix' it, it is working now:I was that desparate, that I copied all the Qt libraries:
ALL OF 'EM!
and put them in my directory.
And you know what? ...the script works!I don't know why and how, but I can take my folder, put it on a different computer that never saw Qt and can run my application.
One thing that I noticed is, that there were some libraries both in the linux-/lib/-folder and in the Qt-folder.
For example, I took libicuuc, libicuio and so on from the linux-lib-folder, because when i ran ldd on my application, it showed the libraries there. Maybe I was supposed to take those libraries from the Qt folder?Currently I am very happy that it's running after spending multiple days on that issue :)
The application doesn't detect the libqmysql-plugin right now, not sure what the cause for that is, but I am positive that there is some way to get it to work.. :)Thanks so far for your time and help!
Unzu -
@unzu
Good work.
Well normally one don't need to take system
So files as they are already installed by the os.regarding libqmysql-plugin
did you install the mysql client libs ? the plugin will try to load them.Nothing very bad about copying all of them.
You could then on the clean linux, simply rename those you think you surely are not using
and see if it still starts.Btw there is also
https://github.com/probonopd/linuxdeployqt
Only tested it a bit but not so much as when you first made a deplyment folder you can reuse it untill you switch Qt version. -
You can use linuxdeploy. It is easy peasy (note that linuxdeploy is not linuxdeployqt)
-
Thanks for all the responses.
I've already looked into
linuxdeployqt
, however it is mandatory to use the oldest LTS Ubuntu version, which was no option for me.
Following the deployment guide I manged to get the app to work.
I really like mrjj's idea to just copy the entire library-folder and to delete unneeded apps via testing on a clean linux system.I also managed to get the mysql-plugin to work.
The error I made was to assume that I have to put the library into theplugins
folder as mentioned in the Qt for Linux/X11 - Deployment Guide.
If I had read the guide more carefully, I would have seen that the plugins need to be put into specific folders, eg.sqldrivers
for themysql-plugin
.unzu
-
@unzu said in Deploying Application on Linux:
however it is mandatory to use the oldest LTS Ubuntu version
It's not.This is simply an advice to have a package which can be run on as many Linux distributions as possible. You do not have to follow this advice.
-
@jsulm
Hi
So linuxdeploy +Qt plugin allows to run on newer distros (to make the appDir) ? as when tried
linuxdeployqt it refused to do anything due to the distro being too new.Also there was talk about -unsupported-allow-new-glibc options but it did not
know that option.so linuxdeploy is more "relaxed" ?
That does indeed sound promising.
-
@mrjj said in Deploying Application on Linux:
Also there was talk about -unsupported-allow-new-glibc options but it did not
know that optionSee https://github.com/probonopd/linuxdeployqt/blob/master/tools/linuxdeployqt/main.cpp
It's -unsupported-bundle-everything or -unsupported-allow-new-glibc