Skip to content

Latest commit

 

History

History
123 lines (92 loc) · 3.65 KB

File metadata and controls

123 lines (92 loc) · 3.65 KB

macOS Cross Build

Source note: https://stackoverflow.com/a/76183280/9363996

Goal: cross-build the omnirefl tool for macOS from the Alpine build image.

Findings

  • Existing osxcross images are available on Docker Hub.

    • liushuyu/osxcross:latest was inspected.
    • It contains /opt/osxcross/SDK/MacOSX10.14.sdk.
    • It contains o64-clang, x86_64-apple-darwin18-*, ld64, lipo, install_name_tool, and related cctools.
    • It is old: created in 2020, Clang 10, Darwin18/x86_64 oriented.
    • It bundles an Apple SDK, so it has the same SDK redistribution concern.
    • Treat as a reference/probe image, not a release base.
  • Darling has an SDK-like open-source tree.

    • Repo: https://github.com/darlinghq/darling
    • Path: Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
    • C/POSIX headers are present.
    • libSystem.dylib is a symlink into Darling build output.
    • No .tbd stubs were found in the repo tree.
    • Not a drop-in SDK for release binaries, but useful for research.
  • Apple open-source Darwin components are not a complete macOS SDK.

Required Inputs

  • Apple SDK/sysroot
    • MacOSX.sdk extracted from Xcode.
    • Not an Alpine package; must be imported from a Mac/Xcode install.

Tools

LLVM Changes

  • Add AArch64 to LLVM_TARGETS_TO_BUILD for Apple Silicon.
  • Consider adding lld to LLVM_ENABLE_PROJECTS.
    • May not be required if using cctools ld64.

Current Alpine image builds LLVM with LLVM_TARGETS_TO_BUILD=X86 only.

Alpine Build Dependencies

Likely needed to build the missing tools:

  • bash
  • autoconf
  • automake
  • libtool
  • pkgconf
  • zlib-dev
  • openssl-dev
  • libxml2-dev
  • musl-fts-dev or equivalent

musl-fts matters because cctools-port documents musl-libc systems as needing it.