CoatiSoftware / Sourcetrail

Sourcetrail - free and open-source interactive source explorer
https://www.sourcetrail.com/
GNU General Public License v3.0
14.94k stars 1.41k forks source link

Wayland support in AppImage build? #1017

Open bam80 opened 4 years ago

bam80 commented 4 years ago

Hello, thank you for awesome app! Currently it can't run on Wayland natively, corresponding qt plugin seems missed:

$ QT_QPA_PLATFORM=wayland Applications/Sourcetrail_2020_1_117_Linux_64bit_838fbdbb027567876d3da8cf74c6d512.AppImage 
QCoreApplication::applicationDirPath: Please instantiate the QApplication object first
ERROR: Please run Sourcetrail via the Sourcetrail.sh script!
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: xcb.

Aborted (core dumped)

945 #279

GbGp commented 4 years ago

I don't have any problem running this software on wayland compiling from the sources, but the packages from the release page doesn't work for me as well. I think they were probably built on a system without the QtWayland module installed so they don't ship the required platform plugins: https://wiki.qt.io/QtWayland

bam80 commented 4 years ago

https://github.com/CoatiSoftware/Sourcetrail/blob/f3614a3745f0b2bcefb880f10e9a51380dd2fe64/setup/Linux/createPackages.sh#L98 @egraether could you confirm the docker build container contains QtWayland plugin? If so, maybe we should add it explicitly:

Adding extra Qt plugins

If you want aditional plugins which the tool doesn't deploy, for a variety of reasons, you can use the -extra-plugins argument and include a list of plugins separated by a comma.

https://github.com/probonopd/linuxdeployqt#adding-extra-qt-plugins

bam80 commented 4 years ago

https://github.com/CoatiSoftware/Sourcetrail/issues/279#issuecomment-675631335

mkdir -p appdir/usr/plugins/platformplugins/
cp /usr/lib/x86_64 /usr/plugins/platformplugins/qtwayland.so  appdir/usr/plugins/platformplugins/

# If you also want to deploy its dependencies, do something like this - but I don't think you want to bring Wayland libs to non-Wayland systems, so probably it's best NOT to do this
linuxdeployqt AppDir/usr/share/applications/sourcetrail.desktop -qmake=$Qt5_DIR/bin/qmake -ignore-glob=*python* -appimage -executable=appdir/usr/plugins/platformplugins/qtwayland.so

@probonopd Thanks. Wouldn't just -extra-plugins argument mentioned above do the job?

probonopd commented 4 years ago

can't run on Wayland natively

Doesn't Wayland come with a compatibility layer to be able to run the vast amount of existing Xorg applications?

bam80 commented 4 years ago

Yes it can be run as XWayland client, but that might have some drawbacks, so IMO it's worth just add proper Qt plugin, to have ability run app without any emulation layers.

probonopd commented 4 years ago

Then just copying the plugin to appdir/usr/plugins/platformplugins/qtwayland.so manually should do, as running things like -executable=appdir/usr/plugins/platformplugins/qtwayland.so or -extra-plugins would have the undesirable effect of also pulling in Wayland dependency libraries, which would not add any benefit on non-Wayland systems (and Wayland systems have them on the system anyway).

(For me personally, Wayland is and has been broken since it breaks compatibility with the existing screen recording and screen sharing apps. There seems to be no willingness from the Wayland developers to respect the existing software base out there by respecting the existing Xorg APIs. So I try to avoid using Wayland.)

Alexmitter commented 3 years ago

@probonopd Sorry to interject but that is just wrong. The Xorg "API" applications use to read the screen is simply them reading Xorgs buffer. This isnt a API, this is a dirty hack and there is no excuse for it. Are you seriously asking the wayland people write something that emulates Xorgs buffer so applications using a dirty hack to record the screen continue to work? There is a proper API now, something that asks the user before a application can record anything, and all the usual applications already support it.