Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.2
-
None
Description
On host x64 macOS install dynamic arm64 Qt from vcpkg:
vcpkg install qtbase:arm64-osx-dynamic
Building application works fine:
cmake -G "Ninja" -B out/build/arm64-osx-release -S . -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET=arm64-osx-dynamic -DCMAKE_OSX_ARCHITECTURES=arm64
cd out/build/arm64-osx-release
cmake --build .
But after I run macdeployqt, inside application bundle there is an x64 libqcocoa.dylib plugin:
file out/build/arm64-osx-release/myapp/myapp.app/Contents/PlugIns/platforms/libqcocoa.dylib
Gives me
libqcocoa.dylib: Mach-O 64-bit bundle x86_64
When running app, I get the following error:
qt.core.plugin.loader: Failed to find metadata in lib <path_to_build>/myapp.app/Contents/PlugIns/platforms/libqcocoa.dylib: '<path_to_build>/myapp.app/Contents/PlugIns/platforms/libqcocoa.dylib' is not a valid Mach-O binary (wrong architecture)
I think, this is because macdeployqt always uses host QLibraryInfo::PluginsPath and unfortunately there's no workaround (such as --qtpaths argument in windeployqt that helps to deploy correct debug binaries when using vcpkg).