简体   繁体   中英

Copied Cocoa Framework searches /Library/Frameworks/… only. How can I make it search binary within itself?

I made a Cocoa Framework with dynamic library. This library contains C functions. I copied the framework into other project, compiled well, but when running it crashes with message like this.

warning: Unable to read symbols for /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics (file not found).
warning: Unable to read symbols from "NewtonGameDynamics" (not yet mapped into memory).
[Switching to process 48902 thread 0x0]
dyld: Library not loaded: /Library/Frameworks/NewtonGameDynamics.framework/Versions/A/NewtonGameDynamics
  Referenced from: /Users/eonil/Library/Developer/Xcode/DerivedData/newton-integration-test-1-ddaxmlnzdnwstkfaiolnkygefbmp/Build/Products/Debug/newton-integration-test-1.app/Contents/MacOS/newton-integration-test-1
  Reason: image not found
(gdb) 

The binary file is in the copied framework directory. Why this happen and how can I avoid this?

This is somewhat complicated than I thought.

Problem is locating binary file in framework. It looks enough with only $(EXECUTABLE_PATH) . But real problem is it should be absolute path.

So basic solution is @executable_path/../Frameworks/$(EXECUTABLE_PATH) . Because this is embedded private framework and the path from running app binary is just that.

INSTALL_PATH = @executable_path/../Frameworks
LD_DYLIB_INSTALL_NAME = @executable_path/../Frameworks/$(EXECUTABLE_PATH)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM