Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
matthewbauer opened this issue Jul 2, 2018 · 10 comments
Closed

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

matthewbauer opened this issue Jul 2, 2018 · 10 comments
Labels
6.topic: darwin Running or building packages on Darwin

Comments

@matthewbauer
Copy link
Member

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
@orivej
Copy link
Contributor

orivej commented Jul 2, 2018

I have discovered a robust way for running Qt applications without installing them globally in #30551 (comment)

@matthewbauer
Copy link
Member Author

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.

@orivej
Copy link
Contributor

orivej commented Jul 2, 2018

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 ttuegel/qtbase@efad454. May @ttuegel have had an alternative idea when he reverted it in ttuegel/qtbase@20ab8e8?

@LnL7 LnL7 added the 6.topic: darwin Running or building packages on Darwin label Jul 4, 2018
@matthewbauer
Copy link
Member Author

matthewbauer commented Jan 25, 2019

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

@jackTaw88
Copy link

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?

@matthewbauer matthewbauer reopened this Feb 14, 2019
@matthewbauer
Copy link
Member Author

matthewbauer commented Feb 14, 2019

This actually should be handled better with:

#54525

@jcable
Copy link

jcable commented Apr 4, 2019

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?

@vuxyp
Copy link

vuxyp commented Aug 31, 2019

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.

@srghma
Copy link
Contributor

srghma commented Sep 24, 2019

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 c4196cca9ac


waiting for #65399

strager added a commit to strager/nixpkgs that referenced this issue Feb 2, 2020
On Darwin/macOS, chatterino2's install phase copies no files into the
output. `make install` does not copy chatterino2.app. Copy the .app
manually, fixing the installation.

With this patch, chatterino2 almost works on macOS. Issue NixOS#42893
applies, so to make chatterino2 work, you must install qtbase in your
environment. For example:

    $ nix-env -iA nixpkgs.qt5.qtbase
    $ open ~/.nix-profile/Applications/chatterino.app
@worldofpeace
Copy link
Contributor

this is a stale bug #65399

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin
Projects
None yet
Development

No branches or pull requests

8 participants