Qt: Difference between revisions

imported>Samueldr
m qt5: fix <code>
imported>V3vAP
Added some error troubleshooting info
Line 26: Line 26:
</nowiki>}}
</nowiki>}}


====  qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" ====
Here is a concrete example:
{{File|||
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.}}
One solution is to run a command like
{{Commands|<nowiki>env QT_PLUGIN_PATH=/nix/store/d7q3q6wmfccss8gcp09r33xg0wkbz9gb-qtbase-5.11.0-bin/lib/qt-5.11/plugins/ some_qt_app</nowiki>}}
Another is to set the variable in a shell.nix file like the following {{File|||<nowiki>
with import <nixpkgs> {};
stdenv.mkDerivation {
  name = "qt-somethingorother";
  buildInputs = [
    pkgs.somePackage
    ];
  QT_PLUGIN_PATH = qt5.qtbase.bin + "/" + qt5.qtbase.qtPluginPrefix;
  }
</nowiki>}} to be run with {{Commands|nix-shell shell.nix}}
==== Debugging methods ====
==== Debugging methods ====
As a general rule, exporting <code>QT_DEBUG_PLUGINS=1</code> make qt print where it looks for plugins.
As a general rule, exporting <code>QT_DEBUG_PLUGINS=1</code> make qt print where it looks for plugins.


If a plugin exists in a directory but is ignored with a message like <code>QLibraryPrivate::loadPlugin failed on "/nix/store/...-teamspeak-client-3.1.6/lib/teamspeak/platforms/libqxcb.so" : "Cannot load library /nix/store/...-client-3.1.6/lib/teamspeak/platforms/libqxcb.so: "</code> it can be that the library cannot be <code>dlopen()</code>ed because of dependencies/rpath issues and needs <code>patchelf</code>ing. Exporting <code>LD_DEBUG=libs</code> may prove helpful in this scenario.
If a plugin exists in a directory but is ignored with a message like <code>QLibraryPrivate::loadPlugin failed on "/nix/store/...-teamspeak-client-3.1.6/lib/teamspeak/platforms/libqxcb.so" : "Cannot load library /nix/store/...-client-3.1.6/lib/teamspeak/platforms/libqxcb.so: "</code> it can be that the library cannot be <code>dlopen()</code>ed because of dependencies/rpath issues and needs <code>patchelf</code>ing. Exporting <code>LD_DEBUG=libs</code> may prove helpful in this scenario.