Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Deploying on macos failed.
Forum Updated to NodeBB v4.3 + New Features

Deploying on macos failed.

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 632 Views 1 Watching
  • 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.
  • N Offline
    N Offline
    niconnnn
    wrote on last edited by
    #1

    I recently made a cross-platform tool that uses qt for the gui. I build the executable with cmake.
    The CMakeFiles.txt looks like this:

    FIND_PACKAGE(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
    FILE(GLOB_RECURSE SOURCES "src/*.h" "src/*.cpp")
    FILE(GLOB_RECURSE QRC_SOURCE_FILES "res/*.qrc")
    qt_add_resources(RESOURCE_FILES ${QRC_SOURCE_FILES})
    
    ADD_EXECUTABLE(myapp ${RESOURCE_FILES} ${SOURCES} ${3RDPARTY_SOURCE})
    SET_PROPERTY(TARGET myapp PROPERTY MACOSX_BUNDLE true)
    
    TARGET_LINK_LIBRARIES(myapp PRIVATE
                          Qt6::Core
                          Qt6::Gui
                          Qt6::Widgets)
    

    After the cmake build was successful, I installed myapp.app into the install/bin directory, and I want to package my application for deployment with the command macdeployqt myapp.app
    But it prints a lot of error messages and myapp.app doesn't run:

    ERROR: Cannot resolve rpath "@rpath/QtGui.framework/Versions/A/QtGui"
    ERROR:  using QList("/Users/root/Documents/myapp/build/install/bin/lib")
    ERROR: Cannot resolve rpath "@rpath/QtCore.framework/Versions/A/QtCore"
    ERROR:  using QList("/Users/root/Documents/myapp/build/install/bin/lib")
    

    When I add the -verbose=3 parameter, all errors look like this

    I think the problem is from @rpath

    Log:  copied: "/opt/homebrew/share/qt/plugins/imageformats/libqmacheif.dylib"
    Log:  to "install/bin/myapp.app/Contents/PlugIns/imageformats/libqmacheif.dylib"
    Log: Using strip:
    Log:  stripped "install/bin/myapp.app/Contents/PlugIns/imageformats/libqmacheif.dylib"
    Log: Using otool:
    Log:  inspecting "install/bin/myapp.app/Contents/PlugIns/imageformats/libqmacheif.dylib"
    ERROR: Cannot resolve rpath "@rpath/QtGui.framework/Versions/A/QtGui"
    ERROR:  using QList("/Users/ctvit/Documents/yang/myapp/build/install/bin/lib")
    ERROR: Cannot resolve rpath "@rpath/QtCore.framework/Versions/A/QtCore"
    ERROR:  using QList("/Users/ctvit/Documents/yang/myapp/build/install/bin/lib")
    

    How do I successfully package my app, any suggestions?

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      You are creating a bundle. Just cd into the target folder containing your .app as it was compiled (or move said .app to an empty location) and run macdeployqt.
      I usually write a small deploy script for a final product, with code signing and everything but that all comes later. Absolute minimum that would make your bundle working:
      cd into the target where your .app is compiled
      macdeployqt with any optional parameters you might want.

      Please note that if you use any 3rd party libraries macdeployqt will not know about them. You should manually (or via script) include them yourself in appropriate location.

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved