Subject: Re: bug#73897: QT_PLUGIN_PATH is set by guix home and causes flameshot error (Ubuntu 22.04.5 LTS)

From: Maxim Cournoyer <[email-masked]>
Date: Wed, 23 Oct 2024 22:01:01 +0900

Hi Rodrigo,

Rodrigo Morales <[email-masked]> writes:

> I am using "guix home" for managing my dotfiles in Ubuntu 22.04.5 LTS.
>
> I noticed that the environment variable =QT_PLUGIN_PATH= is set to
> paths contained within ~/.guix-home and ~/.guix-profile (see first
> code block below.) This created an error when trying to run the binary
> flameshot which was installed through =sudo apt install flameshot=
> (see second code block below.)
>
> #+BEGIN_SRC text
> $ env | grep -i qt
> QT_ACCESSIBILITY=1
> QT_IM_MODULE=ibus
> QMAKEPATH=/home/rodrigo/.guix-home/profile/lib/qt5:/home/rodrigo/.guix-profile/lib/qt5
> QT_PLUGIN_PATH=/home/rodrigo/.guix-home/profile/lib/qt5/plugins:/home/rodrigo/.guix-profile/lib/qt5/plugins
> #+END_SRC
>
> #+BEGIN_SRC text
> $ flameshot gui ; echo Exit code: $?
> 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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.

This reminds me of bug#54129, and also that Guix used to cobble up
PYTHONPATH for its own use, which would interfere with a foreign
distribution's Python installation.

Perhaps Qt could be patched to, on top of the usual environment
variable, accept GUIX_ prefixed ones that would be used by the Guix
search paths.  This way Qt from Guix would be able to discover its installed
Qt modules without interfering with the host Qt.

Meamwhile, you also use flameshot from Guix instead, to resolve your
immediate issue.

-- 
Thanks,
Maxim