Open kornelski opened 3 weeks ago
I suspect that rust-analyzer is building the project in a way that doesn't support Tauri's way of overriding MACOSX_DEPLOYMENT_TARGET
That sounds very likely because tauri overwrites it in the tauri cli which rust-analyzer (or cargo in general) doesn't know about.
you're right that tauri ignores existing env vars but you can change the target version it uses via https://tauri.app/reference/config/#minimumsystemversion-1
Setting that field to null
should also disable the default 10.13
and would also disable tauri-cli setting it to 10.13
then you'd be free to use MACOSX_DEPLOYMENT_TARGET
to control the target.
However I wouldn't recommended that, since it will remove LSMinimumSystemVersion
in your Info.plist
so it is better to just change the field in tauri.conf.json to match your MACOSX_DEPLOYMENT_TARGET
env variable.
I will mark this issue for v3 since we can't break the default behavior.
sorry I couldn't figure it out from reading, is there quick work around so i can start npm run tauri dev
and it be fast again? I don't have a specific MACOSX_DEPLOYMENT_TARGET requirement yet.
edit:
Disabling rust-analyzer in the editor helps. It looks like the two rust-analyzer processes are using slightly different envs?
first the editor does cargo check
on all the deps while tauri dev
is "Blocking waiting for file lock" then tauri dev
compiles everything again.
edit:
I set the same version in:
and it seems to be better for now
vscode settings.json
{
"rust-analyzer.cargo.extraEnv": {
"MACOSX_DEPLOYMENT_TARGET": "14.6"
}
}
tauri.conf.json
"macOS": {
"minimumSystemVersion": "14.6"
}
Describe the bug
On macOS, there's a special env var
MACOSX_DEPLOYMENT_TARGET
that implicitly configures the system's C compiler, linker, and opts in to or out of breaking changes in macOS. Objects built for different deployment targets may be incompatible. Thecc
crate knows this and emitscargo:rerun-if-env-changed=MACOSX_DEPLOYMENT_TARGET
, which invalidates cache of sys crates whenevercargo build
sees a different value of this variable.Unfortunately, something in Tauri is trying to override
MACOSX_DEPLOYMENT_TARGET
to10.13
.This causes two bugs:
Even if I set
MACOSX_DEPLOYMENT_TARGET
env var to a different value, the project is built for 10.13 anyway.The override causes
cargo
to invalidate cache of sys crates, and rebuildobjc-sys
and all ofwry
,tauri
, and its plugins, every timecargo tauri dev
sees any file change!I'm not sure where Cargo is getting another value from. I suspect that
rust-analyzer
is building the project in a way that doesn't support Tauri's way of overridingMACOSX_DEPLOYMENT_TARGET
, or perhaps there's just a race condition in Cargo that compares an unset value from before the build start with a value set during the build.The end result is that
cargo tauri dev
is painfully slow.Reproduction
To reproduce, modify
src/main.rs
to add:and run:
The expected result:
The actual result:
Second test:
The expected result:
The actual result:
Expected behavior
No response
Full
tauri info
outputStack trace
No response
Additional context
No response