Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved macqtdeploy.... cmake... ARM/M1 to intel... oh dear...

    General and Desktop
    arm mac crosscompile cmake
    4
    8
    454
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dariusz last edited by

      Hey

      Ok So I'm trying to solve 2 problems here.

      1. Compile on ARM and hope that Intel can run my binary.
      2. Pack it up and send to my friend.

      So I've recently read that latest macos Monterey is automatically compiling universal binaries and it should work on any other 12.0+ mac. But when I send file to my friend he cant execute it.

      As to packing it up, the packer "worked" but I cant run the app after he packed it... I get a bit of a crazy log with lots of :

      Toolbox.app/Contents/Frameworks/QtSvg.framework/Versions/A/QtSvg (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtSvg.framework/Versions/A/QtSvg (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtWidgets.framework/Versions/A/QtWidgets (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtGui.framework/Versions/A/QtGui (architecture arm64):"
      ERROR: Could not parse otool output line: "/Users/dariusz/Qt/6.2.2/macos/lib/QtCore.framework/Versions/A/QtCore (architecture arm64):"
      

      When I inspect the app, it appears to have worked, the bundle has data and files and exe is relinked, but it somehow give me error when I run it

      "toolbox.app quit unexpectedly. click to report bla bla bla"

      Crashed Thread:        0
      
      Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
      Exception Codes:       UNKNOWN_0x32 at 0x0000000102e58000
      Exception Codes:       0x0000000000000032, 0x0000000102e58000
      Exception Note:        EXC_CORPSE_NOTIFY
      
      Termination Reason:    Namespace CODESIGNING, Code 2 
      
      VM Region Info: 0x102e58000 is in 0x102e58000-0x102ee0000;  bytes after start: 0  bytes before end: 557055
            REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
            dyld private memory         102d58000-102e58000    [ 1024K] rw-/rwx SM=PRV  
      --->  mapped file                 102e58000-102ee0000    [  544K] r--/rwx SM=COW  ...t_id=3fecca81
            GAP OF 0x234000 BYTES
            __TEXT                      103114000-103174000    [  384K] r-x/r-x SM=COW  /usr/lib/dyld
      
      Thread 0 Crashed:
      0   dyld                          	       0x10314a504 dyld3::MachOFile::compatibleSlice(Diagnostics&, void const*, unsigned long, char const*, dyld3::Platform, bool, dyld3::GradedArchs const&) + 76
      1   dyld                          	       0x10312e95c invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 96
      2   dyld                          	       0x10312e95c invocation function for block in dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 96
      3   dyld                          	       0x103133d58 dyld4::SyscallDelegate::withReadOnlyMappedFile(Diagnostics&, char const*, bool, void (void const*, unsigned long, bool, dyld4::FileID const&, char const*) block_pointer) const + 132
      4   dyld                          	       0x10312e8c8 dyld4::JustInTimeLoader::makeJustInTimeLoaderDisk(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, bool, unsigned int) + 204
      5   dyld                          	       0x1031286d0 invocation function for block in dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 1384
      6   dyld                          	       0x103127bc0 dyld4::Loader::forEachResolvedAtPathVar(dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, dyld4::ProcessConfig::PathOverrides::Type, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 780
      7   dyld                          	       0x1031277ec invocation function for block in dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 148
      8   dyld                          	       0x10311dee4 dyld4::ProcessConfig::PathOverrides::forEachPathVariant(char const*, dyld3::Platform, bool, bool&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) const + 672
      9   dyld                          	       0x103127740 dyld4::Loader::forEachPath(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&, void (char const*, dyld4::ProcessConfig::PathOverrides::Type, bool&) block_pointer) + 172
      10  dyld                          	       0x103127f60 dyld4::Loader::getLoader(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::LoadOptions const&) + 864
      11  dyld                          	       0x10312cb60 invocation function for block in dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) + 380
      12  dyld                          	       0x103149264 invocation function for block in dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const + 148
      13  dyld                          	       0x103115f98 dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const + 168
      14  dyld                          	       0x1031490ac dyld3::MachOFile::forEachDependentDylib(void (char const*, bool, bool, bool, unsigned int, unsigned int, bool&) block_pointer) const + 172
      15  dyld                          	       0x10312c8c8 dyld4::JustInTimeLoader::loadDependents(Diagnostics&, dyld4::RuntimeState&, dyld4::Loader::LoadOptions const&) + 164
      16  dyld                          	       0x1031195c0 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 1092
      17  dyld                          	       0x10311906c start + 488
      

      Does any of this means to any1 ?

      I'm lost.

      D 1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Can you explain the steps you took to build your .dmg ?
        One thing is not completely clear, does it also happen on your own machine ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply Reply Quote 0
        • D
          DerReisende @Dariusz last edited by

          @Dariusz you can ignore the otool messages if I remember correctly. There has been a bug report on Qt for this and it is basically the script doesn't parse all output of arm64 otool correctly.

          1 Reply Last reply Reply Quote 0
          • D
            Dariusz @SGaist last edited by

            Hey @SGaist
            I've finally found the willpower to fight with mac again... lots of good fixes with the intel&arm build on my end but sadly still issue with QT...
            Here is my cmake...>

            cmake_minimum_required(VERSION 3.22)
            project(02_qt6Deploy)
            
            set(CMAKE_CXX_STANDARD 20)
            set(CMAKE_AUTOMOC ON)
            set(CMAKE_AUTORCC ON)
            set(CMAKE_AUTOUIC ON)
            set(CMAKE_INCLUDE_CURRENT_DIR ON)
            
            set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "" FORCE)
            
            set(QT_PATH  /Users/dariusz/Qt/6.3.0/macos/)
            
            set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_PATH} )
            
            find_package(Qt6 COMPONENTS
                    Core
                    Gui
                    Widgets
                    REQUIRED)
            
            add_executable(02_qt6Deploy MACOSX_BUNDLE main.cpp)
            target_link_libraries(02_qt6Deploy
                    Qt::Core
                    Qt::Gui
                    Qt::Widgets
                    )
            
            add_custom_target(deployRuntimeMac
                    ALL
                    COMMAND
                    ${QT_PATH}/bin/macdeployqt ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.app
                    )
            

            Here is my error :

            ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: \"-delete_rpath /Users/dariusz/Qt/6.3.0/macos/lib\" specified more than once\nUsage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool [-change old new] ... [-rpath old new] ... [-add_rpath new] ... [-delete_rpath old] ... [-id name] input\n"
            ERROR: ""
            

            The app works, if I do NOT pass set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE INTERNAL "" FORCE)
            Looks like macdeployqt does not know how to handle universal libraries/binaries with combined platforms?

            KATO2 1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              If memory serves well there was a thread recently on the development mailing about something similar. You might want to check it.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              D 1 Reply Last reply Reply Quote 0
              • D
                Dariusz @SGaist last edited by

                @SGaist Any idea where/how to find it? I've never been there before : O

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  The mailing list is here.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply Reply Quote 1
                  • KATO2
                    KATO2 @Dariusz last edited by

                    @Dariusz I'm experiencing this same issue on Mac M2 with Qt 6.4.2, however the same code build on Mac Intel works fine and I don't have that ugly output.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post