wasm: don't call dlopen() on static builds

Make QLibraryPrivate::load_sys() return false on static
wasm builds.

Emscripten does not support dlopen() in this configuration;
calling it will abort the program. By returning false
we give QLibrary users an opportunity to handle the
error.

Task-number: QTBUG-109076
Change-Id: I32d1fde04cc54d1622e0743712b6372b023aa006
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 490c4558f79ff4ca95a1ff1ccbe5a3d956786e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2023-02-13 14:17:55 +01:00 committed by Qt Cherry-pick Bot
parent e59faa2798
commit 561b48c76b

View File

@ -90,6 +90,11 @@ QStringList QLibraryPrivate::prefixes_sys()
bool QLibraryPrivate::load_sys()
{
#if defined(Q_OS_WASM) && defined(QT_STATIC)
// emscripten does not support dlopen when using static linking
return false;
#endif
QMutexLocker locker(&mutex);
QString attempt;
QFileSystemEntry fsEntry(fileName);