nik4emniy
nik4emniy

Reputation: 143

How to make Qt Creator add CEF framework to DEST_DIR on Mac OS X?

I'm working on a collaborative project in Qt Creator, and I've managed to get it to compile: I linked CEF Framework and the CEF dll wrapper. However, when I try to run it I get:

dyld: Library not loaded: @executable_path/Chromium Embedded Framework
Reason: image not found

As far as my understanding goes, the framework needs to be copied into my DEST_DIR, into .app/Contents/MacOS or something like that. I have NOT managed to make it work even by copying the framework there manually. Also, since the development is meant to be cross platform, I was wondering if there's a way to tell qmake how to copy the framework to my DEST_DIR. Any help in understanding how to deal with frameworks on Mac OS X in Qt Creator would be greatly appreciated.

Upvotes: 0

Views: 945

Answers (1)

TheDarkKnight
TheDarkKnight

Reputation: 27621

As far as my understanding goes, the framework needs to be copied into my DEST_DIR, into .app/Contents/MacOS or something like that.

You're nearly there. Frameworks are generally copied into

.app/Contents/Frameworks

However, your bundle's executable contains a reference to where it expects those framework libraries are residing and having copied them into the app bundle, you need to tell the executable where they are.

Using oTool with -L argument, you can see the libraries referenced by the executable. You'd call it with the full path. For example

otool -L /Applications/Calculator.app/Contents/MacOS/Calculator

For each dylib in the framework, you need to fix up the path using the command line tool install_name_tool

When deploying a Qt application for Qt, we must run the macdeployqt. This essentially does the same thing for the Qt Frameworks; copies them into the relevant Frameworks folder and updates the paths.

I've not used it myself, but according to the documentation, macdeployqt supports handling 3rd party frameworks, with the option -executable=< path >

Upvotes: 1

Related Questions