Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-127154

macdeployqt always uses host plugins path even when cross-compiling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • None
    • macOS

    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).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            vserdyuk Vladimir Serdyuk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes