tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
84.62k stars 2.54k forks source link

Failing to build Mac universal #7598

Open jerome-whatson opened 1 year ago

jerome-whatson commented 1 year ago

Describe the bug

When i try to build with npm run tauri build -- --target universal-apple-darwin, build failed :

vite v4.4.9 building for production...
✓ 217 modules transformed.
dist/index.html                   0.55 kB │ gzip:  0.35 kB
dist/assets/index-b9c9532d.css   11.54 kB │ gzip:  2.74 kB
dist/assets/index-3b641ae7.js   246.75 kB │ gzip: 80.31 kB
✓ built in 763ms
   Compiling quanti-app v1.0.1 (/.../src-tauri)
    Finished release [optimized] target(s) in 4.16s
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.147
   Compiling serde v1.0.183
   Compiling siphasher v0.3.10
   Compiling bitflags v1.3.2
   Compiling smallvec v1.11.0
   Compiling scopeguard v1.2.0
   Compiling log v0.4.19
   Compiling once_cell v1.18.0
   Compiling memchr v2.5.0
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-apple-darwin`

error[E0463]: can't find crate for `compiler_builtins`

error[E0463]: can't find crate for `core`
   --> /.../.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.3.2/src/lib.rs:282:1
    |
282 | pub extern crate core as _core;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

Note when i run

$rustup target add x86_64-apple-darwin
info: component 'rust-std' for target 'x86_64-apple-darwin' is up to date

Reproduction

On MacBook Pro, Apple M1 Pro

npm run tauri build -- --target universal-apple-darwin 

Expected behavior

An universal apple mac app

Platform and versions

[✔] Environment
    - OS: Mac OS 12.5.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.68.1 (8460ca823 2023-03-20) (built from a source tarball)
    ✔ Cargo: 1.68.0 (115f34552 2023-02-26)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 19.3.0
    - pnpm: 8.1.0
    - yarn: 1.22.19
    - npm: 9.2.0

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

On MacBook Pro, Apple M1 Pro

FabianLars commented 1 year ago

This typically happens if you have 2 rust installations (the built from a source tarball note seconds this since this shouldn't show for rustup instances) with rustup not being the primary one. If that's the case, either remove the other installation or try adding the correct target to that other rust instance too.

jerome-whatson commented 1 year ago

ok, thanks for you answer. I uninstall rust : rustup self uninstall (note i am a beginer on rust) and run again npm run tauri build -- --target universal-apple-darwin

Same result ...

FabianLars commented 1 year ago

well, you're still missing the target for this rust installation but i don't know how to add it, especially since i don't even know where it comes from, homebrew? Either way, i'd recommend getting rid of that too and only using the rustup installation...