[bug] failing to build universal app on x86 mac
Describe the bug
I can't build universal tauri app on old x86 mac-mini. I have read the docs and as far as I can tell this scenario should be possible https://tauri.app/v1/guides/building/macos/#binary-targets
Reproduction
Here is a reproduction repository https://github.com/rzaitov/tauri-universal-app-issue-on-x86
On my x86 mac-mini I installed aarch64 target:
$ rustup target add aarch64-apple-darwin
$ rustup target list
aarch64-apple-darwin (installed)
aarch64-apple-ios (installed)
...
x86_64-apple-darwin (installed)
x86_64-apple-ios (installed)
...
Then I created a simple "hello-world" by following guides/getting-started/setup/html-css-js/
After that I started the build
$ cargo tauri build --target universal-apple-darwin
...
error: failed to run custom build command for `objc_exception v0.1.2`
Caused by:
process didn't exit successfully: `/Users/rzaitov/Documents/apps/tauri-get-started/src-tauri/target/release/build/objc_exception-54ac1f6158817a76/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("aarch64-apple-darwin")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
CC_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
CC_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
CFLAGS_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
CFLAGS_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: env -u IPHONEOS_DEPLOYMENT_TARGET "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/rzaitov/Documents/apps/tauri-get-started/src-tauri/target/aarch64-apple-darwin/release/build/objc_exception-928c06e83c3d6b01/out/extern/exception.o" "-c" "extern/exception.m"
cargo:warning=In file included from extern/exception.m:1:
...
Here is a full log gist.github
Expected behavior
I expect to get *.app and *.dmg after successful build. The command which I have run should complete without errors.
Full tauri info output
$ cargo tauri info
WARNING: no lock files found, defaulting to npm
[✔] Environment
- OS: Mac OS 10.15.7 X64
✔ Xcode Command Line Tools: installed
✔ rustc: 1.75.0 (82e1608df 2023-12-21)
✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-x86_64-apple-darwin (environment override by RUSTUP_TOOLCHAIN)
- node: 14.19.3
- npm: 6.14.17
[-] Packages
- tauri [RUST]: 1.5.4
- tauri-build [RUST]: 1.5.1
- wry [RUST]: 0.24.7
- tao [RUST]: 0.16.7
- tauri-cli [RUST]: 1.5.9
- @tauri-apps/api : not installed!
- @tauri-apps/cli [NPM]: 1.5.9
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../ui
- devPath: ../ui
Stack trace
No response
Additional context
I have tried to build a universal app on old x86 mac-mini. I was able to build tauri app for native architecture:
$ cargo tauri build
I have searched the repo and found a few similar issues but they describe situation when someone tries to build universal app on macbooks with M1. But I have a bit different aggangement.
I have XCode 12.4 which is the latest XCode for my macOS Catalina 10.15.7 (see https://xcodereleases.com/)
Can you change the tauri dependency in cargo.toml to this and try again?
tauri = { version = "1", default-features = false, features = ["wry", "compression"]
Can you change the tauri dependency in cargo.toml to this and try again?
tauri = { version = "1", default-features = false, features = ["wry", "compression"]
I updated Cargo.toml file, nuked the target directory and run the build again, but the issue is still there. Build fails with the same error. Here is the full log
https://gist.github.com/rzaitov/809e6b75041193504786c5f08ee9c9d4
error: failed to run custom build command for `tao v0.16.7`
Caused by:
process didn't exit successfully: `/Users/rzaitov/Documents/apps/tauri-get-started/src-tauri/target/release/build/tao-1ea6691790ed402f/build-script-build` (exit status: 1)
--- stdout
cargo:rustc-link-lib=framework=Carbon
TARGET = Some("aarch64-apple-darwin")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_aarch64-apple-darwin
CC_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CC_aarch64_apple_darwin
CC_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=TARGET_CC
TARGET_CC = None
cargo:rerun-if-env-changed=CC
CC = None
RUSTC_LINKER = None
cargo:rerun-if-env-changed=CROSS_COMPILE
CROSS_COMPILE = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
cargo:rerun-if-env-changed=CFLAGS_aarch64-apple-darwin
CFLAGS_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CFLAGS_aarch64_apple_darwin
CFLAGS_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: env -u IPHONEOS_DEPLOYMENT_TARGET "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-arch" "arm64" "-Wall" "-Wextra" "-o" "/Users/rzaitov/Documents/apps/tauri-get-started/src-tauri/target/aarch64-apple-darwin/release/build/tao-e9b91e651ec6b755/out/src/platform_impl/macos/carbon_hotkey/carbon_hotkey_binding.o" "-c" "src/platform_impl/macos/carbon_hotkey/carbon_hotkey_binding.c"
Okay, thanks. I will try to get my catalina VM up and running again but it could totally be possible that this is simply not possible.
I can tell that the oppsite works for me, compiling from M1 to universal.
well, it works on x86 too, just not on Catalina apparently :/ (i can repro it in my vm)
in v2 it should probably work since the carbon framework will be completely removed if you disable apis that don't use keyboard shortcuts, so idk how much time i should invest into this tbh.
Thank you for time and help. It is good to know, that this issue caused by carbon dependency and not some bug or not my config. I think this issue could be closed.