Qt World Summit: Submit your Presentation

macdeployqt - Missing dependancies when installing.

  • I created an application which runs in Qt creator.
    Using macdeployqt to make an installer; once installed on another Mac, I get the following error trying to execute the application :

    Library not loaded: @rpath/QtWidgets.framework/Versions/5/QtWidgets

    I really need to deploy this asap.

    Thank you.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt ?
    On what version of macOS ?
    What parameters did you pass to macdeployqt ?

  • I am using Qt v5.8 on OS X 10.11.6.

    I simply used :

    macdeployqt mytest.app -dmg

    from the release directory.

    Thank you.

  • This post is deleted!

  • Lifetime Qt Champion

    Might be a silly question but do you have several version of Qt installed ? If so, which version of macdeployqt are you using ?

  • @SGaist No, I only have v5.8 and the macdeployqt that came with it.

    Thank you.

  • Lifetime Qt Champion

    Can you share your .pro file ?

  • #-------------------------------------------------

    Project created by QtCreator 2017-01-30T13:13:14


    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = ImagoTN1
    TEMPLATE = app


    DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui



    macx: LIBS += -L$$PWD/lib/ -lfreeimage -lippcc -lippch -lippcore -lippcv -lippdc -lippi -lipps -limfilters

    INCLUDEPATH += $$PWD/include
    DEPENDPATH += $$PWD/include

    macx: PRE_TARGETDEPS += $$PWD/lib/libfreeimage.a $$PWD/lib/libippcc.a $$PWD/lib/libippch.a $$PWD/lib/libippcore.a
    $$PWD/lib/libippcv.a $$PWD/lib/libippdc.a $$PWD/lib/libippi.a $$PWD/lib/libipps.a
    $$PWD/lib/libippvm.a $$PWD/lib/libimfilters.a

  • Lifetime Qt Champion

    Can you show the result of otool -L on your application ?

    What does the Frameworks folder contain ?

    Also, what parameters are you passing to macdeployqt ?

  • i had a similar problem,
    in my case the deps were succesfully deployed to the qt but the application still could not find them,
    (they should be in myapp.app/Contents/Frameworks)

    if your issue is similar, you could try
    compiling with this flag, which will create an rpath to the frameworks folder

    QMAKE_LFLAGS += -Wl,-rpath,@executable_path/../Frameworks

    or to fix current version without recompile you could try editing current rpath

    install_name_tool -add_rpath "@executable_path/../Frameworks" myapp.app/Contents/MacOS/myapp

  • @chips-and-fish Thank you so much ! That fixed it.
    Although I am a bit surprised as the path to Framework is an artifact of macdeployqt; one would think it would automatically add it...

Log in to reply