Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Building on OSX Catalina and deploying on Monterey with dynamic libs

Building on OSX Catalina and deploying on Monterey with dynamic libs

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
macdeployqtmacosdeploydynamic
2 Posts 1 Posters 512 Views
  • 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.
  • Y Offline
    Y Offline
    Yergin
    wrote on last edited by Yergin
    #1

    Hi community,

    I'm building a minimal Qt6.4 app on Catalina and using macdeployqt to deploy a bundle. While the app runs perfectly well on another computer running Catalina without Qt installed, when I open the app on a system running Monterey, I get the error: "The application 'Template' can't be opened".

    Here are the details:

    Tested on: OSX 12.6

    Built on: OSX 10.15.4
    Xcode version: 12.4
    OSX SDK version: 11.1
    Qt version: 6.4.0

    src/main.cpp:

    #include <QtWidgets>
    
    int main(int argc, char **argv)
    {
        QApplication app(argc, argv);
        QMainWindow mainWindow;
        mainWindow.show();
        return app.exec();
    }
    

    Template.pro:

    QT += widgets
    CONFIG += c++17
    SOURCES += src/main.cpp
    

    I first build a release version in QtCreator and then I run:

    ~/Qt/6.4.0/macos/bin/macdeployqt Template.app

    which I can see has put Qt's frameworks in the bundle.

    Running otool -L Template.app/Contents/MacOS/Template gives me:

    Template.app/Contents/MacOS/Template:
    	@rpath/QtWidgets.framework/Versions/A/QtWidgets (compatibility version 6.0.0, current version 6.4.0)
    	@rpath/QtGui.framework/Versions/A/QtGui (compatibility version 6.0.0, current version 6.4.0)
    	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2022.20.117)
    	/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
    	/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 244.32.7)
    	@rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.4.0)
    	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
    	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
    	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
    

    What am I missing? Has anyone had any success building on Catalina and running on Monterey?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      Yergin
      wrote on last edited by
      #2

      I've managed to deploy a test app from Monterey which works on Catalina and Monterey and given up on building on Catalina after spending a few days trying to fix the result of macdeployqt using otool and install_name_tool.

      It seems that the CMake qt_generate_deploy_app_script method doesn't work when run from Monterey either. Running the macdeployqt utility almost works out of the box, it just leaves the plugins' RPATH pointing to a nonexistent 'lib' folder where it expects Qt frameworks to be. Rather than fix the RPATH's in each of those plugin libs, adding a 'lib' symlink pointing to the Frameworks folder seems to do the trick.

      In case it's useful to anyone, I've made a template repository on GitHub with this solution. The template allows you to deploy apps with LGPL Qt on Mac and Windows and use VSCode as an IDE rather than QtCreator:

      https://github.com/yergin/qt-cmake-vscode

      1 Reply Last reply
      0

      • Login

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