Following Mac @rpath, @loader_path conventions during deployment
-
I have a library which was built on OS X using Xcode with @rpath as the "Installation Directory" and I want to mimic the general @rpath behavior by making use of @loaderpath/../Frameworks on the executable built with Qt Creator which uses this library, similar to how you would with the Xcode "Runpath Search Paths" settings.
However, I haven't found a way to successfully do this. I've tried setting QMAKE_RPATHDIR in the .pro file in my project, using several different values, but that doesn't seem to work with qmake. I've read the link below, but it doesn't appear a solution was created:
"Frameworks should use @rpath":https://bugreports.qt-project.org/browse/QTBUG-31814?focusedCommentId=206432&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-206432
I have several other libraries/dylib files linked to my application and deploying successfully when using the "macdeployqt" function primarily because these are @executable_path based libraries.
Is there a way to use @rpath for OS X deployed QT applications?
-
Hi,
From the top of my head I would say that you'd have to use install_name_tool yourself to modify the paths the way you want them to be.
-
Thank you for the reply. I came to the same conclusion. I ended up using the following in order to override the @rpath settings in the library I am linking to:
*install_name_tool -id @executable_path/../Frameworks/libA.dylib "Application.app"/Contents/Frameworks/libA.dylib
install_name_tool -change @rpath/libA.dylib @executable_path/../Frameworks/libA.dylib "Application.app/Contents/MacOS/Application"*
-
Nothing like a bash script to automate the process :)