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.24k stars 2.53k forks source link

[bug] Tauri Requires `CC="clang -fobjc-exceptions"` when running on a nix flake on macos #9433

Closed Eveeifyeve closed 6 months ago

Eveeifyeve commented 6 months ago

Describe the bug

The issue is when running tauri the nomal way using cargo run it runs into this error:

   Compiling serde_json v1.0.111
   Compiling serde_spanned v0.6.5
   Compiling toml_datetime v0.6.3
   Compiling string_cache v0.8.7
   Compiling indexmap v1.9.3
   Compiling url v2.5.0
   Compiling bytes v1.5.0
   Compiling serde_with v3.4.0
   Compiling toml_edit v0.20.2
   Compiling markup5ever v0.11.0
   Compiling plist v1.6.0
   Compiling tokio v1.35.1
   Compiling objc_exception v0.1.2
   Compiling treediff v4.0.2
   Compiling swift-rs v1.0.6
The following warnings were emitted during compilation:

warning: objc_exception@0.1.2: extern/exception.m: In function ‘RustObjCExceptionThrow’:
warning: objc_exception@0.1.2: extern/exception.m:5:5: error: ‘-fobjc-exceptions’ is required to enable Objective-C exception syntax
warning: objc_exception@0.1.2:     5 |     @throw exception;
warning: objc_exception@0.1.2:       |     ^~~~~~

error: failed to run custom build command for `objc_exception v0.1.2`

Caused by:
  process didn't exit successfully: `/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-81b201b40c63f4cb/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-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=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  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,v8.1a,v8.2a,v8.3a,v8.4a,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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = Some("-iframework /nix/store/5nq2mqbs1qm4ycv54b2pspgs8g1kfq9x-devenv-profile/Library/Frameworks")
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-arch" "arm64" "-iframework" "/nix/store/5nq2mqbs1qm4ycv54b2pspgs8g1kfq9x-devenv-profile/Library/Frameworks" "-o" "/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-4778401bf0552349/out/extern/exception.o" "-c" "extern/exception.m"
  cargo:warning=extern/exception.m: In function ‘RustObjCExceptionThrow’:

  cargo:warning=extern/exception.m:5:5: error: ‘-fobjc-exceptions’ is required to enable Objective-C exception syntax

  cargo:warning=    5 |     @throw exception;

  cargo:warning=      |     ^~~~~~

  exit status: 1

  --- stderr

  error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-arch" "arm64" "-iframework" "/nix/store/5nq2mqbs1qm4ycv54b2pspgs8g1kfq9x-devenv-profile/Library/Frameworks" "-o" "/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-4778401bf0552349/out/extern/exception.o" "-c" "extern/exception.m" with args "gcc" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...

Reproduction

https://github.com/Eveeifyeve/Tauri-Repo-Objc-exception

Solved! Flake template at https://github.com/eveeifyeve/nix-tauri

Requires Nix!

To build dev enviroment nix develop --impure or just install direnv and it will do it for you.

To run bun issue to run the issue and you will see.

Expected behavior

It should not include this error and work.

Full tauri info output

[✔] Environment
    - OS: Mac OS 14.4.0 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.77.1 (7cf61ebde 2024-03-27)
    ✔ cargo: 1.77.1 (e52e36006 2024-03-26)
    ✔ rustup: 1.26.0 (1980-01-01)
    ✔ Rust toolchain: 
    - node: 20.11.1
    - bun: 1.1.0

[-] Packages
    - tauri [RUST]: 2.0.0-beta.8
    - tauri-build [RUST]: 2.0.0-beta.6
    - wry [RUST]: 0.37.0
    - tao [RUST]: 0.26.1
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli [NPM]: 2.0.0-beta.6

[-] App
    - build-type: bundle
    - CSP: img-src 'self'; connect-src ipc: http://ipc.localhost; default-src 'self'
    - frontendDist: ../dist
    - devUrl: http://localhost:4321/
    - framework: React (Next.js)
    - bundler: Webpack

Stack trace

error: invalid character `{` in package name: `tauri-plugin-{{name}}`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
 --> ../../../.cargo/git/checkouts/plugins-workspace-fd0259fcb18f51ad/99bea25/shared/template/Cargo.toml:2:8
  |
2 | name = "tauri-plugin-{{name}}"
  |        ^^^^^^^^^^^^^^^^^^^^^^^
  |
       Fresh unicode-ident v1.0.12
       Fresh cfg-if v1.0.0
       Fresh autocfg v1.1.0
       Fresh itoa v1.0.10
       Fresh proc-macro2 v1.0.76
       Fresh ppv-lite86 v0.2.17
       Fresh log v0.4.20
       Fresh siphasher v0.3.11
       Fresh quote v1.0.35
       Fresh libc v0.2.152
       Fresh smallvec v1.12.0
       Fresh bitflags v1.3.2
       Fresh syn v2.0.48
       Fresh once_cell v1.19.0
       Fresh fnv v1.0.7
       Fresh equivalent v1.0.1
       Fresh serde_derive v1.0.195
       Fresh hashbrown v0.14.3
       Fresh ryu v1.0.16
       Fresh jobserver v0.1.27
       Fresh phf_shared v0.10.0
       Fresh serde v1.0.195
       Fresh syn v1.0.109
       Fresh indexmap v2.1.0
       Fresh memchr v2.7.1
       Fresh cc v1.0.83
       Fresh getrandom v0.1.16
       Fresh byteorder v1.5.0
       Fresh percent-encoding v2.3.1
       Fresh phf_shared v0.8.0
       Fresh new_debug_unreachable v1.0.4
       Fresh tinyvec_macros v0.1.1
       Fresh winnow v0.5.34
       Fresh rand_core v0.5.1
       Fresh phf_generator v0.10.0
       Fresh tinyvec v1.6.0
       Fresh precomputed-hash v0.1.1
       Fresh form_urlencoded v1.2.1
       Fresh thiserror-impl v1.0.56
       Fresh rand_chacha v0.2.2
       Fresh rand_pcg v0.2.1
       Fresh phf_codegen v0.10.0
       Fresh unicode-normalization v0.1.22
       Fresh string_cache_codegen v0.5.2
       Fresh mac v0.1.1
       Fresh unicode-bidi v0.3.14
       Fresh rand v0.7.3
       Fresh idna v0.5.0
       Fresh thiserror v1.0.56
       Fresh futf v0.1.5
       Fresh alloc-no-stdlib v2.0.4
       Fresh utf-8 v0.7.6
       Fresh phf_generator v0.8.0
       Fresh convert_case v0.4.0
       Fresh alloc-stdlib v0.2.2
       Fresh proc-macro-hack v0.5.20+deprecated
       Fresh tendril v0.4.3
       Fresh phf v0.10.1
       Fresh strsim v0.10.0
       Fresh derive_more v0.99.17
       Fresh ident_case v1.0.1
       Fresh phf_macros v0.8.0
       Fresh phf_codegen v0.8.0
       Fresh brotli-decompressor v2.5.1
       Fresh darling_core v0.20.3
       Fresh hashbrown v0.12.3
       Fresh dtoa v1.0.9
       Fresh phf v0.8.0
       Fresh darling_macro v0.20.3
       Fresh dtoa-short v0.3.4
       Fresh cssparser-macros v0.6.1
       Fresh itoa v0.4.8
       Fresh stable_deref_trait v1.2.0
       Fresh matches v0.1.10
       Fresh nodrop v0.1.14
       Fresh darling v0.20.3
       Fresh fxhash v0.2.1
       Fresh phf_shared v0.11.2
       Fresh thin-slice v0.1.1
       Fresh servo_arc v0.1.1
       Fresh cssparser v0.27.2
       Fresh base64 v0.21.7
       Fresh phf_generator v0.11.2
       Fresh serde_with_macros v3.4.0
       Fresh selectors v0.22.0
       Fresh phf_macros v0.11.2
       Fresh scopeguard v1.2.0
       Fresh same-file v1.0.6
       Fresh phf v0.11.2
       Fresh walkdir v2.4.0
       Fresh serde_derive_internals v0.26.0
       Fresh ctor v0.2.6
       Fresh pin-project-lite v0.2.13
       Fresh dunce v1.0.4
       Fresh glob v0.3.1
       Fresh schemars_derive v0.8.16
       Fresh lock_api v0.4.11
       Fresh parking_lot_core v0.9.9
       Fresh time-core v0.1.2
       Fresh powerfmt v0.2.0
       Fresh dyn-clone v1.0.17
       Fresh deranged v0.3.11
       Fresh camino v1.1.6
       Fresh parking_lot v0.12.1
       Fresh cargo-platform v0.1.7
       Fresh core-foundation-sys v0.8.6
       Fresh swift-rs v1.0.6
       Fresh cargo_metadata v0.18.1
       Fresh version_check v0.9.4
       Fresh core-foundation v0.9.4
       Fresh safemem v0.3.3
       Fresh simd-adler32 v0.3.7
       Fresh line-wrap v0.1.1
       Fresh quick-xml v0.31.0
       Fresh adler v1.0.2
       Fresh anyhow v1.0.79
       Fresh futures-core v0.3.30
       Fresh miniz_oxide v0.7.1
       Fresh plist v1.6.0
       Fresh tokio-macros v2.2.0
       Fresh socket2 v0.5.5
       Fresh crc32fast v1.3.2
       Fresh signal-hook-registry v1.4.1
       Fresh mio v0.8.10
       Fresh getrandom v0.2.12
       Fresh num_cpus v1.16.0
       Dirty objc_exception v0.1.2: the env variable CC changed
   Compiling objc_exception v0.1.2
       Fresh flate2 v1.0.28
       Fresh tokio v1.35.1
       Fresh rustc_version v0.4.0
     Running `/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-81b201b40c63f4cb/build-script-build`
       Fresh toml_edit v0.19.15
       Fresh embed-resource v2.4.1
       Fresh typenum v1.17.0
       Fresh serde_json v1.0.111
       Fresh bitflags v2.4.1
       Fresh toml v0.7.8
       Fresh malloc_buf v0.0.6
       Fresh heck v0.4.1
       Fresh generic-array v0.14.7
       Fresh tauri-winres v0.1.1
       Fresh tauri-plugin v2.0.0-beta.6
       Fresh cargo_toml v0.17.2
       Fresh futures-sink v0.3.30
       Fresh core-graphics-types v0.1.3
       Fresh slab v0.4.9
       Dirty tauri-build v2.0.0-beta.6: the rustflags changed
   Compiling tauri-build v2.0.0-beta.6
       Fresh foreign-types-macros v0.2.3
       Fresh futures-macro v0.3.30
       Fresh foreign-types-shared v0.3.1
       Fresh pin-utils v0.1.0
       Fresh block v0.1.6
       Fresh futures-task v0.3.30
       Fresh foreign-types v0.5.0
       Fresh tokio-util v0.7.10
       Dirty block-buffer v0.10.4: the rustflags changed
   Compiling block-buffer v0.10.4
       Dirty crypto-common v0.1.6: the rustflags changed
   Compiling crypto-common v0.1.6
     Running `rustc --crate-name tauri_build --edition=2021 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-build-2.0.0-beta.6/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="config-json"' --cfg 'feature="default"' -C metadata=7c124e60b1907601 -C extra-filename=-7c124e60b1907601 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern anyhow=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libanyhow-1f61752d80b4260a.rmeta --extern cargo_toml=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libcargo_toml-5f0b31ca99870cf8.rmeta --extern dirs_next=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libdirs_next-4b953e5ea8d01cc0.rmeta --extern glob=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libglob-c3c7b184c6959404.rmeta --extern heck=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libheck-6bf08dc7ccfdd8b7.rmeta --extern json_patch=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libjson_patch-74c27de6c0451b10.rmeta --extern schemars=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libschemars-c336f427555b1977.rmeta --extern semver=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libsemver-8ed3f533e2b0a026.rmeta --extern serde=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libserde-b414f4ff297af14a.rmeta --extern serde_json=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libserde_json-7d9f209f16f88181.rmeta --extern tauri_utils=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libtauri_utils-c75b207efeff4856.rmeta --extern tauri_winres=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libtauri_winres-b82612f59b73301d.rmeta --extern toml=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libtoml-6a4697cfc30de4fe.rmeta --extern walkdir=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libwalkdir-af9c56d9de5dd518.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty futures-util v0.3.30: the rustflags changed
   Compiling futures-util v0.3.30
       Dirty core-graphics v0.23.1: the rustflags changed
   Compiling core-graphics v0.23.1
     Running `rustc --crate-name block_buffer --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/block-buffer-0.10.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C metadata=c6c55b6843dfa360 -C extra-filename=-c6c55b6843dfa360 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern generic_array=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libgeneric_array-b2612b43ea728c15.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
     Running `rustc --crate-name crypto_common --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/crypto-common-0.1.6/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="std"' -C metadata=88346c5b7d576832 -C extra-filename=-88346c5b7d576832 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern generic_array=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libgeneric_array-b2612b43ea728c15.rmeta --extern typenum=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libtypenum-35e3ec7f1ab05f38.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Fresh fdeflate v0.3.3
     Running `rustc --crate-name futures_util --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.30/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="alloc"' --cfg 'feature="async-await"' --cfg 'feature="async-await-macro"' --cfg 'feature="default"' --cfg 'feature="futures-macro"' --cfg 'feature="slab"' --cfg 'feature="std"' -C metadata=fb3809516e6587f2 -C extra-filename=-fb3809516e6587f2 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern futures_core=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libfutures_core-029bea130005a94e.rmeta --extern futures_macro=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libfutures_macro-f1a43d4573bb72ec.dylib --extern futures_task=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libfutures_task-c0d26003e171a77f.rmeta --extern pin_project_lite=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libpin_project_lite-16908d3690796ada.rmeta --extern pin_utils=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libpin_utils-259be2755990485a.rmeta --extern slab=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libslab-69221288aa1d5734.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
     Running `rustc --crate-name core_graphics /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/core-graphics-0.23.1/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="default"' -C metadata=8716aca4fd51460a -C extra-filename=-8716aca4fd51460a --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern bitflags=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libbitflags-efb82dafe6ed53f6.rmeta --extern core_foundation=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libcore_foundation-332641f436467b4a.rmeta --extern core_graphics_types=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libcore_graphics_types-7607eb1a4683bcf8.rmeta --extern foreign_types=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libforeign_types-305589edaf895520.rmeta --extern libc=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/liblibc-dc5799a973790e93.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty url v2.5.0: the rustflags changed
   Compiling url v2.5.0
       Dirty errno v0.3.8: the rustflags changed
   Compiling errno v0.3.8
     Running `rustc --crate-name url --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/url-2.5.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="default"' --cfg 'feature="serde"' -C metadata=cd8c7ee4e09fc050 -C extra-filename=-cd8c7ee4e09fc050 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern form_urlencoded=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libform_urlencoded-dffcf5a44cf62eac.rmeta --extern idna=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libidna-07bec12678afa1ce.rmeta --extern percent_encoding=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libpercent_encoding-0963c1b52c693454.rmeta --extern serde=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libserde-fcb54192c865ff45.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
     Running `rustc --crate-name errno --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/errno-0.3.8/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="std"' -C metadata=dda2cf9decb260ff -C extra-filename=-dda2cf9decb260ff --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern libc=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/liblibc-dc5799a973790e93.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty lazy_static v1.4.0: the rustflags changed
   Compiling lazy_static v1.4.0
     Running `rustc --crate-name lazy_static /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lazy_static-1.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C metadata=2765cf1935a3d3fa -C extra-filename=-2765cf1935a3d3fa --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty digest v0.10.7: the rustflags changed
   Compiling digest v0.10.7
     Running `rustc --crate-name digest --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/digest-0.10.7/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="alloc"' --cfg 'feature="block-buffer"' --cfg 'feature="core-api"' --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=435174541b77e5c3 -C extra-filename=-435174541b77e5c3 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern block_buffer=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libblock_buffer-c6c55b6843dfa360.rmeta --extern crypto_common=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libcrypto_common-88346c5b7d576832.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty rustix v0.38.30: the rustflags changed
   Compiling rustix v0.38.30
     Running `rustc --crate-name rustix --edition=2021 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.38.30/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="fs"' --cfg 'feature="std"' --cfg 'feature="use-libc-auxv"' -C metadata=655804f9e5bb4ea3 -C extra-filename=-655804f9e5bb4ea3 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern bitflags=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libbitflags-110c7cbe1ddce681.rmeta --extern libc_errno=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/liberrno-dda2cf9decb260ff.rmeta --extern libc=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/liblibc-dc5799a973790e93.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks --cfg static_assertions --cfg libc --cfg apple --cfg bsd`
       Dirty png v0.17.11: the rustflags changed
   Compiling png v0.17.11
     Running `rustc --crate-name png --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/png-0.17.11/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C metadata=b68bedc3cd7fd174 -C extra-filename=-b68bedc3cd7fd174 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --extern bitflags=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libbitflags-efb82dafe6ed53f6.rmeta --extern crc32fast=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libcrc32fast-83bba610e4d505ce.rmeta --extern fdeflate=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libfdeflate-71793ce330bea7e4.rmeta --extern flate2=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libflate2-d19c5426b5fddeed.rmeta --extern miniz_oxide=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps/libminiz_oxide-94917eacd345100e.rmeta --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks`
       Dirty httparse v1.8.0: the rustflags changed
   Compiling httparse v1.8.0
     Running `rustc --crate-name httparse --edition=2018 /Users/eveeifyeve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/httparse-1.8.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=191 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=1f7340fa308edcf4 -C extra-filename=-1f7340fa308edcf4 --out-dir /Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps -L dependency=/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/deps --cap-lints allow -L framework=/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks --cfg httparse_simd`
The following warnings were emitted during compilation:

warning: objc_exception@0.1.2: extern/exception.m: In function ‘RustObjCExceptionThrow’:
warning: objc_exception@0.1.2: extern/exception.m:5:5: error: ‘-fobjc-exceptions’ is required to enable Objective-C exception syntax
warning: objc_exception@0.1.2:     5 |     @throw exception;
warning: objc_exception@0.1.2:       |     ^~~~~~

error: failed to run custom build command for `objc_exception v0.1.2`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-81b201b40c63f4cb/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-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=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("gcc")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = Some("-iframework /nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks")
  running: env -u IPHONEOS_DEPLOYMENT_TARGET "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-arch" "arm64" "-iframework" "/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks" "-o" "/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-4778401bf0552349/out/extern/exception.o" "-c" "extern/exception.m"
  cargo:warning=extern/exception.m: In function ‘RustObjCExceptionThrow’:

  cargo:warning=extern/exception.m:5:5: error: ‘-fobjc-exceptions’ is required to enable Objective-C exception syntax

  cargo:warning=    5 |     @throw exception;

  cargo:warning=      |     ^~~~~~

  exit status: 1

  --- stderr

  error occurred: Command env -u IPHONEOS_DEPLOYMENT_TARGET "gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-arch" "arm64" "-iframework" "/nix/store/i2k44y2sgasyklydwxydnrskwv96xlys-devenv-profile/Library/Frameworks" "-o" "/Users/eveeifyeve/projects/Launcher/src-tauri/target/debug/build/objc_exception-4778401bf0552349/out/extern/exception.o" "-c" "extern/exception.m" with args "gcc" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...


### Additional context

But as a nix user on macos this should really be happening to really need this flag to work.
Eveeifyeve commented 6 months ago

Any updates/progress to this???

FabianLars commented 6 months ago

No update and no progress. To be honest, i don't think anybody will look into this anytime soon. Our best bet here is if someone from the nix community could take a look.

Maybe the solution is something in the same spirit as https://github.com/tauri-apps/tauri/issues/8588 here.

vtu-dog commented 6 months ago

This is happening to me as well. I think it's a problem with objc_exception@0.1.2. The dependency chain is: tauri v2.0.0-beta.14 -> cocoa v0.25.0 -> cocoa-foundation v0.1.2 -> objc v0.2.7 -> objc_exception v0.1.2. Related issue: link.

I'm a complete dummy when it comes to compilers, but I followed the above-mentioned GitHub issue and deduced it has something to do with gcc. I removed $PATH entries that contained gcc and the project worked just fine, since the build system defaulted to /usr/bin/gcc.

However, gcc is just clang in disguise on macOS. I figured that adding llvmPackages.libcxxClang to devenv.shells.default.packages could also work. Lo and behold, this is what did the trick!

TLDR: change your flake.nix

              ++ (with pkgs; [
                llvmPackages.libcxxStdenv
+               llvmPackages.libcxxClang
                darwin.libobjc
                rustup
              ]);
Eveeifyeve commented 6 months ago
 llvmPackages.libcxxClang

I am looking to make an unofficial flake template over here

Eveeifyeve commented 6 months ago

fixed: https://github.com/Eveeifyeve/Nix-Tauri/blob/Stable/flakes/devenv/flake.nix