Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebEngine display blank window when appimage is run on recent distribution (fix inside) #554

Open
mgautierfr opened this issue Sep 13, 2022 · 19 comments

Comments

@mgautierfr
Copy link

The original issue is for the kiwix project with issue : kiwix/kiwix-desktop#810

This issue presents a small repro case and avoid all the kiwix full project : sample_qtwebengine.zip

The program is really simple, it is a QWebEngine with a "Hello, World!" text.

#include <QtGlobal>
#include <QApplication>
#include <QWebEngineView>


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWebEngineView view;
    view.setHtml("<html><body>Hello, World!</body></html>");
    view.resize(1024, 750);
    view.show();

    return app.exec();
}

The application is packaged with qt515 found in ppa https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.15.2-bionic
This is necessary as QtWebEngine is not packaged by Ubuntu bionic and we "need" bionic because of what described in #340

README.txt file explains how to compile the sample program (mostly qmake/make)

Appimage is generated using create_app_image.sh script in the archive. It mostly prepare AppDir, download last linuxdeployqt and run it to create appimage.

When generated AppImage is run on Ubuntu bionic, the webview display "Hello, World!".
When run on recent distribution (Fedora, Ubuntu 20.04, other?), the AppImage launch but webview is empty.
An Appimage generated on a recent distribution (with system qtWebEngine and option -unsupported-allow-new-glibc) works.

I've tried to compare strace log, between a run on Bionic and Fedora 36, but haven't found anything useful (at least for me)
Same when comparing the content of AppImage generated on Bionic and Fedora 36

@caralu74
Copy link

caralu74 commented Oct 1, 2022

I've got this:
/sample_qtwebengine$ qmake
Info: creating stash file /home/user/sample_qtwebengine/.qmake.stash
user@PC_X:
/sample_qtwebengine$ make
g++ -c -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WEBENGINEWIDGETS_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CORE_LIB -I. -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWebEngineWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtWebEngineCore -I/usr/include/x86_64-linux-gnu/qt5/QtQuick -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtQmlModels -I/usr/include/x86_64-linux-gnu/qt5/QtWebChannel -I/usr/include/x86_64-linux-gnu/qt5/QtQml -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5/QtPositioning -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o src/main.cpp
g++ -Wl,-O1 -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu -o sample_qtwebengine main.o /usr/lib/x86_64-linux-gnu/libQt5WebEngineWidgets.so /usr/lib/x86_64-linux-gnu/libQt5WebEngineCore.so /usr/lib/x86_64-linux-gnu/libQt5Quick.so /usr/lib/x86_64-linux-gnu/libQt5PrintSupport.so /usr/lib/x86_64-linux-gnu/libQt5Widgets.so /usr/lib/x86_64-linux-gnu/libQt5Gui.so /usr/lib/x86_64-linux-gnu/libQt5QmlModels.so /usr/lib/x86_64-linux-gnu/libQt5WebChannel.so /usr/lib/x86_64-linux-gnu/libQt5Qml.so /usr/lib/x86_64-linux-gnu/libQt5Network.so /usr/lib/x86_64-linux-gnu/libQt5Positioning.so /usr/lib/x86_64-linux-gnu/libQt5Core.so -lGL -lpthread
user@PC_X:~/sample_qtwebengine$ ./sample_qtwebengine

$ ./create_app_image.sh
linuxdeployqt (commit 5fa79fa), build 36 built on 2022-08-21 12:36:03 UTC
ERROR: The host system is too new.
Please run on a system with a glibc version no newer than what comes with the oldest
currently still-supported mainstream distribution (Ubuntu Bionic), which is glibc 2.27.
This is so that the resulting bundle will work on most still-supported Linux distributions.
For more information, please see
#340

@probonopd
Copy link
Owner

When generated AppImage is run on Ubuntu bionic, the webview display "Hello, World!".
When run on recent distribution (Fedora, Ubuntu 20.04, other?), the AppImage launch but webview is empty.

Do you get any errors when launched from the comand line?

unsupported-...

It is unsupported and broken, don't use it.

@mgautierfr
Copy link
Author

Do you get any errors when launched from the comand line?

Only a warning :
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

It is unsupported and broken, don't use it.

Yes, it was just to say that a same application generated on a recent platform works. (but I need to use the unsupported option).
The issue is about a appImage generated on a supported platform.

@probonopd
Copy link
Owner

Please try on a system without Wayland. Does it work there?

@mgautierfr
Copy link
Author

No warning, but same behavior (blank window)

@probonopd
Copy link
Owner

Thanks for testing. Unfortunately I don't know the cause yet. Can you call your AppImage like this:

LD_DEBUG=libs ./YourApp-1.0.1-x86_64.AppImage

Do you see messages like

error: symbol lookup error: undefined symbol: ... (fatal)

or similar?

@mgautierfr
Copy link
Author

Definitely I have some lookup error :

/tmp/.mount_SampleGmZP0r/usr/libexec/../lib/libQt5WebEngineCore.so.5: error: symbol lookup error: undefined symbol: localtime64 (fatal)
/tmp/.mount_SampleGmZP0r/usr/libexec/../lib/libQt5WebEngineCore.so.5: error: symbol lookup error: undefined symbol: localtime64_r (fatal)
./Sample-0.0.1-x86_64.AppImage: error: symbol lookup error: undefined symbol: nspr_use_zone_allocator (fatal)

Full log is here:
Sample-qtwebengine.log

@mgautierfr
Copy link
Author

@probonopd Do you have a idea of what could be the problem here ?
(apart that localtime64 is missing)

@probonopd
Copy link
Owner

Don't know (yet). More debugging is needed. Unfortunately I don't have the time to dive into this right now.

@mishafuod-13
Copy link

mishafuod-13 commented Oct 20, 2022

@mgautierfr I faced a similar problem, but somehow I managed to overcome it by adding a couple of lines to main ():

qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu --no-sandbox") ; QApplication::setAttribute(Qt::AA_UseOpenGLES);

Errors like the one you posted in this post, in my case, they appeared on different versions of Qt and did not play any role in rendering the web page.

@mishafuod-13
Copy link

mishafuod-13 commented Oct 20, 2022

@mgautierfr I tested the built Appimage (from your project 'sample_qtwebengine') with the options that I specified above on Fedora 35 (built on Ubuntu 18.04) - the render appeared.

@kelson42
Copy link

@mishafuod-13 Seems to be a really valuable input of you. Thank you very much.

@mishafuod-13
Copy link

@kelson42 Glad if I could help :)

@mgautierfr
Copy link
Author

@mishafuod-13 I confirm the workaround. Thanks a lot !

@caralu74
Copy link

caralu74 commented Jan 3, 2023

And for me is working fine. Good job, thanks!

@martinrotter
Copy link

I confirm the workaround to work. Thank you!

@darealshinji
Copy link

darealshinji commented Apr 27, 2023

I have the same issues when I try to bundle notepadqq. The mentioned workaround however doesn't do anything here.
Build system is Ubuntu 20.04, host system is Ubuntu 23.04 (qtwebengine not being installed).

Update: nevermind, after a system reboot it seems to work now.

@SevenBlocks
Copy link

SevenBlocks commented Oct 13, 2023

I have the same issue building on Ubuntu 20.04 with Qt 6.6.0 and the above workaround does not help. The webviewer works when executing the binary with the Qt libs in the LD_LIBRARY_PATH, but it shows a blank screen when running the appimage created by linuxdeployqt, so I suspect linuxdeployqt is not including all the necessary libs. Possibly relevant terminal output:
[1013/095916.194515:FATAL:v8_initializer.cc(516)] Error loading V8 startup snapshot file

SOLVED: linuxdeployqt was not copying .../Qt/6.6.0/gcc_64/resources/v8_context_snapshot.bin. Manually copying over this file solved my problem.

@probonopd
Copy link
Owner

So on Qt6 we need to also deploy resources/v8_context_snapshot.bin whenever WebEngine gets deployed?

@probonopd probonopd changed the title WebEngine display blank window when appimage is run on recent distribution. WebEngine display blank window when appimage is run on recent distribution (fix inside) Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants