Qt 5.5 app deployment on Ubuntu 14.04
I have been tasked with porting an existing application (running on Windows and Mac OS currently) to Ubuntu.
I am developing on Ubuntu 14.04LTS with Qt5.5 installed through the online installer.
After fixing ifdefs, compile issues and such and getting the app running smoothly on the dev machine it came to testing deployment.
I am trying to deploy on an identical Ubuntu machine (Just missing the QT Ide).
I followed the very good tutorial on tripleboot.org. and changed the library search paths and deployed the libs ldd listed in a subfolder.
First I stumbled in the infamous xcb plugin not found.
I changed the lib paths and "ldd" reports paths for each lib.
However, apart from continuous issues with the libqxcb plugin (Usually requiring libQt5QcbQpa and libQt5DBus to be copied to usr/lib or usr/lib/x86_64_linux_gnu, which doesn't seem optimal ).
However now, even having solved these more basic dependency issues, when I start my app I only get a core dumped message.
I tried deploying a test helloworld app always following the shared library approach (Trying to print with QDebug) and that fails too with unresolved symbol _ZN6QDebug...
I am struggling. What has to be deployed to get even a simple Hello World running?
I also tried the static link approach but I can't seem to compile our cryptopp and quazip (which are used extensively in the application).
I event tried installing Qt 5.2.1 and targeting that (As that seems to be the version shipped with Ubuntu 14.04) but nothing changed much.
I am at a loss.
I joined this forum recently to learn Qt 5.5 on Ubuntu.
Your post has elements of what I've been through recently.
I have Qt 5.5.1 on Ubuntu 14.04 (32 bit) in /opt/qt55.
The Qt version in Ubuntu Software Centre is older .. 5.2.1 as you found.
You have an existing application to run.
You have hit problems with xcb plugin.
I learned to use QT_DEBUG_PLUGINS variable.
e.g. if your executable app is named helloworld and is in /usr/bin try running via command line as
This should show up more debug information in terminal.
I added a qt.conf file to same location as my app binary (/usr/bin).
Read more about qt.conf.
I also added Qt paths to ~/.profile
This solved my problem. You might at least glean more information.
But as I wrote I'm a newcomer.
Unrelated comment: there is no need to reboot your machine after changing environment variables in .profile :-)
It is enough to log out and log in again.
- plugins (like libqxcb.so) have Qt lib dependencies (use e.g 'ldd libqxcb.so' to see what). These plugins need to be able to find the Qt libs. Probably the easiest way is to set LD_LIBRARY_PATH on your target machine to include the path to the Qt libs you are shipping (you mention you put them in a subfolder - so you would add this subfolder's path to LD_LIBRARY_PATH).
You can apparently set LD_LIBRARY_PATH from within your application as the plugins are loaded when the application object is created, so you can do set it immediately before.
- The directory structure I use for Linux/X11 deployment looks like this:
- app itself
- platforms/libqxcb.so etc. (basically all the Qt plugin directories required)
- libQt5OpenGL etc. (all the Qt shared libs)
There are some gotchas - for example running OpenGL you need the xcbglintegrations plugin with either the GLX or EGL shared libs; this is not documented anywhere and gives rise to a misleading error message that does not mention the missing plugin!
Let me begin by thanking everyone for pitching in and for the help. I was becoming extremely frustrated with grey areas in the process :)
Over the weekend I finally struck gold and got the application running on the deployment machine.
@eureka QT_DEBUG_PLUGINS proved to be vital. I hadn't realized I was shipping the 5.2.1 libqcb rather than the 5.5.1 version I intended to ship.
I am using the suggested LD_LIBRARY_PATH approach.
@KeithS, I have adopted your deployment structure.
One last pair of questions:
- I am currently deploying to /opt/companyname/product is this the correct location on ubuntu? I found conflicting advice across /usr/bin /home/local usr/share...
- I am trying to deploy using deb packages (open to alternative suggestions). I am trying to use Debreate to create a debian package. However I found it doesn't support lintian overrides and so on deployment machines I get flooded with warnings and errors against the fact I am shipping binaries and libraries.
Should I post process the Debreate deb package to add lintian overrides by hand or is there a better/different package creator that you know of or recommend?
(1) In fact I see many programs placed in /opt in Ubuntu. One consideration .. some installers of Ubuntu place / and /home in separate partition for ease of reinstallation.
(2) Although I've installed Debreate I haven't yet progressed to using it for packaging. But this article addresses the points you raise.
I'll be interested to see if you get your Qt > deb workflow to a Ubuntu PPA release.