Nixpkgs: qt5: could not find the qt platform plugin "cocoa" in ""

Created on 3 Jul 2018  Â·  10Comments  Â·  Source: NixOS/nixpkgs

Issue description

Running into this on Dwarf Therapist on macOS. Here is the text:

qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

abort trap: 6

Steps to reproduce

$ nix-build '<nixpkgs>' -A dwarf-fortress-packages.dwarf-therapist-original
$ ./result/Applications/DwarfTherapist.app/Contents/MacOS/DwarfTherapist
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

abort trap: 6
darwin

All 10 comments

I have discovered a robust way for running Qt applications without installing them globally in https://github.com/NixOS/nixpkgs/issues/30551#issuecomment-346319767

Ok that could be helpful! Still with things like nix run it seems like there is an expectation that you shouldn't have to install things for them to work.

This is true, and this should definitely be possible to achieve at least when qtbase plugins are sufficient for the application. The only difficulty with implementing this that I know is that Qt loads all plugins that it can find, but it should only be allowed to find compatible plugins (built against the same revision of qtbase), and it probably shouldn't load the same plugin twice (when it appears in multiple search paths).

Nixpkgs support Qt plugins thanks to https://github.com/ttuegel/qtbase/commit/efad4548aeeb7218600ca2188307bd9668c93d7c. May @ttuegel have had an alternative idea when he reverted it in https://github.com/ttuegel/qtbase/commit/20ab8e8d4bde38e83e9b50c6b457e4a517975417?

To be clear, the fix for this is:

$ nix-env -iA nixpkgs.qt5.qtbase
$ export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS

To be clear, the fix for this is:

$ nix-env -iA nixpkgs.qt5.qtbase
$ export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS

@matthewbauer will this issue bi fixed automatically? or should we type these commands?

This actually should be handled better with:

https://github.com/NixOS/nixpkgs/pull/54525

I get "Could not load the Qt platform plugin "cocoa" in "" even though it was found." running a unit test from qtcreator. Any ideas how this might be resolved?

I have the latest version of speedcrunch.

I am using UBuntu 18.04. When I start speedcrunch I got this error:

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.

same issue when running qdigidoc4

/nix/store/k9mfjxm301y32z4m1r9gz5zl4r056n3a-qdigidoc-4.1.0/bin î‚° qdigidoc4
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.

[1]    26252 abort      qdigidoc4

The

nix-env -iA nixpkgs.qt5.qtbase
export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS

indeed fixes it


installed from

nix-instantiate --eval -E '(import <nixpkgs-unstable> {}).lib.version'
"20.03pre193309.c4196cca9ac"

which is from this commit https://github.com/NixOS/nixpkgs/commit/c4196cca9ac


waiting for https://github.com/NixOS/nixpkgs/issues/65399

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spacekitteh picture spacekitteh  Â·  3Comments

sid-kap picture sid-kap  Â·  3Comments

yawnt picture yawnt  Â·  3Comments

chris-martin picture chris-martin  Â·  3Comments

vaibhavsagar picture vaibhavsagar  Â·  3Comments