Pablo Fernandez
Pablo Fernandez

Reputation: 287740

Why is this library not found on Mac OS X?

I'm making a small proof of concept of using CEF on MacOSX. I took the Chromium Embedded Framework.framework and changed it's rpath by running:

install_name_tool -id "@rpath/Chromium Embedded Framework.framework/Chromium Embedded Framework" Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework

and then compiled and run the program like this:

$ ./cefobjchelper.app/Contents/MacOS/cefobjchelper
dyld: Library not loaded: @executable_path/Chromium Embedded Framework
  Referenced from: /Users/pupeno/Library/Developer/Xcode/DerivedData/cefobjc-bxtruyemnyagwwgdejtzuxngovsr/Build/Products/Debug/./cefobjchelper.app/Contents/MacOS/cefobjchelper
  Reason: image not found
Trace/BPT trap: 5

I understand that @executable_path/Chromium Embedded Framework doesn't really exist, but why is it even looking for it when I corrected the path in the CEF?

Just to be sure I checked that the CEF included in the bundle had the correct path and it did:

$ otool -D cefobjchelper.app/Contents/Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework
cefobjchelper.app/Contents/Frameworks/Chromium Embedded Framework.framework/Chromium Embedded Framework:
@rpath/Chromium Embedded Framework.framework/Chromium Embedded Framework

What am I missing here?

Upvotes: 1

Views: 1685

Answers (1)

Pablo Fernandez
Pablo Fernandez

Reputation: 287740

The reason was that there was an extra framework path from a previous experimentation with another copy of the library somewhere else on my home directory and removing that library from the list of linked libraries didn't remove the the path, so re adding it from the new location, was picking it up, for linking but not embedding, from the old location.

Upvotes: 2

Related Questions