-
Notifications
You must be signed in to change notification settings - Fork 24
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
Windows environment variables set incorrectly during install #233
Comments
Now that it's actually working, I can see that my path is getting truncated by setx. |
Oh, it also seems that espup install adds the paths to both the beginning and end of the PATH env-var, so truncation is certain to to happen |
The more I think about this, the more I feel it's the wrong solution to this problem. Instead of trying to shove all this in the users path so that is implicitly part of the linker library search path, can we instead put these paths in their own environment variables and inject them into the linker step via build.rs? |
Hi @9names! Thanks for reporting this issue in a very detailed way, and sorry for the late reply (I was on vacation). I will try to reproduce it on a Windows environments and try to solve it! |
Just tried reproducing the issue in a Windows Sandbox:
|
It looks like when using Windows Sandbox, the user has elevated privileges, so the terminal is run by admin even when you don't open it as an administrator. |
Since |
I think this is the best approach. I can make a PR to improve the esp book's instructions around this workflow. |
Also, once that LLD is supported as linker for |
Hi @9names! Just discovered that we may be able to solve the issue using Feel free to have a look at it or testing it:
|
I tested install + uninstall with very long PATH, it works as expected now. |
Thanks for reporting the issue and testing/reviewing the changes! Just merged it and will create a new release! |
Bug description
#182 Added support for setting CLANG_PATH and PATH in Windows to allow xtensa builds without manually changing environment variables. Unfortunately, that implementation is incorrect. It uses
setx /m
, which sets system-wide environment variables.This implementation has 3 major issues that I'm aware of:
espup install
to successfully set these variables. The installer still reports "Your environment variables have been updated!" but it doesn't set any environment variables.espup install
The fix for 3 is to check path length first and only update the path if it is safe to do so.
The fix for 1 and 2 is to use
setx
, notsetx /m
. This will set the variables in the current users environment instead, which does not require any extra privileges and does not interfere with other users. It does require the user to open a new console before the environment variables are observable, as is noted in the docs forsetx
:No
To Reproduce
Start windows
Install rust
Install espup
Run espup install
Open new cmd
Inspect environment variables - discover that they are missing.
Build esp-idf-template - fails on missing libclang
The text was updated successfully, but these errors were encountered: