This world be great content for the wiki

Hi Nate,
This would be great content for the racket wiki
https://github.com/racket/racket/wiki

You can post it yourself or I am happy to do it for you.
https://github.com/racket/racket/wiki/_new

Kind regards,
Stephen

On Wed, 24 Jun 2020 at 17:54, Nate Griswold <[email protected]> wrote:

> 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.
>
> Note the documentation says (
> https://docs.racket-lang.org/inside/cs-embedding.html)
>
> "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 for a proper framework structure, the framework should have an
> Info.plist in Resources and a Versions/Current symlink. Top-level symlinks
> directly in Racket.framework should reference only Versions/Current and
> both Resources and the binary library (Racket) should be referenced. (see
> https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
> )
>
> 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
>
> Nate
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAM-xLPpC3Ona-zbV6r43dD_xjSmXa_eGGRLfFERuQ_tBgG%3D4HQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/racket-users/CAM-xLPpC3Ona-zbV6r43dD_xjSmXa_eGGRLfFERuQ_tBgG%3D4HQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
-- 
----

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAGHj7-%2Bv3nM%3D2X1V7YGrbToAi79GeAAE5cisN0KziLgrRjX9Ew%40mail.gmail.com.

Reply via email to