-
Notifications
You must be signed in to change notification settings - Fork 53
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
rust-analyzer
unable to build esp-idf-hal
#179
Comments
Have you configured rust-analyzer as described here? Look at the "UPDATE" section in the bug description. |
Some more details:
There is nothing Linux-specific in the build setup, and it should work out of the box on Mac and Windows (on Windows, with short project path name, but that's all there is to it). I'm sorry to hear that you have put so much effort into assembling an alternative environment. Perhaps you can join the Matrix room and ask around before taking such drastic measures. Or build a VM first? Anyway, all of this should be completely unnecessary - see below.
The build output seems to suggest that you are using the Would you please share the contents of your Also, and very important would you share the build command used by your rust-analyzer? See again bug esp-rs/esp-idf-sys#113 for details why this is important.
I get the sarcasm here, but it is a bit unfounded. The build - during first time build only - downloads ALL of ESP IDF and ALL of the build toolchain executables which are necessary for the particular ESP IDF you are using. Afterwards these are cached, and once the rust-analyzer build issues are addressed, the build becomes incremental. The alternative would have been to ask YOU - as the user - to install all of this circus, which surely would've been much less convenient. :) |
Woah, thanks for the detailed reply! To address your first response, I don't use the Anyway, there's no need to apologize for the quick computer build! It was fun, and I prefer Linux for this kind of debugging anyway. In my experience, any virtual machine on the M1 will have some jank, and Asahi Linux can't get around the page size issue. I'm used to macOS causing great pain during development - it's nothing new. ;) Here's the generated [build]
target = "riscv32imac-esp-espidf"
[target.riscv32imac-esp-espidf]
linker = "ldproxy"
# runner = "espflash --monitor" # Select this runner for espflash v1.x.x
runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x
rustflags = ["--cfg", "espidf_time64", "-C", "default-linker-libraries"]
[unstable]
build-std = ["std", "panic_abort"]
[env]
MCU="esp32c6"
# Note: this variable is not used by the pio builder (`cargo build --features pio`)
ESP_IDF_VERSION = "v5.1.1" On the other hand, I have utterly failed for the past hour to get If you have any suggestions on getting meaningful output from I may end up trying other editors in the morning. Finally, I completely agree that the whole automatic build thing is incredible! However, I've had some trouble with it. The first time took nearly 30 minutes, though that may be my internet. Subsequent builds have been significantly faster. Thank you for the assistance so far - I hope we can get to the bottom of this! 😌️ |
Often For example it can look like the following "rust-analyzer.cargo.target": "riscv32imc-esp-espidf",
"rust-analyzer.cargo.extraEnv": {
"ESP_IDF_VERSION": "v5.1.2",
"MCU": "esp32c3",
"RUSTFLAGS": "--cfg espidf_time64 -C default-linker-libraries",
},
"rust-analyzer.cargo.extraArgs": [
"-Zbuild-std=std,panic_abort",
"-Zbuild-std-features=panic_immediate_abort"
],
"rust-analyzer.check.targets": "riscv32imc-esp-espidf",
"rust-analyzer.check.extraArgs": [
"-Zbuild-std=std,panic_abort",
"-Zbuild-std-features=panic_immediate_abort"
],
"rust-analyzer.check.extraEnv": {
"ESP_IDF_VERSION": "v5.1.2",
"MCU": "esp32c3",
"RUSTFLAGS": "--cfg espidf_time64 -C default-linker-libraries",
}, sometimes you also need to sprinkle in the |
Before going with what @Vollbrecht suggested, which might be the heavy gun, let's try to fix your conf somehow.
Remove
I think you can and should remove Can you also paste your
Hmmm. No gazillions of ideas. Maybe you can try to play with the above r-a command by making it wrong first on purpose, and then looking at the r-a logs if at least it is picking up your command?
Not worth it, and in the end, they all rely on r-a anyway, so I suggest you stick to vscode (or code-server) and playing with r-a until it works.
Your internet it is. The build initially downloads gigabytes of stuff (look at the |
Also make sure that this setting does not contain "all" and in fact does not contain anything. If it is set to "all" that would explain why r-a tries to trigger a pio build in addition to a native one, and then it fails: "rust-analyzer.cargo.features": [] (You can find the setting in the r-a configuration screen.) |
Thanks for all the information! You were right that only minor modifications to the build command resulted in the correct output! :) For example, this {
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"cargo",
"+nightly",
"check",
"--quiet",
"--workspace",
"--message-format=json",
],
"rust-analyzer.check.overrideCommand": [
"cargo",
"+nightly",
"clippy",
"--workspace",
"--message-format=json",
],
"rust-analyzer.cargo.features": [],
} I also overrode the You also suggested modifying If there are any other changes you'd like me to test, I'm happy to do so! Otherwise, thank you so much for your help. I'm so excited to have this resolved! 😄️ |
No, that's it. I'll close the issue now. I think the culprit was that you were probably having |
Bug description
On both macOS and Fedora, when
rust-analyzer
attempts to do its LSP dirty work, it starts by building the project in the background. However, this work fails due to a build script panicking before it finishes.This results in degraded IDE features, making the development experience on these boards unsatisfying and a tad difficult.
The complete build script output is as shown below:
rust-analyzer.txt
On the other hand, that leaves the
CMakeOutput.log
file as a potential cause. It doesn't seem particularly actionable. Still, here's the information it provides:CMakeOutput.log.txt
To Reproduce
Steps to reproduce the behavior:
ESP-IDF
as mentioned here.rust-analyzer
.Expected behavior
I love completions in Rust - they make API discovery much easier to grasp! I expect them to be in full operation per the typical Rust project.
Environment
Additional context
<! I'd like you to please add any other context about the problem here. -->
I was rather frustrated with this issue on my MacBook. As such, I assembled a desktop computer from old parts and installed a fresh copy of Fedora. To my dismay, the problem remains!
That said, I can still build/flash the project just fine. Instead of relying on my editor, I can use
cargo watch -x "
clippy"` - which works okay! Still, it's not fantastic, and I don't think it should be an issue in the first place.p.s. the issue "troubleshooting section" link is broken in the bug report issue template! 🫣️
The text was updated successfully, but these errors were encountered: