-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Build universal binaries for MacOS #3317
Comments
I would venture the guess that Apple prefers universal binaries not just because of Intel and Arm architectures, but also because of the subtle and sometimes massive differences between their M-series architectures. Nevertheless, this is a great topic and thankyou for filing the issue. I almost feel like we need insight from the |
(Obligatory thisisfine.gif) Can you provide some more context? |
@betamos how to mention this using .toml or config file? |
Not sure what you mean by "mention". To my knowledge you can only manually set the target with the |
Describe the problem
By default, binaries are built for a single CPU architecture, either x86_64 or aarch64. MacOS supports Universal Binaries. that allow a single binary (and hence package & dmg) which contains both. This is recommended by Apple because it simplifies application distribution.
Describe the solution you'd like
I'd like to be able to build a universal dmg that can be distributed to any MacOS user, directly from
tauri build
.I suggest adding a pseudo-target
universal-darwin-macos
for this purpose, which invokes thelipo
command to combine two arch-specific binaries into a universal one. I've tried it out and it works for me.Given such a feature, we also need a way to deal with external binaries:
Alternatives considered
Use an external build script
A custom build script would work, but it would require quite a bit of redundant and custom tooling. This is because the
lipo
invocation needs to happen betweencargo build
and dmg packaging.Use cargo [blocked]
Cargo does not support universal binaries at this time.
Use cargo-lipo
cargo-lipo
is a tool that useslipo
under the hood. Not investigated.Use a Rust-lib instead of lipo
lipo
is included in MacOS (perhaps with XCode?) but it may be harder to access it from Windows or Linux for cross-platform building. If that's hard to get lipo working, it may be worth looking into using a rust lib that does the same thing, to avoid external dependencies.Additional context
It's an open question what exactly universal binaries mean for build systems. Should it be part of the arch triple (
universal-darwin-macos
) or should it be considered separate platform-specific config? I haven't seen best practices on this yet, feedback welcome.The text was updated successfully, but these errors were encountered: