Tdesktop: Telegram can't run natively on Wayland

Created on 13 Aug 2016  Â·  54Comments  Â·  Source: telegramdesktop/tdesktop

Steps to reproduce

  1. Launch Telegram Desktop under a Wayland session.
  2. Use any method to see if it's running via XWayland or on Wayland natively, e.g. this one.

    Expected behaviour

Telegram should use Wayland natively, as Qt supports Wayland backend.

Actual behaviour

Telegram uses X, so it has to be forwarded via XWayland, which causes performance and compatibility issues.

Configuration

Operating system: Fedora 24, GNOME on Wayland session

Version of Telegram Desktop: 0.10.1

Logs

Manually asking Telegram to run on Wayland results in an error:

$ QT_QPA_PLATFORM=wayland-egl /opt/telegram/Telegram 
This application failed to start because it could not find or load the Qt platform plugin "wayland-egl"
in "".

Available platform plugins are: xcb.

Reinstalling the application may fix this problem.
<traceback>

Suggesting that the bundled Qt is only built with X support.

Relevant Qt docs: https://wiki.qt.io/QtWayland

build linux

Most helpful comment

OK, it's 2018 now and Wayland is default in F28 KDE. I'm receiving:

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

Available platform plugins are: xcb.

The workaround is to install the package from the RPM Fusion repository - but now that Wayland is now becoming mainstream in Plasma, don't you folks think it's time to fix this build?

All 54 comments

Related to #2255

Can you try to build it including QtWayland? Would it work then?

I don't dare -- the instructions are truly horrendous (I wish it would just be ./configure && make && make install). Whoever does Linux builds should (try to) do it.

Also, I _suspect_ Qt Wiki is out-of-date and Qt5 now supports Wayland by default -- but somehow Telegram is still built without Wayland support.

cc @auchri

It supports it, but you should "enable" it by linking.

2255 related btw

Also, I think someone should try to build it with and without wayland to see if size difference isn't much

2255 related btw

Yep, that's what I said in my second message ;)

Also, I think someone should try to build it with and without wayland to see if size difference isn't much

Please, please, do!

Is there some progress being made in the last months? Still can't run the binary from webpage on KDE Wayland. Needs to be compiled with the "wayland" plugin.

Terminal output:
```This application failed to start because it could not find or load the Qt platform plugin "wayland"
in "".

Available platform plugins are: xcb.

I can't see why the workaround is even necessary -- Telegram works with XWayland just fine. This issue is about it lacking _native_ Wayland support.

@bugaevc I am using upstream Telegram on KDE Plasma 5.9.4 and the workaround is the first stuff I have found out that lets me use Telegram

@Germano0 Wayland support in KDE Plasma is not stable yet, so if X apps don't run properly it's Plasma's or distro's issue, not Telegram's -- you better report it to them.

@bugaevc Ok

@Germano0 Wayland support in KDE Plasma is not stable yet, so if X apps don't run properly it's Plasma's or distro's issue, not Telegram's -- you better report it to them.

That would be our fault, and I'd be happy for someone to report what those issues actually are to KDE.
"performance and compatibility issues." is not specific enough.

The crash (https://github.com/telegramdesktop/tdesktop/issues/2255) however, is not Plasma's doing.

It shows that your app is trying to load a plugin, and then failing. That's either you, Qt or packaging - but definitely not Plasma.
Do you bundle Qt? If so it looks like you're also loading the system's plugins, so it finds something but it's not ABI compatiable.

Any progress to run Telegram natively on Wayland?

Update: Today I learned that there is https://github.com/xvitaly/tgbuild. Moreover, there is telegram-desktop package in RPM Fusion that is not only easier to install (in fact, that's what Fedy now uses), but it also integrates way better with the rest of the system. In particular, it uses the native system libraries, including Qt, not the bundled & patched copy.

While the version of Qt that Fedora uses does support Wayland (try QT_QPA_PLATFORM=wayland telegram-desktop), the experience is quite poor (there are rendering and theming artefacts and more). This is probably why Qt is configured to use X11 by default.

Those are Qt/Fedora issues, but considering that the upcoming Ubuntu 17.10 will use Wayland by default, it should make sense for Telegram developers to ensure their bundled version of Qt works well on Wayland, too.

(By the way, is Telegram really supposed to be built on Ubuntu 12.04? That would be like still using XCode 4 on OS X Mountain Lion)

@bugaevc For Linux I build on the minimal version I support. For macOS I know a way to build Telegram Desktop on macOS 10.12.6 using Xcode 8.3.3 so that it runs on 64bit OS X 10.6.8 - but when I tried to build Telegram Desktop on Ubuntu 14.04 and then launch on Ubuntu 12.04 I've got some binary incompatibility with available glibc version =(

If someone will show me how to build Telegram Desktop on Ubuntu 16.04 that will run without any additional dependencies on Ubuntu 12.04 I'll gladly switch.

Are you sure you want to continue to support a 5 year old version of ubuntu? It's not even supported by Canonical anymore (unless you pay for it).

@ziggy42 The building will be done on Ubuntu 14.04, launching will still be supported for some time on the old version as well.

It might be interesting to some people to know about http://github.com/CrimsonAS/gtkplatform/ which allows for running Qt applications using gtk+ as a "host" (for window management, input events etc). This means that there's no need for xwayland in this picture.

One of the applications I wrote this for was actually Telegram Desktop, run via the Fedora packages, so I know it works pretty well.

Any updates on this?

any update on this? as KDE Plasma 5.12 Beta already supported Wayland ...
https://paste.ubuntu.com/26397953/

OK, it's 2018 now and Wayland is default in F28 KDE. I'm receiving:

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

Available platform plugins are: xcb.

The workaround is to install the package from the RPM Fusion repository - but now that Wayland is now becoming mainstream in Plasma, don't you folks think it's time to fix this build?

Starting with Qt 5.11 and Qt Creator 4.7, binaries in the official installers now also include Qt Wayland (previously you would have to build it yourself).

http://blog.qt.io/blog/2018/05/29/whats-new-in-qt-5-11-for-the-wayland-platform-plugin/

QT's wayland is pretty unusable with sway. My notifications literally pop up in a new split, making it much worse than xwayland.

Waiting anxiously (for years) for Telegram linux to run natively in a wayland session. Wayland is now very usable on the top two DEs (gnome and kde plasma), and it woudl be nice to do without xwayland if possible. One can of course run the web client, but persistent tray notification are pretty essential for a chat client.

https://github.com/telegramdesktop/tdesktop/issues/5180#issuecomment-423763413 states it already runs natively in a wayland session.

@Aokromes He was not talking about the official binary but about the one shipped by certain linux distributions. This issues is about the binary that is compiled with the internal qt. Therefore both issues are unrelated.

GNOME is getting closer and closer to having Wayland as a default. Is there any update on this? As far as I know, Qt supports Wayland natively and it shouldn't be hard to get it working.

GNOME is getting closer and closer to having Wayland as a default.

GNOME has already defaulted to Wayland for many releases. Ubuntu still ships the X.Org session by default though.

I'm on Fedora 30. Installed telegram-desktop from RPMFusion and launching via QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop seems to work well. I don't know a way to make this happen automatically though.

Have you tried the xeyes test?


From: Jon Leighton notifications@github.com
Sent: Wednesday, May 8, 2019 9:53 AM
To: telegramdesktop/tdesktop
Cc: Rohit Goswami; Comment
Subject: Re: [telegramdesktop/tdesktop] Telegram can't run natively on Wayland (#2353)

I'm on Fedora 30. Installed telegram-desktop from RPMFusion and launching via QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop seems to work well. I don't know a way to make this happen automatically though.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

Indeed, the Telegram packaged by distros uses the system version of Qt that supports Wayland (see my comment above). This issue is about the build of Telegram distributed by the upstream, with the bundled Qt.

It doesn't depend on whether the version of qt the distro ships supports wayland. It depends on how they build their telegram-desktop package. E.g., the arch package does not support wayland. If you run QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop you get back:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
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.

It doesn't depend on whether the version of qt the distro ships supports wayland. It depends on how they build their telegram-desktop package. E.g., the arch package does not support wayland. If you run QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop you get back:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
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.

@nortexoid Do you have qt5-wayland installed? It does not get pulled in by default. telegram-desktop on Arch should work on wayland once you have this installed.

It doesn't depend on whether the version of qt the distro ships supports wayland. It depends on how they build their telegram-desktop package. E.g., the arch package does not support wayland. If you run QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop you get back:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
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.

@nortexoid Do you have qt5-wayland installed? It does not get pulled in by default. telegram-desktop on Arch should work on wayland once you have this installed.

I did not! Thanks for the tip. However, after installing qt5-wayland and running QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop, telegram is still using X as confirmed by using xprop on its window.

It doesn't depend on whether the version of qt the distro ships supports wayland. It depends on how they build their telegram-desktop package. E.g., the arch package does not support wayland. If you run QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop you get back:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
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.

@nortexoid Do you have qt5-wayland installed? It does not get pulled in by default. telegram-desktop on Arch should work on wayland once you have this installed.

I did not! Thanks for the tip. However, after installing qt5-wayland and running QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop, telegram is still using X as confirmed by using xprop on its window.

No, sorry, it does work. Telegram was running in the background when I tried to force wayland.

Even if it does work on a given platform via QT_QPA_PLATFORM=wayland /usr/bin/telegram-desktop, this is a pretty inconvenient way to launch Telegram. It seems to me that it should 'just work', i.e. automatically use Wayland when I am running Wayland. Is this something that needs to be addressed by the tdesktop project, or the distro packagers?

Qt's wayland backend isn't feature complete and GNOME doesn't support server-side decorations on Wayland, so making it the default wouldn't be a good idea just yet.

and GNOME doesn't support server-side decorations on Wayland, so making it the default wouldn't be a good idea just yet.

I fail to see how these are related. Yes, on GNOME, and generally on Wayland by default, Qt uses client-side decorations. How is that a reason not to ship Wayland support by default?

It seems to me that it should 'just work', i.e. automatically use Wayland when I am running Wayland. Is this something that needs to be addressed by the tdesktop project, or the distro packagers?

For the Telegram version you've got from the distro, it's up to the distro packagers — perhaps they feel Qt Wayland support is not stable enough yet. For the upstream Telegram Linux builds (https://desktop.telegram.org), it's up to the upstream Telegram developers to build the bundled Qt with Wayland support and perhaps make it the default.

It seems to me that it should 'just work', i.e. automatically use Wayland when I am running Wayland. Is this something that needs to be addressed by the tdesktop project, or the distro packagers?

For the Telegram version you've got from the distro, it's up to the distro packagers — perhaps they feel Qt Wayland support is not stable enough yet. For the upstream Telegram Linux builds (https://desktop.telegram.org), it's up to the upstream Telegram developers to build the bundled Qt with Wayland support and perhaps make it the default.

Qt now supports fallback platforms, e.g. QT_QPA_PLATFORM="wayland;xcb" will default to wayland but fall back to xcb if needed. So defaulting to wayland while providing xcb as fallback would incur no cost.

@nortexoid Will it work fine with wayland platform plugin from Qt 5.6.2? 🙈

@nortexoid Will it work fine with wayland platform plugin from Qt 5.6.2? see_no_evil

Unfortunately not. It's new to qt 5.11: see here.

Tried to build on my Gentoo without success xD

The issue is from 2016, any plans to upgrade the Qt version?

QT's wayland is pretty unusable with sway. My notifications literally pop up in a new split, making it much worse than xwayland.

I had this issue with sway too. I just discovered there's a checkbox in Telegram's settings called 'Use native notifications' -- turning that on solves this.

@noamcore on september preston will deprecate windows xp and more old OSs and that will allow to upgrade QT.

telegram desktop is using now updated QT, this bug must be fixed now.

telegram desktop is using now updated QT, this bug must be fixed now.

No, telegram's Qt build has Wayland disabled.

The Flatpak builds still cause Telegram to run on Xwayland rather than Wayland. And considering that RPMFusion didn't have telegram-desktop, how to go about it? Specifically, here is an attached screenshot

image

Same here as @c-thun reported. Please reopen this issue as Telegram still can't run natively on Wayland. Or should we open a separate issue for the Flatpak?

The Flatpak builds still cause Telegram to run on Xwayland rather than Wayland.

Qt defaults to XWayland on GNOME due to bad compatibility, you should set QT_QPA_PLATFORM=wayland

Qt defaults to XWayland on GNOME due to bad compatibility, you should set QT_QPA_PLATFORM=wayland

makes telegram work nicely and GNOME shell's looking glass tells me it is a wayland window, when running with QT_QPA_PLATFORM=wayland flatpak run --socket=wayland org.telegram.desktop. It even still has a tray icon (surprisingly).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FunctionalHacker picture FunctionalHacker  Â·  3Comments

TheAppService picture TheAppService  Â·  3Comments

JhonSane picture JhonSane  Â·  3Comments

beppe9000 picture beppe9000  Â·  3Comments

Yanrishatum picture Yanrishatum  Â·  3Comments