espup
espup copied to clipboard
Windows: Install MIGW dependency for x86_64-pc-windows-gnu
Install MIGW dependency for x86_64-pc-windows-gnu.
Without this dependency, the user will get an error during builds like
How to simulate
Run the following command in Windows Sandbox:
.\espup.exe install
Solution
Implemented here: https://github.com/espressif/idf-env/blob/main/src/rust.rs#L484
Consider pointing directly to mingw repo, instead of esp-rs zipped version. The crate sevenz-rust for unpacking 7zip was improved and contains support also for unpacking Windows binaries: https://github.com/dyz1990/sevenz-rust/issues/1
The new version of sevenz-rust should make it possible to remove this workaround: https://github.com/espressif/idf-env/blob/main/src/rust.rs#L182
This command should be deployed before any cargo install takes place.
As a summary for those who are not familiar with this issue (or #9) or with Rust in Windows, there are two ABIs available for Windows:
- MSVC: Is the recommended one, and when installing
rustupon Windows, it will check if all the requirements are met. If those requirements are not installed, it allows the user to install them..- Here is the PR that added those checks: https://github.com/rust-lang/rustup/pull/2954
- GNU: No checks are done in
rustupand expect that the user takes care of properly installing it.
#9 and #10 are the result of not having any of the proper ABI installed, and therefore, not meeting the Compile-time Requirements.
At the moment, in espup, we are checking if rustup is installed, and if is not, we install it, but we do check if the ABI is installed. With #9 and #10 we would add an argument to espup so that users can install the desired ABI.
So, I see two ways of dealing with this:
- Add rustup as a requirement for
espup:- We would document it as a requirement and add the proper resources so users can install it, although, I would assume that most of the users that get to
espupalready haverustupinstalled. - In the code, we should still check if
rustupis installed, but this time, if we do not find it we should just bail and tell the user to install it. - We could also open an issue in
rustupto try to get GNU ABI to behave like MSVC, whererustupcould detect if installed and allow installing it if is not installed.
- We would document it as a requirement and add the proper resources so users can install it, although, I would assume that most of the users that get to
- Allowing the user to install the ABIs from
espup:- Which is basically whats is done in
idf-env(MinGW installation, and MSVC installation). - The issue that I see with this approach is that there are many valid combinations depending on Windows version/MSVC version/GNU version...
- As an example, in
idf-envwe are installingMicrosoft.VisualStudio.Component.Windows10SDK.20348andrustupinstallsMicrosoft.VisualStudio.Component.Windows11SDK.22000. - For MSVC would basically mean "copying" what's done in
rustupand keeping it up to date (which is what may cause some troubles) - For GNU it would mean implementing the installation of MinGW from
idf-env
- As an example, in
- Which is basically whats is done in
I would go for the option where we add rustup as a requirement since it avoids duplicating some logic from rustup and avoids the burden of having to keep the ABIs requirements up to date. This option would be even better if rustup added some checks for GNU requirements and the option to install them.
Please, let me know your opinion or if I am missing something.
Any other opinion/option is also more than welcome! @georgik @jessebraham @bjoernQ @MabezDev @JurajSadel
I'd say option one (rustup as a requirement) is a very good option. As you said most users will already have it. Also, I'd say that if someone is willing to use GNU ABI those users are already used to the pain 😄
@SergioGasquez and I discussed this yesterday and I also am of the opinion that the first option is the better one.
rustup deployment is integral part of vanilla boostrap environment. Please add the bootstrapping mechanism back.
Thank you @SergioGasquez for returning the feature back.
Windows will be resolved the next week, we might be able to leverage winget tool which can treat VC Tools, MSYS2 and other stuff like pre-requisities and can reduce amount of code that we need to write.
As discussed in #154, espup won't install this dependency.