Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Plugins, deployment & Qt on a Mac

Explorer ,
Jun 11, 2012 Jun 11, 2012

I have a plug-in that links to the Qt framework (QtCore.framework and QtGui.framework) on Mac OS X 10.6.8 - XCode 3.2.6

So I'm trying to deploy the plug-in onto a mac that doesn't already have the Qt framework installed, but with no success so far. This is what I've done:

Added a Copy Files Build Phase to copy QtCore.framework & QtGui.framework to my plug-in bundle's Frameworks folder.

Added a "Run Script Phase" to alter the install names of the frameworks which looks like this:

install_name_tool -id @positive_Wish16B8_path/../Frameworks/QtCore.framework/Versions/4/QtCore ${BUILD_DIR}"/"${WRAPPER_NAME}/Contents/Frameworks/QtCore.framework/Versions/4/QtCore

install_name_tool -id @positive_Wish16B8_path/../Frameworks/QtGui.framework/Versions/4/QtGui ${BUILD_DIR}"/"${WRAPPER_NAME}/Contents/Frameworks/QtGui.framework/Versions/4/QtGui

install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore @positive_Wish16B8_path/../Frameworks/QtCore.framework/Versions/4/QtCore ${BUILD_DIR}"/"${WRAPPER_NAME}/Contents/MacOS/QtDeploymentTest

install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtGui.framework/Versions/4/QtGui@loader_path/../Frameworks/QtGui.framework/Version/4/QtGui ${BUILD_DIR}"/"${WRAPPER_NAME}/Contents/MacOS/QtDeploymentTest

install_name_tool -change /usr/local/Trolltech/Qt-4.7.4/lib/QtCore.framework/Versions/4/QtCore @positive_Wish16B8_path/../Frameworks/QtCore.framework/Versions/4/QtCore ${BUILD_DIR}"/"${WRAPPER_NAME}/Contents/Frameworks/QtGui.framework/Versions/4/QtGui

But when Illustrator attempts to load the plug-in on the target mac, I'm getting this error:

Error loading /Applications/Adobe Illustrator CS5.1/Plug-ins.localized/QtDeploymentTest.aip/Contents/MacOS/QtDeploymentTest:  dlopen(/Applications/Adobe Illustrator CS5.1/Plug-ins.localized/QtDeploymentTest.aip/Contents/MacOS/QtDeploymentTest, 262): Library not loaded: @positive_Wish16B8_path/../Frameworks/QtCore.framework/QtCore

  Referenced from: /Applications/Adobe Illustrator CS5.1/Plug-ins.localized/QtDeploymentTest.aip/Contents/MacOS/../Frameworks/QtGui.framework/QtGui

  Reason: image not found

Any ideas anyone? I was under the understanding that @positive_Wish16B8_path should be the path to my plug-in's executable but ld still fails to load it.

TOPICS
SDK
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jun 11, 2012 Jun 11, 2012

The problem appears to be QtGui trying to load QtCore, in this case QtGui will need a path to QtCore more along the lines of:

@loader_path/../../../QtCore.framework/Versions/4/QtCore

double check my '..' count

AFAIK, the @loader_path is set to QtGui once that is being loaded.

You could also look at using rpath, there might be less figuring out what the relative paths are from each dylib to the next.

Translate
Adobe
Explorer ,
Jun 11, 2012 Jun 11, 2012

The problem appears to be QtGui trying to load QtCore, in this case QtGui will need a path to QtCore more along the lines of:

@loader_path/../../../QtCore.framework/Versions/4/QtCore

double check my '..' count

AFAIK, the @loader_path is set to QtGui once that is being loaded.

You could also look at using rpath, there might be less figuring out what the relative paths are from each dylib to the next.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 11, 2012 Jun 11, 2012

Garvan, you are a legend, thank you!

AFAIK, the @loader_path is set to QtGui once that is being loaded.

^ This was the vital piece of info I've been missing. I knew that QtGui loaded QtCore but I wasn't aware that @loader_path was reset once a library had been loaded.

I wasn't aware of @rpath until I read an article today stating that it should be used in favour of @loader_path, I'll be looking into that next!

FYI, your '..' count was spot on

Much appreciated as always, thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 12, 2012 Jun 12, 2012
LATEST

No prob, happy to help anyone brave enough to use Qt with AI

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines