Qt: Difference between revisions
m Fix syntax error in example code for specifying explitit Qt dependencies |
Added a warning for the deprecated Qt section |
||
| (5 intermediate revisions by one other user not shown) | |||
| Line 2: | Line 2: | ||
== Development == | == Development == | ||
{{warning|With the deprecation of <code>qt5.full</code> & <code>qt6.full</code>, for 25.11 and up (see [https://github.com/NixOS/nixpkgs/blob/32b61ba4d9088ef926dd27065daad604ca6b58aa/pkgs/development/libraries/qt-6/default.nix#L152 change]) this recommendation is outdated. For now please primarily refer to the [[#Explicit Dependencies|Explicit Dependencies]] Section below.}} | |||
If you want to develop qt applications in nixos you have to use nix-shell or direnv. | If you want to develop qt applications in nixos you have to use nix-shell or direnv. | ||
For using nix-shell just run this command in the terminal: | For using nix-shell just run this command in the terminal: | ||
| Line 16: | Line 18: | ||
pkgs.mkShell { | pkgs.mkShell { | ||
buildInputs = [ | buildInputs = [ | ||
pkgs.qt5.full | |||
pkgs.qtcreator | |||
]; | |||
} | } | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Also create '''.envrc''' file and paste: <code>use_nix</code> into it. | Also create '''.envrc''' file and paste: <code>use_nix</code> into it. | ||
| Line 194: | Line 194: | ||
== Troubleshooting == | == Troubleshooting == | ||
=== This application failed to start because it could not find or load the Qt platform plugin ??? in "" === | === This application failed to start because it could not find or load the Qt platform plugin ??? in "" === | ||
{{warning|This recommendation is deprecated for 19.09 and up, see {{issue|65399}}. Failing packages should be updated to use <code>wrapQtAppsHook</code>.}} | {{warning|This recommendation is deprecated for 19.09 and up, see {{issue|65399}}. Failing packages should be updated to use <code>wrapQtAppsHook</code>.}} | ||
<pre> | <pre> | ||
| Line 232: | Line 206: | ||
The package will need to be fixed to use [the new https://github.com/NixOS/nixpkgs/issues/65399 <code>wrapQtAppsHook</code>]. The hook wraps every qt application with adding <code>QT_PLUGIN_PATH</code> and <code>XDG_DATA_DIRS</code> as well as <code>XDG_CONFIG_DIRS</code>.See [https://github.com/NixOS/nixpkgs/blob/nixos-19.09/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh wrap-qt-apps-hook.sh in nixpkgs] | The package will need to be fixed to use [the new https://github.com/NixOS/nixpkgs/issues/65399 <code>wrapQtAppsHook</code>]. The hook wraps every qt application with adding <code>QT_PLUGIN_PATH</code> and <code>XDG_DATA_DIRS</code> as well as <code>XDG_CONFIG_DIRS</code>.See [https://github.com/NixOS/nixpkgs/blob/nixos-19.09/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh wrap-qt-apps-hook.sh in nixpkgs] | ||
=== 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. | ||