Giter Site home page Giter Site logo

espup's Introduction

espup

Crates.io MSRV Continuous Integration Security audit Matrix

rustup for esp-rs

espup is a tool for installing and maintaining the required toolchains for developing applications in Rust for Espressif SoC's.

To better understand what espup installs, see the installation chapter of The Rust on ESP Book

Requirements

Before running or installing espup, make sure that rustup is installed.

Linux systems also require the following packages:

  • Ubuntu/Debian
    sudo apt-get install -y gcc build-essential curl pkg-config
  • Fedora
    sudo dnf -y install perl gcc
    • perl is required to build openssl-sys
  • openSUSE Thumbleweed/Leap
    sudo zypper install -y gcc ninja make
    

Installation

cargo install espup

It's also possible to use cargo-binstall or to directly download the pre-compiled release binaries.

Commands to install pre-compiled release binaries
  • Linux aarch64
    curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-aarch64-unknown-linux-gnu -o espup
    chmod a+x espup
  • Linux x86_64
    curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-unknown-linux-gnu -o espup
    chmod a+x espup
  • macOS aarch64
    curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-aarch64-apple-darwin -o espup
    chmod a+x espup
  • macOS x86_64
    curl -L https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-apple-darwin -o espup
    chmod a+x espup
  • Windows MSVC
    Invoke-WebRequest 'https://github.com/esp-rs/espup/releases/latest/download/espup-x86_64-pc-windows-msvc.exe' -OutFile .\espup.exe

Quickstart

See Usage section for more details.

espup install
# Unix
. $HOME/export-esp.sh
# Windows does not require sourcing any file

Important

The generated export file, by default export-esp, needs to be sourced in every terminal in Unix systems before building an application. On Windows, environment variables are automatically injected into your system and don't need to be sourced.

Usage

Usage: espup <COMMAND>

Commands:
  completions  Generate completions for the given shell
  install      Installs Espressif Rust ecosystem
  uninstall    Uninstalls Espressif Rust ecosystem
  update       Updates Xtensa Rust toolchain
  help         Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Completions Subcommand

For detailed instructions on how to enable tab completion, see Enable tab completion for Bash, Fish, Zsh, or PowerShell section.

Usage: espup completions [OPTIONS] <SHELL>

Arguments:
  <SHELL>  Shell to generate completions for [possible values: bash, elvish, fish, powershell, zsh]

Options:
  -l, --log-level <LOG_LEVEL>  Verbosity level of the logs [default: info] [possible values: debug, info, warn, error]
  -h, --help                   Print help

Install Subcommand

Note

Xtensa Rust destination path

Installation paths can be modified by setting the environment variables CARGO_HOME and RUSTUP_HOME before running the install command. By default, toolchains will be installed under <rustup_home>/toolchains/esp, although this can be changed using the -a/--name option.

Note

GitHub API

During the installation process, several GitHub queries are made, which are subject to certain limits. Our number of queries should not hit the limit unless you are running espup install command numerous times in a short span of time. We recommend setting the GITHUB_TOKEN environment variable when using espup in CI, if you want to use espup on CI, recommend using it via the xtensa-toolchain action, and making sure GITHUB_TOKEN is not set when using it on a host machine. See esp-rs/xtensa-toolchain#15 for more details on this.

Usage: espup install [OPTIONS]

Options:
  -d, --default-host <DEFAULT_HOST>
          Target triple of the host

          [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]

-r, --esp-riscv-gcc
          Install Espressif RISC-V toolchain built with croostool-ng

          Only install this if you don't want to use the systems RISC-V toolchain

  -f, --export-file <EXPORT_FILE>
          Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html)

          [env: ESPUP_EXPORT_FILE=]

  -e, --extended-llvm
          Extends the LLVM installation.

          This will install the whole LLVM instead of only installing the libs.

  -l, --log-level <LOG_LEVEL>
          Verbosity level of the logs

          [default: info]
          [possible values: debug, info, warn, error]

  -a, --name <NAME>
          Xtensa Rust toolchain name

          [default: esp]

  -n, --nightly-version <NIGHTLY_VERSION>
          Nightly Rust toolchain version

          [default: nightly]

  -k, --skip-version-parse
          Skips parsing Xtensa Rust version

  -s, --std
          Only install toolchains required for STD applications.

          With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications.

  -t, --targets <TARGETS>
          Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,esp32p4,all]

          [default: all]

  -v, --toolchain-version <TOOLCHAIN_VERSION>
          Xtensa Rust toolchain version

  -h, --help
          Print help (see a summary with '-h')

Uninstall Subcommand

Usage: espup uninstall [OPTIONS]

Options:
  -l, --log-level <LOG_LEVEL>  Verbosity level of the logs [default: info] [possible values: debug, info, warn, error]
  -a, --name <NAME>            Xtensa Rust toolchain name [default: esp]
  -h, --help                   Print help

Update Subcommand

Usage: espup update [OPTIONS]

Options:
  -d, --default-host <DEFAULT_HOST>
          Target triple of the host

          [possible values: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]

  -f, --export-file <EXPORT_FILE>
          Relative or full path for the export file that will be generated. If no path is provided, the file will be generated under home directory (https://docs.rs/dirs/latest/dirs/fn.home_dir.html)

          [env: ESPUP_EXPORT_FILE=]

  -e, --extended-llvm
          Extends the LLVM installation.

          This will install the whole LLVM instead of only installing the libs.

  -l, --log-level <LOG_LEVEL>
          Verbosity level of the logs

          [default: info]
          [possible values: debug, info, warn, error]

  -a, --name <NAME>
          Xtensa Rust toolchain name

          [default: esp]

  -n, --nightly-version <NIGHTLY_VERSION>
          Nightly Rust toolchain version

          [default: nightly]

  -k, --skip-version-parse
          Skips parsing Xtensa Rust version

  -s, --std
          Only install toolchains required for STD applications.

          With this option, espup will skip GCC installation (it will be handled by esp-idf-sys), hence you won't be able to build no_std applications.

  -t, --targets <TARGETS>
          Comma or space separated list of targets [esp32,esp32c2,esp32c3,esp32c6,esp32h2,esp32s2,esp32s3,all]

          [default: all]

  -v, --toolchain-version <TOOLCHAIN_VERSION>
          Xtensa Rust toolchain version

  -h, --help
          Print help (see a summary with '-h')

Enable tab completion for Bash, Fish, Zsh, or PowerShell

espup supports generating completion scripts for Bash, Fish, Zsh, and PowerShell. See espup help completions for full details, but the gist is as simple as using one of the following:

# Bash
$ espup completions bash > ~/.local/share/bash-completion/completions/espup

# Bash (macOS/Homebrew)
$ espup completions bash > $(brew --prefix)/etc/bash_completion.d/espup.bash-completion

# Fish
$ mkdir -p ~/.config/fish/completions
$ espup completions fish > ~/.config/fish/completions/espup.fish

# Zsh
$ espup completions zsh > ~/.zfunc/_espup

# PowerShell v5.0+
$ espup completions powershell >> $PROFILE.CurrentUserCurrentHost
# or
$ espup completions powershell | Out-String | Invoke-Expression

Note: you may need to restart your shell in order for the changes to take effect.

For zsh, you must then add the following line in your ~/.zshrc before compinit:

fpath+=~/.zfunc

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

espup's People

Contributors

andywwright avatar chenaoxd avatar dependabot[bot] avatar gak avatar georgik avatar jasta avatar jessebraham avatar jurajsadel avatar kingkili avatar lrabbit avatar lu-zero avatar nukesor avatar ryankopf avatar sergiogasquez avatar sirhcel avatar vollbrecht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

espup's Issues

Improve CI

Motivations

Run all the CI jobs in parallel to reduce CI time.

`--without=rust-docs` breaks installs with Rust 1.66.0.0

Bug description

Upstream rust added the rust-docs-json-preview component, so this breaks the --without command since it performs rudimentary string replacement and it turns rustc, rust-std-x86_64-unknown-linux-gnu, rust-docs, rust-docs-json-preview, cargo into rustc, rust-std-x86_64-unknown-linux-gnu, -json-preview, cargo, with -json-preview of course being non-existent.
https://github.com/esp-rs/espup/blob/main/src/toolchain/rust.rs#L106
https://github.com/esp-rs/espup/blob/main/src/toolchain/rust.rs#L121

  • Would you like to work on a fix? [y/n]

To Reproduce

Steps to reproduce the behavior:

  1. espup install -v 1.66.0.0
  2. Output:
install: creating uninstall script at ~/.rustup/toolchains/esp/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
install: installing component '-json-preview'
install: error: manifest for -json-preview does not exist at ~/.espressif/dist/rust/rust-nightly-x86_64-unknown-linux-gnu/-json-preview/manifest.in. see logs at '~/.rustup/toolchains/esp/lib/rustlib/install.log'

Expected behavior

Successful installation

Screenshots

Environment

Additional context

Improve config file

When uninstalling if, for example, the export file deletion fails. Then, it will always fail as Xtensa Rust toolchain was already deleted but the config file was not updated.

Add argument to choose between LLVM 14 and 15

Motivations

With the new LLVM release, it would be very beneficial to have the ability to choose which LLVM version we want to install.

Solution

Add an argument --llvm-version which lets the user choose between 14 and 15, then espup will take care of installing the proper toolchain.

[Windows] Allow for using CMD instead of PowerShell

Motivations

The export file generated on Windows is a PowerShell script. Using this script to set the environment variables requires working in PowerShell. I.e., it is not enough to work in a normal CMD window and run powershell export-esp.ps1, since this will not modify the environment variables in the CMD session. See: https://stackoverflow.com/a/68024909

It would be nice to have a something like a batch file, such that the environment variables can also be set in a CMD session, instead of forcing the use of PowerShell.

  • Would you like to implement this feature? [y/n]
    I am not sure how to solve this.

Solution

I am not quite sure what the best approach would be here. Generating both versions by default, or maybe letting the user choose?

Alternatives

Additional context

espup installed, but no xtensa target available

Bug description

When I run rustc --print target-list, no xtensa target is shown. Furthermore, when I try to build this demo project using the command cargo build, then it fails saying that no xtensa-esp32-espidf target is found.

To Reproduce

  1. espup tool installed using the command cargo install espup,
  2. espup tool is stored in ".cargo/bin" directory but not in "PATH" env var by default,
  3. espup install command used,
  4. source export-esp.sh done.

Expected behavior

Being able to compile this code, and flash it on ESP32-WROOM32 chip.

Environment

  • OS: archinux
  • espup version: 0.2.3

Add MSRV check

Motivations

Add MSRV check in the CI and add a badge in the readme.

`uninstall` command fails when using multiple RiscV targets

Bug description

As both ESP32C3 and ESP32C2 use the same GCC toolchain (riscv32-esp-elf), if we try to espup uninstall when we have both targets installed, it will fail as it will try to delete the same folder twice.

Also, when we run espup uninstall we should delete the riscv32imac-unknown-none-elf target from the nightly toolchain.

To Reproduce

Steps to reproduce the behavior:

  1. espup install
  2. espup uninstall
  3. Fails with Failed to remove ''/home/esp/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8_4_0 directory. Please, manually verify that the directory is properly removed and run 'espup uninstall' again.

Expected behavior

We should only try to delete de folder once, even when both RiscV targets are installed.

Add retries to download/install methods

Motivations

We are encountering some transient issues when using espup install from Github CI, maybe because the network from the CI is not that stable and that results in some random failures.

Solution

Adding some retry logic would help avoid this kind of errors.

Xtensa Rust toolchain should only be installed when there is a Xtensa target.

Bug description

If we run the installation with only RISC-V targets, Xtensa Rust Toolchain should not be installed

To Reproduce

Steps to reproduce the behavior:

  1. espup install -t "esp32c3" will install esp toolchain.

Expected behavior

`espup install -t "esp32c3" should not install the Xtensa Rust toolchain as its not required for RISC-V targets

Improve `extra_crates` argument

Motivations

extra_crates should be optional and avoid trying to install any crate if the argument was not present. Also, we should do a parsing fn and add some test like we do with toolchain_version and export_file

Windows - export-esp.ps1 contains path with mixed / and \

Content of export-eps.ps1 generated by espup:

$Env:LIBCLANG_PATH="C:\Espressif/tools/xtensa-esp32-elf-clang/esp-15.0.0-20221201-x86_64-pc-windows-msvc/esp-clang/bin/libclang.dll"
$Env:PATH+=";C:\Espressif/tools/xtensa-esp32-elf-clang/esp-15.0.0-20221201-x86_64-pc-windows-msvc/esp-clang/bin"
$Env:PATH += ";C:\Espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8_4_0/riscv32-esp-elf/bin"
$Env:PATH += ";C:\Espressif/tools/xtensa-esp32s2-elf/esp-2021r2-patch5-8_4_0/xtensa-esp32s2-elf/bin"
$Env:PATH += ";C:\Espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8_4_0/xtensa-esp32-elf/bin"
$Env:PATH += ";C:\Espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8_4_0/riscv32-esp-elf/bin"
$Env:PATH += ";C:\Espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8_4_0/xtensa-esp32s3-elf/bin"

PATH contains mixed \ and /. This creates a problem when use wants to copy the path and add it via system dialog to environment variables. The system reject the path, because it contains /.

Expected output: All paths are converted to \, so it's possible to copy&past the path to Environment variable dialog

Check or unset variable RUSTC_WRAPPER before launching cargo install

If the environment was cleaned by removing all Rust toolchain file and .cargo, but the environment variable RUSTC_WRAPPER remains to be set to the binary which does not exist anymore, the cargo install command will fail:

  Installing cargo-espflash v1.7.0
error: failed to compile `cargo-espflash v1.7.0`, intermediate artifacts can be found at `C:\projects\tmp\AppData\Local\Temp\cargo-installgwG6p0`

Caused by:
  failed to run `rustc` to learn about target-specific information

Caused by:
  could not execute process `C:\Users\User\.cargo\bin\sccache.exe rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (never executed)

Caused by:
  The system cannot find the file specified. (os error 2)
Error: command '"cargo" "install" "cargo-espflash"' exited with non-zero status code 101

Improve warning log on Windows when Xtensa toolchain is already installed

Bug description

When the Xtensa toolchain is already installed on Windows, the error log is a bit misleading - it suggests removing the whole toolchains folder in C:\Users\JurajSadel/.rustup\toolchains, instead of removing just the C:\Users\JurajSadel/.rustup\toolchains\esp folder should be the way to go.

  • Would you like to work on a fix? [y/n]

To Reproduce

Steps to reproduce the behavior:

  1. Have any Xtensa toolchain installed on your machine
  2. Run espup install
  3. The log is Error: ⚠️ Previous installation of Rust Toolchain exist in: 'C:\Users\JurajSadel/.rustup\toolchains'. Please, remove the directory before the new installation.

Expected behavior

The user shouldn't remove the whole toolchains/* folder, just esp one instead.

Screenshots

Environment

  • OS: Windows 11
  • espup version: 0.2.1

Additional context

`espup install` expects `/bin/bash` to exist

Bug description

espup install fetches rustup-init.sh and attempts to execute it with "/bin/bash" "/home/$USER/.espressif/dist/rustup/rustup-init.sh" However, not all systems have Bash installed, and even those that do don't always have it present in /bin/bash

  • Would you like to work on a fix? I could, if provided with info about the desired fix, although I suspect that it's going to be such a simple fix that it would be much more time-effective if some maintainer fixes it instead.

To Reproduce

Steps to reproduce the behavior:

  1. run espup install

Expected behavior

Things work

Screenshots

Error:
  × command '"/bin/bash" "/home/$USER/.espressif/dist/rustup/rustup-init.sh" "--default-toolchain" "nightly" "--default-host" "x86_64-unknown-linux-gnu" "--profile" "minimal" "-y"' failed to start
  ╰─▶ No such file or directory (os error 2)

Environment

  • OS: NixOS 23.05 (Stoat)
  • espup version: 0.2.3

Additional context

Since rustup-init.sh has a shebang, I don't see any reason not to invoke it directly. If there is one, it would at least be better to use a bash from $PATH, for example via /usr/bin/env bash ....

`espup install` should suceed even if the Xtensa Rust toolchain is already installed

Bug description

At the moment, if $RUSTUP_HOME/.rustup/toolchain/esp is present, the installation will fail with:

Error: espup::toolchain::rust::xtensa_rust_already_installed

  × ⛔  Previous installation of Rust Toolchain exists in: '/home/esp/.rustup/toolchains/esp'. Please, remove the directory before new installation.

espup should be idempotent and running several times espup install should lead to the same output (successful). Running several times espup install could also be a way of re-generating the export file, so it could be used as a solution for #61.

To Reproduce

Steps to reproduce the behavior:

  1. espup install
  2. espup install

Dot at the end of error message with directory path is misleading

Please, remove "." from the error messages where it contains the path to the directory.
It's slightly misleading when the user wants to copy and paste the path.

Previous installation of LLVM exist in: /home/rust/.espressif/tools/xtensa-esp32-elf-clang/esp-14.0.0-20220415-x86_64-unknown-linux-gnu.

Add a Proxy Option for download things from github

Motivations

Sometimes, it's hard download things from github without proxy in china, so can it add a proxy option?

  • Would you like to implement this feature? [y/n] y

Solution

Alternatives

Additional context

Request or response body error: error reading a body from connection

Bug description

A job in our CI ran into this error.
It didn't occur in other runs, though.

tthread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: SendError(Ok([
    "export IDF_PATH=/builds/orga/project/project/firmware/espressif/esp-idf-ae062fbba3ded0aa/v4.4.3",
    "export PATH=\"/builds/orga/project/project/firmware/espressif/tools/cmake/3.23.1/bin:/builds/orga/project/project/firmware/espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/builds/orga/project/project/firmware/espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin:/builds/orga/project/project/firmware/espressif/tools/ninja/1.10.2/:/builds/orga/project/project/firmware/espressif/python_env/idf4.4_py3.10_env/bin:/builds/orga/project/project/firmware/espressif/esp-idf-ae062fbba3ded0aa/v4.4.3/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/builds/orga/project/project/firmware/cargo/bin\"", 
    "export IDF_TOOLS_PATH=\"/builds/orga/project/project/firmware/espressif\""
]))',
/builds/orga/project/project/firmware/cargo/registry/src/github.com-1ecc6299db9ec823/espup-0.2.5/src/main.rs:248:32

Error:
  × request or response body error: error reading a body from connection: end
  │ of file before message length reached
  ├─▶ error reading a body from connection: end of file before message length
  │   reached
  ╰─▶ end of file before message length reached

The bug happened at this piece of code:

    for app in to_install {
        let tx = tx.clone();
        tokio::spawn(async move {
            let res = app.install().await;
            tx.send(res).await.unwrap(); // <---- At the unwrap
        });
    }

The error message indicates, that the installation of the app worked as expected. Instead the tx.send(res) seems to somehow fail.

  • Would you like to work on a fix? [y]
    I just need some context, as I'm not sure how this could happen.

To Reproduce

I wasn't able to reproduce this behavior, it only happened once until now.
It happened on the very last version, which is the latest commit on main at this point.

Environment

  • OS: Arch Linux
  • espup version: v0.2.5

Display information about available default hosts

Request for Windows: Default host target triple is hard to guess.
Include the name of available triples in the help message and error message when user specifies triple which does not match.
Other option would be to add "alias" like msvc or gnu. The full version of the string: x86_64-pc-windows-gnu and x86_64-pc-windows-msvc.

Incorrect library path for MacOS tools?

Bug description

espup on MacOS is looking for libraries in an incorrect place for my system.

  • Would you like to work on a fix? n

To Reproduce

Given install:

cargo install espup
espup install
. ~/export-esp.sh

I get an error running cargo:

$ cargo version
dyld[76858]: Library not loaded: '/usr/local/opt/openssl@3/lib/libcrypto.3.dylib'
  Referenced from: '/Users/ted/.rustup/toolchains/esp/bin/cargo'
  Reason: tried: '/usr/local/opt/openssl@3/lib/libcrypto.3.dylib' (no such file), '/Users/ted/.rustup/toolchains/esp/lib/libcrypto.3.dylib' (no such file), '/Users/ted/lib/libcrypto.3.dylib' (no such file), '/usr/local/lib/libcrypto.3.dylib' (no such file), '/usr/lib/libcrypto.3.dylib' (no such file)
Abort trap: 6

my libssl.3.dylib & libcrypto.3.dylib live in /opt/local/lib/

Expected behavior

cargo works

Environment

  • OS: MacOS 12.6
  • espup version: 0.2.5

Additional context

Maybe they could be statically linked? Or shipped with the binary and put in ~/.rustup/toolchains/esp/lib/ ?

Windows: Install MSVC dependency for x86_64-pc-windows-msvc

Install MSVC dependency for x86_64-pc-windows-msvc.

Without this dependency, the user will get an error during builds like:

error: linker `link.exe` not found
  |
  = note: program not found

Note: the msvc targets depend on the msvc linker, but `link.exe` was not found

Note: please ensure that VS 2013, VS 2015, VS 2017, VS 2019, or VS 2022 was installed with the Visual C++ option

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#L335

The following command installs required dependencies:

vs_BuildTools.exe --passive --wait --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.20348

This command should be deployed before any cargo install takes place.

Improve LLVM uninstall

Motivations

When running espup uninstall the xtensa-esp32-elf-clang folder is not deleted.

TODO: Verify if the same behaviour occurs in Windows

Additional context

In a Linux env:

espup install
espup uninstall

Will not delete the $HOME/.espressif/tools/xtensa-esp32-elf-clang/ and it will be empty

espup fails un Ubuntu 22

Problem:

./espup: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

Solution used in cargo is to statically link ssl libraries.

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: dyz1990/sevenz-rust#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.

Change default location for ESP-IDF clone to `~/.espressif/frameworks/esp-idf...`

Change default location for ESP-IDF clone to ~/.espressif/frameworks/esp-idf...
This directory structure is already used in Windows and makes it easier to separate the esp-idf instance from the rest of the tools.

Right now, the implementation deployed to different directory:

~/.espressif/esp-idf-ae062fbba3ded0aa/v4.4.1/

Command

./espup install -e v4.4.1

Export file should use absolute paths

Motivations

At the moment, export_file is using a relative path, even in the config file we store a relative path. We need to store absolute path, so we know the location of the file in the future.

Also, it would be better to print the absolute path in the logs when we ask the user to source the export file, so they can copy-paste the command in the future and use it no matter what cwd they are in.

Check if the provided toolchain version exists

Motivations

We should check that the format provided is correct, but also that the version does exist in rust-build.

Also, we should accept the standard semantic version x.y.z, in this case, if for example, we provide 1.63.0, we should search the latest release available for this version, in this case, 1.63.0.2.

Improve description of arguments and errors when using them incorrectly

Bug description

I think the options described when doing espup install -h could be improved a bit:

-e:
This description ends abruptly after ESP-IDF version to install. If empty, no esp-idf is installed. Version format: without actually specifying the possible formats. They are listed here, but they don't show up when running said command in a terminal. Also, the part If empty, no esp-idf is installed. made me think that I need to choose a version, in order to be able to use std. Perhaps the documentation could specify explicitly that this option can be left empty, and that esp-idf-sys will automatically take care of things (without having to install it in some other step). After reading this documentations a few times, l understand this now, but perhaps it could be made a bit more clear.

-m:
A few more details describing what the minimal installation entails would be nice.

-f:
Perhaps this is just me not interpreting things correctly, but the description Destination of the generated export file made me think that I could specify the directory, where the file should be placed. Turns out, that you need to specify the full path of the file, however.

This brings me to my next point, though. When specifying an invalid argument for -f, I would like a better error message. Currently, when specifying a directory instead of a file path, the program just fails with an Access denied. (os error 5). It would be nice if we could indicate that the specified path does not make for a valid file.

Further, it may be good to check the validity of the arguments earlier. Currently, the above mistake results in a partial installation and requires manual deletion of the installed toolchain before the installation can be restarted with a correct argument. This could be circumvented by validating the arguments before starting the installation.

Would you like to work on a fix? [y/n]

I don't have a lot of time to do spend on this right now, but I am willing to take a look, if nobody else wants to do it :)

To Reproduce

Steps to reproduce the behavior:

  • run espup install -h.
  • run espup install -f <DIR> where <DIR> is the path to a directory.

(Tested on the main branch)

Environment

  • OS: Windows 10 21H2
  • espup version: 0.2.5-dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.