OSX: changing the .framework path

Links to Mac OS applications with a non-system Foo.framework file system. I added a link to the framework in Xcode, and the application builds fine. I also have a rule that copies the structure to the Frameworks output folder (MyApp.app/Contents/Frameworks). However, at run time, the binary searches for the structure in ~ / Library / Framework, and the application does not load.

otool -l MyApp.app also tells me that it is looking for a structure in / Users // Library / Frameworks.

Can someone explain why this is happening, and what is the right way to make the application look in the Frameworks folder of the application package?

My hacky workaround is to include a custom script to change the path in the mach-o binary using install_name_tool, but I'm sure there is a clean way to do this.

+5
source share
1 answer

You are on the right track.

This is because OS X "install_name"writes to the library when it is created. This sort_name is then copied to any application that references it.

The "best" way to solve the problem is to change the source of the framework so that the layout flag is install_nameset when creating the framework.

, , , autoconf, . install_name_tool -id, install_name .

, , ?

@executable_path/../Frameworks/Foo.framework/Foo ( )

, , Foo.framework:

install_name_tool -id @executable_path/../Frameworks/Foo.framework/Foo Foo.framework/Foo

@executable_path . , Copy Files Framework .

install_name_tool -change, _ , , . .

+7

All Articles