Setting QT_QPA_PLATFORM_PLUGIN_PATH on Linux does not find the platform plugin when not installed?
I have downloaded the sources of QT and built them myself. I am using a virtual environment for my project and do not wish to install QT. I have set QT_QPA_PLATFORM_PLUGIN_PATH to the location of my plugins, but QT does not even look there. This is what happens when I run my application:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". I don't understand because the variable I just set is supposed to tell Qt to look in that location, but it's not. If I copy the platforms folder into my project working directory, it finds it with no problem. I'd rather not have to do this and instead be able to point to an other location where the platform plugin is. How can I achieve this?
I'm on Ubuntu 18.04.
@JigsawCorp Try this command
export PATH=/usr/local/Qt-5.1.0/bin:$PATH //change as your own prefix value + /bin
@closx Thanks for the replying! I already have added the bin folder to
PATHand it's not working.
@JigsawCorp hmmm.. Maybe you have missed a Qt dependency? Try this two in order please,
sudo apt-get build-dep qt5-default sudo apt-get install libx11-xcb-dev libglu1-mesa-dev build-essential
and check what is the result?
@closx I am using Conan to package QT, so I'd like to avoid having to install Ubuntu packages. But if it worked when I put it in the same directory as my project, I assume that I am not missing a dependency. I also did
lddon all QT files and all shared libraries of my project and everything checks out. Lastly, I did install
libx11-xcb-dev libglu1-mesa-dev build-essential, but I want to avoid adding
closx last edited by
@JigsawCorp of course you wont install qt5-default. You should just install build dependencies.
sudo apt-get install qt5-default //not this sudo apt-get build-dep qt5-default //use this
@closx But why would this be necessary if my project works with without the dependency if I put the platforms plugin folder in the same folder as my project executable? I think the issue is more with the path that QT searches for the platforms plugin rather than missing dependencies.
@JigsawCorp Oh dude! How could I become that blind :D I got the problem wrong from the beginning. I guess you must be using qmake. So, you may include this line to your project .pro file.