Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hellomsg opened this issue Dec 20, 2023 · 14 comments
Closed

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

hellomsg opened this issue Dec 20, 2023 · 14 comments
Labels
status: needs triage This issue needs to triage, applied to new issues status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes type: bug

Comments

@hellomsg
Copy link

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

@hellomsg hellomsg added status: needs triage This issue needs to triage, applied to new issues type: bug labels Dec 20, 2023
@FabianLars
Copy link
Member

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();
}

@ggslayer
Copy link

ggslayer commented Jan 2, 2024

same problem on win10 and v2.0 alpha, and I have the build script: build.rs

@FabianLars
Copy link
Member

Can you upload your app to github? Or try a fresh app create via create-tauri-app and compare that with your own app if it works?

@BitsAndDroids
Copy link

BitsAndDroids commented Jan 6, 2024

I encountered the same behavior on win11 and tried to create a new app as @FabianLars suggested using the create-Tauri command. The error is also present in the new project. There is a build.rs file present in both of my projects. Besides the error message in my IDE, the build/app functions as expected. If you still need an example app, https://github.com/BitsAndDroids/FlightConnector-Rust
I've iterated over my env vars, and the OUT_DIR is (as expected) not present.
image

I've added a pr with a possible fix
#8562

@FabianLars
Copy link
Member

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).

@BitsAndDroids
Copy link

I'm trying another IDE, but I believe you found the culprit. I've just checked VSCode and the "bug" is gone. At least I've learned how to sign a pr from this. Will close the PR.

@FabianLars FabianLars added the status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes label Jan 6, 2024
@BitsAndDroids
Copy link

I'm not sure if this is even relevant, but in VSCode, the out_dir isn't set as well. But there isn't an error message displayed. So under the hood the behavior is the same but Jetbrains displayed the error while VSCode doesn't
image

@wonkyDD
Copy link

wonkyDD commented Jan 9, 2024

@BitsAndDroids Same here. It just only shows error sign in intellij. vscode is fine.

@bravit
Copy link

bravit commented Jan 11, 2024

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

@Junhuan-Peng
Copy link

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

@FabianLars
Copy link
Member

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

@jswhisperer
Copy link

same with rust analyser think deleting targets worked

@shufl9dka
Copy link

Still having the issue on Ubuntu (24.04) with VS Code (1.94.4). Any suggestions please?

@ZeeshanAhmadKhalil
Copy link

Restarting the VS code fixed the issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues status: upstream This issue is blocked by upstream dependencies and we need to wait or contribute upstream fixes type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants