Hello
I recently went through the process of embedding the Racket.framework in Xcode, and i just wanted to share the steps in case anyone else would like to do this.
"On Mac OS, besides
"libracketcs.a" for static
linking, a dynamic library is provided by the
"Racket"
framework, which is typically installed in
"lib"
sub-directory of the installation. Supply
-framework Racket
to
gcc when linking, along with
-F and a path to the
"lib" directory. At run time, either
"Racket.framework" must be moved to a location in the
standard framework search path, or your embedding executable must
provide a specific path to the framework (possibly an
executable-relative path using the Mach-O
@executable_path
prefix)."
That sets the rpath search paths but the library binary still needs to reference @rpath to make use of these search paths. Below we use install_name_tool to fix up the binary to reference the @rpath directly.
Note also that Xcode is hard coded to codesign in the Versions/A subdirectory and hasn't added any support for signing other major versions, so i link version A in the below steps. This step is only necessary if you wish to sign the framework on copy.
Note also i did all of this with racket cs, you would have to modify the steps if you were using normal racket.
All that said, here are the steps:
Drag the framework into xcode
select copy if needed, ok
Click on project, General tab, "Frameworks, Libraries, and Embeddeed Content"
Change do not embed to either embed or embed and sign
cd to your copied framework in your project
cd Versions
ln -s 7.7_CS Current
if "embed and sign" was chosen:
ln -s 7.7_CS A (xcode is hard coded to sign the major version A, see
https://developer.apple.com/forums/thread/65963)
cp /path/to/Info.plist 7.7_CS/Resources
cd ..
rm -f Racket
ln -s Versions/Current/Racket
ln -s Versions/Current/Resources
install_name_tool -id @rpath/Racket.framework/Versions/7.7_CS/Racket ./Racket
otool -L Racket (to verify)
Switch to Xcode, build and run