tauri: [bug] OUT_DIR env var is not set, do you have a build script?

Describe the bug

fn main() {
  tauri::Builder::default()
      .invoke_handler(tauri::generate_handler![greet])
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

Reproduction

No response

Expected behavior

No response

Full tauri info output

Macro expansion:
    compile_error!("OUT_DIR env var is not set, do you have a build script?" )
`generate_context` on docs.rs

Stack trace

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Hi folks, we’ll see what we can do on the RustRover’s side: https://youtrack.jetbrains.com/issue/RUST-13238/Suspicious-macro-expansion-results-in-Tauri-apps

Restarting the VS code fixed the issue for me

I meet the same problem in RustRover, I fix this by delete target folder in the project root

Closing as the RustRover version that fixes this issue should be available now 😃

Besides the error message in my IDE, the build/app functions as expected.

So, are both of you encountering it just in an jetbrains ide? Because if so i’d assume they’ll fix it in the next update. Or i really hope so because i’m not a fan of the PR tbh since it’s really not our responsibility to set it (otherwise cargo build and rust-analyzer would fail too).

Well, do you have a build script? If you used create-tauri-app or tauri init it should have created a build.rs file in the src-tauri folder with this content:

fn main() {
  tauri_build::build();
}