Skip to content

Qt applications fail due to xcb plugin mismatch #24256

Closed

Description

@lheckemann

Issue description

% nix-shell -p openshot-qt

[nix-shell:~]$ openshot-qt
Loaded modules from current directory: /nix/store/0r6czdfcgfwqgar2sbz5zhrbysrmkn80-openshot-qt-2.1.0/lib/python3.5/site-packages
      launch:INFO ------------------------------------------------
      launch:INFO    OpenShot (version 2.1.0)
      launch:INFO ------------------------------------------------
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: minimal, offscreen, xcb.

Reinstalling the application may fix this problem.
Aborted

[nix-shell:~]$

Technical details

  • System: 17.03beta320.ade5837 (Gorilla)
  • Nix version: nix-env (Nix) 1.11.7
  • Nixpkgs version: "17.03beta617.f3a9ccc"

Activity

  1. lheckemann commented on Mar 23, 2017

    @lheckemann
    MemberAuthor

    Works fine when installed using nix-env -iA nixos.openshot-qt, but both should be possible, right?

  2. AndersonTorres commented on Mar 24, 2017

    @AndersonTorres
    Member

    Incidentally there is a new version of openshot: #22710

    (edited a typo, many thanks @lheckemann !)

  3. lheckemann commented on Mar 24, 2017

    @lheckemann
    MemberAuthor

    Wrong issue number? I guess you meant #22710

  4. edolstra commented on Apr 3, 2017

    @edolstra
    Member

    I have the same problem with krita (installed via nix-env):

    $ krita
    This application failed to start because it could not find or load the Qt platform plugin "xcb"
    in "".
    
    Available platform plugins are: minimal, offscreen, xcb.
    
    Reinstalling the application may fix this problem.
    Aborted
    

    Installing it via environment.systemPackages does work.

    strace shows the following:

    open("/run/current-system/sw/lib/qt5/plugins/platforms", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
    open("/nix/store/32s4bd5mficwpp6064s5rvkpvhzycbkn-qtbase-5.6.2/lib/qt5/plugins/platforms/libqxcb.so", O_RDONLY|O_CLOEXEC) = 3
    open("/nix/store/96xragmk6ap2y988qpw50ck7qwfg511j-qtbase-5.7.1/lib/qt5/plugins/platforms/libqxcb.so", O_RDONLY|O_CLOEXEC) = 3
    

    So it's opening two mismatching versions of libqxcb.so, where one is probably discovered via /run/current-system/sw/lib/qt5/plugins/platforms.

  5. changed the title [-]openshot-qt does not start in nix-shell[/-] [+]Qt applications fail due to xcb plugin mismatch[/+] on Apr 3, 2017
  6. abbradar commented on Apr 4, 2017

    @abbradar
    Member

    Related discussion: #24133

    For now one should remove everything that installs Qt plugins (not input ones, they are good) from their environment to fix this -- usually that's qtbase, qtEnv or other Qt packages.

    cc @ttuegel

  7. ttuegel commented on Apr 8, 2017

    @ttuegel
    Member

    I am working on making Qt packages entirely insensitive to their environment.

  8. edolstra commented on Apr 10, 2017

    @edolstra
    Member

    @ttuegel What would be the implications of that? Isn't the plugin mechanism necessary for certain things (like picking up the open dialog box of the desktop environment, theming etc.)?

  9. ttuegel commented on Apr 10, 2017

    @ttuegel
    Member

    Isn't the plugin mechanism necessary for certain things (like picking up the open dialog box of the desktop environment, theming etc.)?

    Right now, I have patched our Qt libraries to go spelunking through NIX_PROFILES in addition to QT_PLUGIN_PATH. I'm not going to remove plugin support, I'm just going to stop going through NIX_PROFILES looking for every possible plugin. 😃 All the desktop integration and theming plugins are currently provided by Qt or KDE anyway, but QT_PLUGIN_PATH will still work should it be necessary.

  10. glaebhoerl commented on May 5, 2017

    @glaebhoerl
    Contributor

    FWIW if anyone wants a quick and ugly hack to just get an application (in my case kolourpaint) to hopefully start without having to remove or reinstall a bunch of packages:

    $ ls /nix/store/*qtbase*/lib/qt5/plugins/platforms/libqxcb.so
    /nix/store/0igx2hwicb18di1mx65qh3jrpypvc40a-qtbase-5.6.1-1/lib/qt5/plugins/platforms/libqxcb.so 
    /nix/store/9kmi6a4pba9g45wr4c1ny5kasc70jbx9-qtbase-5.6.2/lib/qt5/plugins/platforms/libqxcb.so
    /nix/store/3qz77v287y42s3a9l1745551idfcdflr-qtbase-5.8.0/lib/qt5/plugins/platforms/libqxcb.so    
    /nix/store/f2680a9j60qi724k7dgphxamlqsq933x-qtbase-5.6.1-1/lib/qt5/plugins/platforms/libqxcb.so

    (choose the one that seems appropriate, or just trial and error)

    $ NIX_PROFILES=/nix/store/3qz77v287y42s3a9l1745551idfcdflr-qtbase-5.8.0 kolourpaint

    (May or may not fail for applications with more complicated dependencies than kolourpaint, did not try.)

  11. glaebhoerl commented on May 6, 2017

    @glaebhoerl
    Contributor

    ...hm. I'm not 100% sure if this issue is the culprit, but I rebooted and KDE itself failed to start (error message something like "core shell components could not be found, this is a packaging problem, contact your distro"). I did nix-env -e kolourpaint and rebooted again and then it worked.

  12. ttuegel commented on May 10, 2017

    @ttuegel
    Member

    This is fixed in master: Qt applications know about the QPA plugins they are built with.

  13. CMCDragonkai commented on Jul 31, 2017

    @CMCDragonkai
    Member

    @ttuegel I think I'm getting this error at #27790 is there quick fix for people still on 17.03? @glaebhoerl 's trick did not work for me.

  14. edolstra commented on Sep 10, 2017

    @edolstra
    Member

    @ttuegel I still this error when running 17.09-based Qt packages on NixOS 17.03 (e.g. Krita or Tribler). For Tribler, I added this line to the wrapper:

            --set QT_QPA_PLATFORM_PLUGIN_PATH ${qt5.qtbase.bin}/lib/qt-*/plugins/platforms \
    

    which fixes it. Is that the recommended solution?

  15. 6 remaining items

  16. jirkadanek commented on Mar 16, 2018

    @jirkadanek
    Member

    What helped me was either to 1) declare the application in /etc/nixos/configuration.nix 2) run nix-env -u --leq, the doc says for this parameter

    In addition to upgrading to newer versions, also “upgrade” to derivations that have the same version. Version are not a unique identification of a derivation, so there may be many derivations that have the same version. This flag may be useful to force “synchronisation” between the installed and available derivations. -- https://nixos.org/releases/nix/nix-1.7/manual/#sec-nix-env

  17. jluttine commented on May 9, 2018

    @jluttine
    Member

    FWIW, I'll add a comment how I fixed this in my case. I ran the failing command with LD_DEBUG=libs some_failing_command and then read from the last few lines what library it failed to find. Then added that to the environment and repeat until the command succeeds. For instance, in my case, adding xlibs.libX11 and xlibs.libXi to the environment solved the issue.

    Background: I have FHS user env for Conda and when I launched IPython (ipython --pylabs) installed by Conda, I got the error: This application failed to start because it could not find or load the Qt platform plugin "xcb" in "". So I just needed to add all relevant libraries to this FHS user env. This is probably very different scenario than the OP (or others) had, but just thought I'd share this here in case someone has a similar issue as I did and looks for help here.

  18. added a commit that references this issue on Sep 23, 2018
    f5a5752
  19. alex-ameen commented on Aug 1, 2019

    @alex-ameen
    Contributor

    Hey I was just struggling with this for a few hours trying to run VirtualBox.
    This has some obvious flaws that will not make this a great solution for everybody; but if you're in a bind you can give this a shot.

    My fix was :

    # In `configuration.nix`
    { config, lib, pkgs, options, ... }:
    {
      virtualisation.virtualbox.host.enable = true;
      environment.pathsToLink = ["${pkgs.xorg.libxcb}/lib/"];
    }
  20. timbertson commented on Nov 30, 2019

    @timbertson
    Contributor

    My previous workaround of exporting QT_QPA_PLATFORM_PLUGIN_PATH in my shell caused my (fedora system installed) vlc to segfault on startup. So I'd definitely vote for qt apps to be self-contained rather than integrating with the desktop, if this is the outcome.

  21. added a commit that references this issue on Jan 12, 2020
  22. jmercouris commented on Oct 28, 2020

    @jmercouris

    I just upgraded to 20.09 and am running into this issue with my KDE applications. How to fix?

  23. fadenb commented on Nov 11, 2020

    @fadenb
    Contributor

    Same here, experiencing this since upgrading to 20.09.
    In my case, electrum is installed system wide.

    → electrum                                                                                                                                                                        ~
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
    
    [1]    6077 abort (core dumped)  electrum
    
  24. bhipple commented on Nov 15, 2020

    @bhipple
    Contributor

    Perhaps try upgrading everything you have imperatively installed via nix-env? You may have an old ver in your ~/.nix-profile and a new ver on the system.

    nix-env --upgrade
    
  25. jmercouris commented on Nov 15, 2020

    @jmercouris

    I have installed nothing imperatively.

  26. Luz commented on Sep 18, 2023

    @Luz
    Member

    I have not found my desired solution in this thread, but in that other one. So I'd like to link it to here, in case anyone else is stumbling upon this.
    I suggest to add the following line to the nix-shell file (in my case to a default.nix):
    QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.version}/plugins";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions