Xcode: hiccups with embedding framework into Mac app

Hi,


I have the following problem - Mac app has embedded framework with app and framework configured as separate targets of the same project. Build settings for app and framework follow this Technote 2435 https://developer.apple.com/library/content/technotes/tn2435

App builds just fine with framework located inside the app bundle. More to that: app runs just fine from Xcode and Finder. The problem is that destributing app to a different user or copying it to another user account which doesn't have access to app's build directory produces this crash


Crashed Thread: 0

Exception Type: EXC_CRASH (SIGABRT)

Exception Codes: 0x0000000000000000, 0x0000000000000000

Exception Note: EXC_CORPSE_NOTIFY

Termination Reason: DYLD, [0x1] Library missing


Application Specific Information:

dyld: launch, loading dependent libraries


Dyld Error Message:

Library not loaded: /Users/USER/*/XYZ.framework/Versions/A/XYZ

Referenced from: /Users/USER/*/Awesome.app/Contents/MacOS/Awesome

Reason: image not found


Examining executable with otool -L shows that execuatble still picks up XYZ framework from Xcode build location. Please help to figure out what went wrong here. Thank you!

Answered by twobyte in 236038022

Hi,


The project has a config file, which was defining an empty LD_DYLIB_INSTALL_NAME and so that was the problem! Instead it should not be set at all or set to $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) as Xcode does it automatically. Cheers!

Accepted Answer

Hi,


The project has a config file, which was defining an empty LD_DYLIB_INSTALL_NAME and so that was the problem! Instead it should not be set at all or set to $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) as Xcode does it automatically. Cheers!

Xcode: hiccups with embedding framework into Mac app
 
 
Q