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

Kate fails to start unless QT_QPA_PLATFORM_PLUGIN_PATH is set #41026

Closed
clacke opened this issue May 24, 2018 · 12 comments
Closed

Kate fails to start unless QT_QPA_PLATFORM_PLUGIN_PATH is set #41026

clacke opened this issue May 24, 2018 · 12 comments

Comments

@clacke
Copy link
Contributor

clacke commented May 24, 2018

Issue description

Kate fails with:

This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".

Steps to reproduce

$ nix-shell --pure -p kate --run "XAUTHORITY=$XAUTHORITY DISPLAY=$DISPLAY kate"
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

This works (kate starts, opens its main window, runs fine):

$ nix-shell --pure -p kate --run "XAUTHORITY=$XAUTHORITY DISPLAY=$DISPLAY QT_QPA_PLATFORM_PLUGIN_PATH=$(nix-build '<nixpkgs>' -A qt5.qtbase)/lib/qt-5.10/plugins/platforms kate"

qtbase should probably set that variable, and kate wrap it?

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.9.86, NixOS, 17.09.3254.967e40787c5 (Hummingbird)
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.0.2
  • channels(root): "nixpkgs-18.09pre140004.425ff431aba, nixos-17.09.3254.967e40787c5"
  • channels(clacke): "nixpkgs-18.09pre140004.425ff431aba"
  • nixpkgs: /home/clacke/.nix-defexpr/channels/nixpkgs
@clacke
Copy link
Contributor Author

clacke commented May 24, 2018

Alternatively, QLibraryInfo could be made to return the right path to platforms.

http://doc.qt.io/archives/qt-4.8/qlibraryinfo.html

@peterhoeg
Copy link
Member

Works here without:

peter@dolores:~ $ echo $QT_QPA_PLATFORM_PLUGIN_PATH

peter@dolores:~ $ file $(which kate)
/run/current-system/sw/bin/kate: symbolic link to /nix/store/pm35jrp2nagsj0cw88svj8k9pn94jmi4-kate-18.04.1/bin/kate
peter@dolores:~ $ file /nix/store/pm35jrp2nagsj0cw88svj8k9pn94jmi4-kate-18.04.1/bin/kate                                                                                                                    ~
/nix/store/pm35jrp2nagsj0cw88svj8k9pn94jmi4-kate-18.04.1/bin/kate: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /nix/store/27x7pinqdsl9f3rpbm8bsszd9fhwq266-glibc-2.27/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

And kate then launches as normal.

@clacke
Copy link
Contributor Author

clacke commented May 24, 2018

Huh.

Did you run nix-shell with --pure to check that there isn't some other variable that makes it work? How is e.g. your LD_LIBRARY_PATH?

@clacke
Copy link
Contributor Author

clacke commented May 24, 2018

Same kate hash:

$ nix-shell -p kate --run 'file $(which kate)'
/nix/store/pm35jrp2nagsj0cw88svj8k9pn94jmi4-kate-18.04.1/bin/kate: ELF 64-bit [ . . . ]

@peterhoeg
Copy link
Member

The issue is that the qt/kde applications don't work well (or at all) unless installed using environment.systemPackages. Sorry, I should have noticed that from the beginning.

@clacke
Copy link
Contributor Author

clacke commented May 25, 2018

What is it that makes them work as system packages? Must be some environment variable somewhere, right?

@peterhoeg
Copy link
Member

No, it's not quite that simple unfortunately: #24256 (comment)

Your two options are:

  1. Install in environment.systemPackages
  2. Set the variable manually

@clacke
Copy link
Contributor Author

clacke commented May 25, 2018

I believe setting that variable in the wrapper will break the application under KDE.

Ok, that settles it then. Thanks for the clear information.

@clacke
Copy link
Contributor Author

clacke commented May 25, 2018

For any passers-by who happen to read this:

It's not necessary to install KDE and it's not necessary to install anything system-wide. Simply installing with nix-env -iA nixpkgs.kate makes kate work without issues.

It finds the appropriate things via your profile, it's only the environment method via nix-shell that doesn't work.

@peterhoeg
Copy link
Member

While that is technically true, having Qt applications in both the system environment as well as user environments has its own problems in case they happen to be updated at different times. If you have application A in the system environment that depends on Qt 5.9.2 and application B that depends on Qt 5.9.3 just because they were installed at different times, depending on the load order one of them will stop working.

@clacke
Copy link
Contributor Author

clacke commented May 25, 2018

Right, that would be an issue. My comment is meant only from the perspective of "what do I need to do to make my program start?". To reframe it to be clear:

If you have a Qt program that won't start from platform plugin load failure when you nix-shell it, your three options are:

  1. Install in environment.systemPackages.
  2. Set QT_QPA_PLATFORM_PLUGIN_PATH.
  3. Install in your profile with nix-env.

@clacke
Copy link
Contributor Author

clacke commented May 25, 2018

The my Qt vs system Qt issue sounds like a tough nut to crack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants