# ‘Could not find the Qt platform plugin’

**URL:** <https://discourse.appimage.org/t/could-not-find-the-qt-platform-plugin/3020>\
**Category:** Creating AppImages\
**Created:** [July 10, 2023, 3:56am UTC](https://discourse.appimage.org/t/could-not-find-the-qt-platform-plugin/3020 "2023-07-10T03:56:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bradrn](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/bradrn/32/847_2.png) [@bradrn](https://discourse.appimage.org/u/bradrn)\
**Post date:** [July 10, 2023, 3:56am UTC](https://discourse.appimage.org/t/could-not-find-the-qt-platform-plugin/3020/1 "2023-07-10T03:56:28Z")

</div>

I am trying to distribute my software [Brassica](https://github.com/bradrn/brassica/tree/master) as an AppImage. Since this is in most respects a standard Qt application, I was able to follow the [instructions in the documentation](https://docs.appimage.org/packaging-guide/from-source/native-binaries.html#cmake) to create one fairly easily (albeit with a bit of trial-and-error since it depends on some Haskell shared libraries). However, when I attempt to run this AppImage on my machine (EndeavourOS, so practically Arch Linux), I consistently get an error from `qt.qpa.plugin` that it ‘Could not find the Qt platform plugin’.

The exact form of the error seems to depend on whether I run X11 or Wayland. With X11, I get:

```auto
$ ./Brassica.AppImage 
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.

Aborted (core dumped)

```

Whereas with Wayland I get:

```auto
$ ./Brassica.AppImage 
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
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.

Aborted (core dumped)

```

This behaviour seems to depend on the host system. If I run this AppImage on the same Debian ‘Bullseye’ VM in which it was created, it runs without a problem. However, it appears to be a problem with the AppImage itself rather than my machine: other Qt AppImages seem to open unproblematically, and certainly without complaining about platform plugins. Does anyone have any ideas as to how I can fix this issue?

---

<div class="post-metadata">

**Author:** ![bradrn](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/bradrn/32/847_2.png) [@bradrn](https://discourse.appimage.org/u/bradrn)\
**Post date:** [July 11, 2023, 4:49am UTC](https://discourse.appimage.org/t/could-not-find-the-qt-platform-plugin/3020/2 "2023-07-11T04:49:00Z")

</div>

Well, I’ve managed to half-fix the issue… [as discussed in the documentation](https://doc.qt.io/qt-6/linux-deployment.html), copying the correct file to `usr/plugins/platforms/libqxcb.so` within the AppDir fixes the issue. For my purposes, I also found it useful to copy over the `platforminputcontexts` so I could use IMEs in my application.

Unfortunately, this solution doesn’t seem to work consistently. It works when I run the AppImage on the same machine it was created on — which previously failed for some machines — but when I try to run the AppImage on a different machine, it fails with the same message. This is despite the fact that mounting with `--appimage-mount` reveals that the AppImage does in fact contain the correct platform plugins. Some help with this would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [July 15, 2023, 12:12pm UTC](https://discourse.appimage.org/t/could-not-find-the-qt-platform-plugin/3020/3 "2023-07-15T12:12:52Z")

</div>

Welcome @bradrn.

Are you using linuxdeploy-plugin-qt? Then please ask over at [Issues · linuxdeploy/linuxdeploy-plugin-qt · GitHub](https://github.com/linuxdeploy/linuxdeploy-plugin-qt/issues), since its author isn’t reading here.

Thanks, and much success with your app!
