tauri-apps / tauri

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

[bug] src-tauri compile error when compiling ignore v0.4.21: use of unstable library feature 'once_cell' #8353

Closed rauerhans closed 10 months ago

rauerhans commented 10 months ago

Describe the bug

first time tauri user, out of the box the src-tauri cargo build fails with

e2e-scaffold/roster-sloth/src-tauri on ξ‚  main [!?⇑] is πŸ“¦ v0.0.0 via πŸ¦€ v1.74.1 on ☁️  (us-east-2) on ☁️  hans@plural.sh 
❯ cargo update
    Updating crates.io index

e2e-scaffold/roster-sloth/src-tauri on ξ‚  main [!?⇑] is πŸ“¦ v0.0.0 via πŸ¦€ v1.74.1 on ☁️  (us-east-2) on ☁️  hans@plural.sh 
❯ cargo build 
   Compiling treediff v4.0.2
   Compiling html5ever v0.26.0
   Compiling toml v0.7.8
   Compiling toml v0.8.8
   Compiling wry v0.24.6
   Compiling serialize-to-javascript v0.1.1
   Compiling ignore v0.4.21
   Compiling embed_plist v1.2.2
   Compiling state v0.5.3
error[E0658]: use of unstable library feature 'once_cell'
   --> /Users/hans.rauer/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.21/src/gitignore.rs:596:9
    |
596 |     use std::sync::OnceLock;
    |         ^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

error[E0658]: use of unstable library feature 'once_cell'
   --> /Users/hans.rauer/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.21/src/gitignore.rs:603:16
    |
603 |     static RE: OnceLock<Regex> = OnceLock::new();
    |                ^^^^^^^^^^^^^^^
    |
    = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

error[E0658]: use of unstable library feature 'once_cell'
   --> /Users/hans.rauer/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.21/src/gitignore.rs:603:34
    |
603 |     static RE: OnceLock<Regex> = OnceLock::new();
    |                                  ^^^^^^^^
    |
    = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

   Compiling json-patch v1.2.0
error[E0658]: use of unstable library feature 'once_cell'
   --> /Users/hans.rauer/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.21/src/gitignore.rs:603:34
    |
603 |     static RE: OnceLock<Regex> = OnceLock::new();
    |                                  ^^^^^^^^^^^^^
    |
    = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

error[E0658]: use of unstable library feature 'once_cell'
   --> /Users/hans.rauer/.cargo/registry/src/github.com-1ecc6299db9ec823/ignore-0.4.21/src/gitignore.rs:604:17
    |
604 |     let re = RE.get_or_init(|| {
    |                 ^^^^^^^^^^^
    |
    = note: see issue #74465 <https://github.com/rust-lang/rust/issues/74465> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `ignore` due to 5 previous errors
warning: build failed, waiting for other jobs to finish...

Reproduction

No response

Expected behavior

should compile without errors

Platform and versions

[βœ”] Environment
    - OS: Mac OS 13.4.1 X64
    βœ” Xcode Command Line Tools: installed
    βœ” rustc: 1.68.0 (2c8cc3432 2023-03-06) (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: 21.2.0
    - yarn: 1.22.19
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 1.5.3
    - tauri-build [RUST]: 1.5.0
    - wry [RUST]: 0.24.6
    - tao [RUST]: 0.16.5
    - @tauri-apps/api [NPM]: 1.5.1
    - @tauri-apps/cli [NPM]: 1.5.7

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


### Stack trace

_No response_

### Additional context

_No response_
FabianLars commented 10 months ago

If you can, update your rust version (rustup update), if you can't, try downgrading ignore cargo update -p ignore --precise 0.4.18. We unfortunetly can't fix that on our side.

FabianLars commented 10 months ago

Ah sorry, your terminal shows a newer rust version than tauri detects, and since tauri uses a direct rustc call it should report the same version that it will use for cargo build so i assume you have 2 rust installations that conflict with each other, maybe one via homebrew?

chnkarl commented 10 months ago

run rusrup update update rust, then it worked for me.

rauerhans commented 10 months ago

Yes somehow that got mixed up with an existing older version of rustc in my usr/local/bin, good eye!