Re: [PATCH v2] Makefile: link osxkeychain & support universal Rust
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 3, 2026, 05:15 UTC
- Message-ID
- <akdFarZgYhhFehGo@pks.im>
- In-Reply-To
- <CABw8Y3H7P3JKwaSrUGjifcDh7rMR2nCFgqPjw8q6vfZnLc730w@mail.gmail.com>
On Thu, Jul 02, 2026 at 03:30:15PM -0700, Shardul Natu wrote:
Show 25 quoted lines
> > Can we assume lipo to be generally available on macOS? Also, is it
> > sufficient to just do this for the library? I would have expected that
> > binaries would also need some treatment there.
> >
> > In other words: what does it help us to have the Rust treated this way
> > if the rest isn't?
>
> Yes, "lipo" is part of the Apple Xcode CLT, which
> is already a hard prerequisite for invoking clang or make on macOS.
> The reason only Rust needs special treatment in the Makefile is due to
> how the respective toolchains handle multi-architecture builds:
> 1. Apple's C toolchain (clang) natively supports universal builds via
> CFLAGS and LDFLAGS. When "-arch x86_64 -arch arm64" is passed, clang
> automatically compiles and links universal binaries for all C object
> files and executables out of the box.
> 2. Cargo and rustc, however, do not support multiple "-arch" flags or
> emitting universal binaries in a single invocation. Instead, Cargo must
> be invoked separately for each target triple ("--target x86_64-apple-darwin"
> and "--target aarch64-apple-darwin").
>
> By using "lipo" to combine those target-specific Rust static libraries
> into a single universal archive at "target/release/libgitcore.a", we
> bridge this gap. Once $(RUST_LIB) is a universal archive, the standard C
> linker seamlessly links it with the C object files to produce the final
> universal Git executables.Okay, that makes sense. This information should definitely be part of the commit message to give reviewers a bit more context.
Thanks!
Patrick