Building using CMake - crash on start due to problem loading QtQuick Controls [macOS]
I cloned MuseScore (3.x branch tip) and compiled it using CMake on macOS, and then ran cmake --install as in the instructions. When I try to launch the app, it shows the splash screen and then crashes during the 'Initializing main window' stage. I found that the crash is due to loading libqtquickcontrols2plugin twice.
If I go into the generated mscore.app in the install dir, and rename Contents/Resources/QtQuick/Controls.2/libqtquickcontrols2plugin.dylib to libqtquickcontrols2plugin.dylib.orig, then the crash doesn't occur anymore.
Is this a known problem? Did I do something wrong?
When I run the executable using debugging variables:
QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 mscore.app/Contents/MacOS/mscore
I can see that it successfully loads libqtquickcontrols2plugin.dylib from Resources/qml (since it is imported from PalettesWidget.qml) and after that it tries to load libqtquickcontrols2plugin.dylib from my global Qt installation:
/usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.dylib, at which point it crashes.
unknown:unknown: QQmlImports(qrc:/qml/palettes/PalettesWidget.qml)::importExtension: loaded "/Users/matan/code/MuseScore/cmake-install-debug/mscore.app/Contents/Resources/qml/QtQuick.2/qmldir" unknown:unknown: loaded library "/Users/matan/code/MuseScore/cmake-install-debug/mscore.app/Contents/Resources/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.dylib" [...] unknown:unknown: loaded library "/usr/local/Cellar/qt/5.15.1/qml/QtQuick/Controls.2/libqtquickcontrols2plugin.dylib"  21371 segmentation fault QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 mscore.app/Contents/MacOS/mscore
For now my workaround is sufficient but are there any tips how to solve it properly?