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

It will show that python is not installed. #95

Closed
hakohumi opened this issue May 17, 2022 · 7 comments
Closed

It will show that python is not installed. #95

hakohumi opened this issue May 17, 2022 · 7 comments

Comments

@hakohumi
Copy link

https://github.com/esp-rs/esp-idf-template

I generated a project based on this site and ran cargo build and got the following.

C:\train-rust-esp32\test>cargo build      
   Compiling esp-idf-sys v0.31.5
error: failed to run custom build command for `esp-idf-sys v0.31.5`

Caused by:
  process didn't exit successfully: `C:\train-rust-esp32\test\target\debug\build\esp-idf-sys-579560c2cbc04aea\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=IDF_PATH
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_VERSION
  cargo:rerun-if-env-changed=ESP_IDF_REPOSITORY
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=MCU

  --- stderr
  Using custom user-supplied esp-idf repository at 'C:\Users\<user name>\esp\esp-idf' (detected from env variable `IDF_PATH`)
  Error: Could not install esp-idf

  Caused by:
      0: Failed to locate python. Is python installed and in your $PATH?
      1: command '"python" "--version"' failed to start
      2: program not found

Python is already installed.

C:\train-rust-esp32\test>where python
C:\Users\<user name>\.pyenv\pyenv-win\shims\python
C:\Users\<user name>\.pyenv\pyenv-win\shims\python.bat
@MabezDev
Copy link
Member

Using custom user-supplied esp-idf repository at 'C:\Users<user name>\esp\esp-idf' (detected from env variable IDF_PATH)

This is the offending line. You need to remove $IDF_PATH from your environment, unless you are using a properly activated environment (running export.sh inside esp-idf).

@N3xed
Copy link
Collaborator

N3xed commented May 17, 2022

Does running python --version succeed? If it does, this is strange indeed.

@hakohumi
Copy link
Author

hakohumi commented May 18, 2022

The .cargo/config.toml looks like this

[build]
# Uncomment the relevant target for your chip here (ESP32, ESP32-S2, ESP32-S3 or ESP32-C3)
target = "xtensa-esp32-espidf"
#target = "xtensa-esp32s2-espidf"
#target = "xtensa-esp32s3-espidf"
#target = "riscv32imc-esp-espidf"

[target.xtensa-esp32-espidf]
linker = "ldproxy"

[target.xtensa-esp32s2-espidf]
linker = "ldproxy"

[target.xtensa-esp32s3-espidf]
linker = "ldproxy"

[target.riscv32imc-esp-espidf]
linker = "ldproxy"

# Future - necessary for the experimental "native build" of esp-idf-sys with ESP32C3
# See also https://github.com/ivmarkov/embuild/issues/16
rustflags = ["-C", "default-linker-libraries"]

[unstable]

build-std = ["std", "panic_abort"]
#build-std-features = ["panic_immediate_abort"] # Required for older ESP-IDF versions without a realpath implementation

[env]
# Note: these variables are not used when using pio builder
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF stable (v4.4)
# ESP_IDF_VERSION = { value = "branch:release/v4.4" }
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF master (mainline)
#ESP_IDF_VERSION = { value = "master" }
IDF_PATH = "C:\\Users\\<user name>\\esp\\esp-idf"
ESP_IDF_TOOLS_INSTALL_DIR = "custom:C:\\Users\\<user name>\\.espressif"
# ESP_IDF_REPOSITORY = "https://github.com/espressif/esp-idf.git"
# ESP_IDF_SDKCONFIG_DEFAULTS = ""
# ESP_IDF_SDKCONFIG = ""
MCU = "esp32"

I added the [env] part with reference to the README.md of esp-idf-sys.

Before I added this, I was getting errors like this.


C:\train-rust-esp32\test>cargo build
    Updating crates.io index
   Compiling winapi v0.3.9                                                                      
   Compiling compiler_builtins v0.1.70
   Compiling core v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\core)
   Compiling cfg-if v1.0.0
   Compiling proc-macro2 v1.0.39
   Compiling autocfg v1.1.0
   Compiling unicode-ident v1.0.0
   Compiling memchr v2.5.0
   Compiling lazy_static v1.4.0
   Compiling syn v1.0.95
   Compiling crossbeam-utils v0.8.8
   Compiling log v0.4.17
   Compiling regex-syntax v0.6.25
   Compiling glob v0.3.0
   Compiling libc v0.2.126
   Compiling scopeguard v1.1.0
   Compiling serde_derive v1.0.137
   Compiling rayon-core v1.9.3
   Compiling either v1.6.1
   Compiling rustversion v1.0.6
   Compiling serde v1.0.137
   Compiling bitflags v1.3.2
   Compiling unicode-width v0.1.9
   Compiling fnv v1.0.7
   Compiling libc v0.2.120
   Compiling num_cpus v1.13.1
   Compiling minimal-lexical v0.2.1
   Compiling once_cell v1.10.0
   Compiling bindgen v0.59.2
   Compiling anyhow v1.0.57
   Compiling strsim v0.8.0
   Compiling heck v0.4.0
   Compiling serde_json v1.0.81
   Compiling vec_map v0.8.2
   Compiling humantime v2.1.0
   Compiling peeking_take_while v0.1.2
   Compiling shlex v1.1.0
   Compiling cc v1.0.69
   Compiling lazycell v1.3.0
   Compiling ryu v1.0.10
   Compiling rustc-hash v1.1.0
   Compiling fastrand v1.7.0
   Compiling itoa v1.0.2
   Compiling zero v0.1.2
   Compiling cc v1.0.73
   Compiling memchr v2.4.1
   Compiling std v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\std)
   Compiling paste v1.0.7
   Compiling memoffset v0.6.5
   Compiling crossbeam-epoch v0.9.8
   Compiling rayon v1.5.3
   Compiling textwrap v0.11.0
   Compiling clang-sys v1.3.1
   Compiling thread_local v1.1.4
   Compiling xmas-elf v0.8.0
   Compiling cmake v0.1.48
   Compiling crossbeam-channel v0.5.4
   Compiling quote v1.0.18
   Compiling aho-corasick v0.7.18
   Compiling bstr v0.2.17
   Compiling nom v7.1.1
   Compiling unwind v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\unwind)
   Compiling which v4.2.5
   Compiling regex v1.5.5
   Compiling crossbeam-deque v0.8.1
   Compiling globset v0.4.8
   Compiling cexpr v0.6.0
   Compiling winapi-util v0.1.5
   Compiling atty v0.2.14
   Compiling libloading v0.7.3
   Compiling remove_dir_all v0.5.3
   Compiling dirs-sys v0.3.7
   Compiling same-file v1.0.6
   Compiling termcolor v1.1.3
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling clap v2.34.0
   Compiling tempfile v3.3.0
   Compiling dirs v4.0.0
   Compiling walkdir v2.3.2
   Compiling env_logger v0.9.0
   Compiling remove_dir_all v0.7.0
   Compiling ignore v0.4.18
   Compiling alloc v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\alloc)
   Compiling cfg-if v0.1.10
   Compiling adler v0.2.3
   Compiling rustc-demangle v0.1.21
   Compiling strum_macros v0.24.0
   Compiling thiserror-impl v1.0.31
   Compiling globwalk v0.8.1
   Compiling rustc-std-workspace-alloc v1.99.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\panic_abort)
   Compiling panic_unwind v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\panic_unwind)
   Compiling gimli v0.25.0
   Compiling std_detect v0.1.5 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\stdarch\crates\std_detect)
   Compiling object v0.26.2
   Compiling hashbrown v0.12.0
   Compiling miniz_oxide v0.4.0
   Compiling thiserror v1.0.31
   Compiling strum v0.24.0
   Compiling addr2line v0.16.0
   Compiling toml v0.5.9
   Compiling proc_macro v0.0.0 (C:\Users\<user name>\.rustup\toolchains\esp\lib\rustlib\src\rust\library\proc_macro)
   Compiling embuild v0.29.1
   Compiling esp-idf-sys v0.31.5
   Compiling test v0.1.0 (C:\train-rust-esp32\test)
error: failed to run custom build command for `esp-idf-sys v0.31.5`

Caused by:
  process didn't exit successfully: `C:\train-rust-esp32\test\target\debug\build\esp-idf-sys-579560c2cbc04aea\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=IDF_PATH
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_VERSION
  cargo:rerun-if-env-changed=ESP_IDF_REPOSITORY
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=MCU
  Submodule path 'components/asio/asio': checked out 'f31694c9f1746ba189a4bcae2e34db15135ddb22' 
  Submodule path 'components/bootloader/subproject/components/micro-ecc/micro-ecc': checked out 
'd037ec89546fad14b5c4d5456c2e23a71e554966'
  Submodule path 'components/bt/controller/lib_esp32': checked out 'b877f7e1fc98dccfcf4dbf31f215c5cb44ec3f0d'
  Submodule path 'components/bt/controller/lib_esp32c3_family': checked out '98dcc9591365b5ac486a9f0b474c36bf8c4ca97b'
  Submodule path 'components/bt/host/nimble/nimble': checked out '1dc1ec6e76b0ab3bf93cc9f1ff7a2a09141e7c61'
  Submodule path 'components/cbor/tinycbor': checked out '7c349dbb6b8d76db39383b226d3ebdf59b8ab37d'
  Submodule path 'components/cmock/CMock': checked out 'eeecc49ce8af123cf8ad40efdb9673e37b56230f'
  Submodule path 'components/cmock/CMock/vendor/c_exception': checked out '71b47be7c950f1bf5f7e5303779fa99a16224bb6'
  Submodule path 'components/cmock/CMock/vendor/unity': checked out 'cf949f45ca6d172a177b00da21310607b97bc7a7'
  Submodule path 'components/coap/libcoap': checked out '3aa11612c143c9734d72022720f33e12506f7a2c'
  Submodule path 'components/coap/libcoap/ext/tinydtls': checked out '59055b8a935bc53bf69d002fc089ad4bd08851b2'
  Submodule path 'components/esp_phy/lib': checked out '97e9e8992ea947fa46bc35545000b2c45d7b3060'
  Submodule path 'components/esp_wifi/lib': checked out '595b2d73a96eff9847d697a9f1695e44623e4061'
  Submodule path 'components/esptool_py/esptool': checked out 'aca9d70bd810c25bc953ca2f7587892c4dbaffc4'
  Submodule path 'components/expat/expat': checked out '57c7da69b78e3698e112a6b5da19d5109b8232d1'
  Submodule path 'components/ieee802154/lib': checked out 'f7b5e8059a3bb6f321e79ac3bf2aa4d2a9b93326'
  Submodule path 'components/json/cJSON': checked out 'd348621ca93571343a56862df7de4ff3bc9b5667'  Submodule path 'components/libsodium/libsodium': checked out '4f5e89fa84ce1d178a6765b8b46f2b6f91216677'
  Submodule path 'components/lwip/lwip': checked out '76303df2386902e0d7873be4217f1d9d1b50f982' 
  Submodule path 'components/mbedtls/mbedtls': checked out '8b0e35f2ad477fcc2a267cf434528024b8499085'
  Submodule path 'components/mqtt/esp-mqtt': checked out '985078affa8a2d2b56b87c8e6455252850f895c6'
  Submodule path 'components/nghttp/nghttp2': checked out '8f7b008b158e12de0e58247afd170f127dbb6456'
  Submodule path 'components/nghttp/nghttp2/third-party/mruby': checked out '7c91efc1ffda769a5f1a872c646c82b00698f1b8'
  Submodule path 'components/nghttp/nghttp2/third-party/neverbleed': checked out 'b967ca054f48a36f82d8fcdd32e54ec5144f2751'
  Submodule path 'components/openthread/lib': checked out '9a8d34d8f698cad2c9468468b473e26a3dda51b9'
  Submodule path 'components/openthread/openthread': checked out 'c36c0e77a2465355bcf13bd7dc718d8c9aa6ff64'
  Submodule path 'components/protobuf-c/protobuf-c': checked out 'dac1a65feac4ad72f612aab99f487056fbcf5c1a'
  Submodule path 'components/spiffs/spiffs': checked out 'f5e26c4e933189593a71c6b82cda381a7b21e41c'
  Submodule path 'components/tinyusb/tinyusb': checked out 'c4badd394eda18199c0196ed0be1e2d635f0a5f6'
  Submodule path 'components/unity/unity': checked out '7d2bf62b7e6afaf38153041a9d53c21aeeca9a25'
  Submodule path 'examples/build_system/cmake/import_lib/main/lib/tinyxml2': checked out '7e8e249990ec491ec15990cf95b6d871a66cf64a'
  Submodule path 'examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib': checked out '36d0642e66ff5b1c7a291873f24c498ca6ffedef'

  --- stderr
  Using managed esp-idf repository: EspIdfRemote { repo_url: None, git_ref: Branch("release/v4.4") }
  Cloning into 'C:\train-rust-esp32\test\.embuild\espressif\esp-idf\release-v4.4'... 
Updating files: 100% (9639/9639), done.
  Submodule 'components/asio/asio' (https://github.com/espressif/asio.git) registered for path 'components/asio/asio'
  Submodule 'components/bootloader/subproject/components/micro-ecc/micro-ecc' (https://github.com/kmackay/micro-ecc.git) registered for path 'components/bootloader/subproject/components/micro-ecc/micro-ecc'
  Submodule 'components/bt/controller/lib_esp32' (https://github.com/espressif/esp32-bt-lib.git) registered for path 'components/bt/controller/lib_esp32'
  Submodule 'components/bt/controller/lib_esp32c3_family' (https://github.com/espressif/esp32c3-bt-lib.git) registered for path 'components/bt/controller/lib_esp32c3_family'
  Submodule 'components/bt/host/nimble/nimble' (https://github.com/espressif/esp-nimble.git) registered for path 'components/bt/host/nimble/nimble'
  Submodule 'components/cbor/tinycbor' (https://github.com/intel/tinycbor.git) registered for path 'components/cbor/tinycbor'
  Submodule 'components/cmock/CMock' (https://github.com/ThrowTheSwitch/CMock.git) registered for path 'components/cmock/CMock'
  Submodule 'components/coap/libcoap' (https://github.com/obgm/libcoap.git) registered for path 
'components/coap/libcoap'
  Submodule 'components/esp_phy/lib' (https://github.com/espressif/esp-phy-lib.git) registered for path 'components/esp_phy/lib'
  Submodule 'components/esp_wifi/lib' (https://github.com/espressif/esp32-wifi-lib.git) registered for path 'components/esp_wifi/lib'
  Submodule 'components/esptool_py/esptool' (https://github.com/espressif/esptool.git) registered for path 'components/esptool_py/esptool'
  Submodule 'components/expat/expat' (https://github.com/libexpat/libexpat.git) registered for path 'components/expat/expat'
  Submodule 'components/ieee802154/lib' (https://github.com/espressif/esp-ieee802154-lib.git) registered for path 'components/ieee802154/lib'
  Submodule 'components/json/cJSON' (https://github.com/DaveGamble/cJSON.git) registered for path 'components/json/cJSON'
  Submodule 'components/libsodium/libsodium' (https://github.com/jedisct1/libsodium.git) registered for path 'components/libsodium/libsodium'
  Submodule 'components/lwip/lwip' (https://github.com/espressif/esp-lwip.git) registered for path 'components/lwip/lwip'
  Submodule 'components/mbedtls/mbedtls' (https://github.com/espressif/mbedtls.git) registered for path 'components/mbedtls/mbedtls'
  Submodule 'components/mqtt/esp-mqtt' (https://github.com/espressif/esp-mqtt.git) registered for path 'components/mqtt/esp-mqtt'
  Submodule 'components/nghttp/nghttp2' (https://github.com/nghttp2/nghttp2.git) registered for 
path 'components/nghttp/nghttp2'
  Submodule 'components/openthread/lib' (https://github.com/espressif/esp-thread-lib.git) registered for path 'components/openthread/lib'
  Submodule 'components/openthread/openthread' (https://github.com/espressif/openthread.git) registered for path 'components/openthread/openthread'
  Submodule 'components/protobuf-c/protobuf-c' (https://github.com/protobuf-c/protobuf-c.git) registered for path 'components/protobuf-c/protobuf-c'
  Submodule 'components/spiffs/spiffs' (https://github.com/pellepl/spiffs.git) registered for path 'components/spiffs/spiffs'
  Submodule 'components/tinyusb/tinyusb' (https://github.com/espressif/tinyusb.git) registered for path 'components/tinyusb/tinyusb'
  Submodule 'components/unity/unity' (https://github.com/ThrowTheSwitch/Unity.git) registered for path 'components/unity/unity'
  Submodule 'examples/build_system/cmake/import_lib/main/lib/tinyxml2' (https://github.com/leethomason/tinyxml2.git) registered for path 'examples/build_system/cmake/import_lib/main/lib/tinyxml2'
  Submodule 'examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib' (https://github.com/espressif/esp-cryptoauthlib.git) registered for path 'examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib'
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/asio/asio'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/bootloader/subproject/components/micro-ecc/micro-ecc'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/bt/controller/lib_esp32'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/bt/controller/lib_esp32c3_family'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/bt/host/nimble/nimble'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/cbor/tinycbor'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/cmock/CMock'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/coap/libcoap'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/esp_phy/lib'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/esp_wifi/lib'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/esptool_py/esptool'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/expat/expat'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/ieee802154/lib'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/json/cJSON'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/libsodium/libsodium'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/lwip/lwip'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/mbedtls/mbedtls'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/mqtt/esp-mqtt'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/nghttp/nghttp2'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/openthread/lib'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/openthread/openthread'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/protobuf-c/protobuf-c'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/spiffs/spiffs'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/tinyusb/tinyusb'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/unity/unity'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/examples/build_system/cmake/import_lib/main/lib/tinyxml2'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib'...
  From https://github.com/espressif/asio
   * branch            f31694c9f1746ba189a4bcae2e34db15135ddb22 -> FETCH_HEAD
  From https://github.com/kmackay/micro-ecc
   * branch            d037ec89546fad14b5c4d5456c2e23a71e554966 -> FETCH_HEAD
  From https://github.com/espressif/esp-nimble
   * branch            1dc1ec6e76b0ab3bf93cc9f1ff7a2a09141e7c61 -> FETCH_HEAD
  From https://github.com/intel/tinycbor
   * branch            7c349dbb6b8d76db39383b226d3ebdf59b8ab37d -> FETCH_HEAD
  From https://github.com/ThrowTheSwitch/CMock
   * branch            eeecc49ce8af123cf8ad40efdb9673e37b56230f -> FETCH_HEAD
  Submodule 'vendor/c_exception' (https://github.com/throwtheswitch/cexception.git) registered for path 'components/cmock/CMock/vendor/c_exception'
  Submodule 'vendor/unity' (https://github.com/throwtheswitch/unity.git) registered for path 'components/cmock/CMock/vendor/unity'
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/cmock/CMock/vendor/c_exception'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/cmock/CMock/vendor/unity'...
  From https://github.com/throwtheswitch/cexception
   * branch            71b47be7c950f1bf5f7e5303779fa99a16224bb6 -> FETCH_HEAD
  From https://github.com/throwtheswitch/unity
   * branch            cf949f45ca6d172a177b00da21310607b97bc7a7 -> FETCH_HEAD
  From https://github.com/obgm/libcoap
   * branch            3aa11612c143c9734d72022720f33e12506f7a2c -> FETCH_HEAD
  Submodule 'ext/tinydtls' (https://github.com/eclipse/tinydtls.git) registered for path 'components/coap/libcoap/ext/tinydtls'
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/coap/libcoap/ext/tinydtls'...
  From https://github.com/eclipse/tinydtls
   * branch            59055b8a935bc53bf69d002fc089ad4bd08851b2 -> FETCH_HEAD
  From https://github.com/espressif/esp-phy-lib
   * branch            97e9e8992ea947fa46bc35545000b2c45d7b3060 -> FETCH_HEAD
  From https://github.com/espressif/esp32-wifi-lib
   * branch            595b2d73a96eff9847d697a9f1695e44623e4061 -> FETCH_HEAD
  From https://github.com/espressif/esptool
   * branch            aca9d70bd810c25bc953ca2f7587892c4dbaffc4 -> FETCH_HEAD
  From https://github.com/libexpat/libexpat
   * branch            57c7da69b78e3698e112a6b5da19d5109b8232d1 -> FETCH_HEAD
  From https://github.com/espressif/esp-ieee802154-lib
   * branch            f7b5e8059a3bb6f321e79ac3bf2aa4d2a9b93326 -> FETCH_HEAD
  From https://github.com/DaveGamble/cJSON
   * branch            d348621ca93571343a56862df7de4ff3bc9b5667 -> FETCH_HEAD
  From https://github.com/jedisct1/libsodium
   * branch            4f5e89fa84ce1d178a6765b8b46f2b6f91216677 -> FETCH_HEAD
  From https://github.com/espressif/esp-lwip
   * branch            76303df2386902e0d7873be4217f1d9d1b50f982 -> FETCH_HEAD
  From https://github.com/espressif/mbedtls
   * branch            8b0e35f2ad477fcc2a267cf434528024b8499085 -> FETCH_HEAD
  From https://github.com/espressif/esp-mqtt
   * branch            985078affa8a2d2b56b87c8e6455252850f895c6 -> FETCH_HEAD
  From https://github.com/nghttp2/nghttp2
   * branch            8f7b008b158e12de0e58247afd170f127dbb6456 -> FETCH_HEAD
  Submodule 'third-party/mruby' (https://github.com/mruby/mruby) registered for path 'components/nghttp/nghttp2/third-party/mruby'
  Submodule 'third-party/neverbleed' (https://github.com/tatsuhiro-t/neverbleed.git) registered 
for path 'components/nghttp/nghttp2/third-party/neverbleed'
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/nghttp/nghttp2/third-party/mruby'...
  Cloning into 'C:/train-rust-esp32/test/.embuild/espressif/esp-idf/release-v4.4/components/nghttp/nghttp2/third-party/neverbleed'...
  From https://github.com/mruby/mruby
   * branch            7c91efc1ffda769a5f1a872c646c82b00698f1b8 -> FETCH_HEAD
  From https://github.com/tatsuhiro-t/neverbleed
   * branch            b967ca054f48a36f82d8fcdd32e54ec5144f2751 -> FETCH_HEAD
  From https://github.com/espressif/esp-thread-lib
   * branch            9a8d34d8f698cad2c9468468b473e26a3dda51b9 -> FETCH_HEAD
  From https://github.com/espressif/openthread
   * branch            c36c0e77a2465355bcf13bd7dc718d8c9aa6ff64 -> FETCH_HEAD
  From https://github.com/protobuf-c/protobuf-c
   * branch            dac1a65feac4ad72f612aab99f487056fbcf5c1a -> FETCH_HEAD
  From https://github.com/pellepl/spiffs
   * branch            f5e26c4e933189593a71c6b82cda381a7b21e41c -> FETCH_HEAD
  From https://github.com/espressif/tinyusb
   * branch            c4badd394eda18199c0196ed0be1e2d635f0a5f6 -> FETCH_HEAD
  From https://github.com/ThrowTheSwitch/Unity
   * branch            7d2bf62b7e6afaf38153041a9d53c21aeeca9a25 -> FETCH_HEAD
  From https://github.com/leethomason/tinyxml2
   * branch            7e8e249990ec491ec15990cf95b6d871a66cf64a -> FETCH_HEAD
  From https://github.com/espressif/esp-cryptoauthlib
   * branch            36d0642e66ff5b1c7a291873f24c498ca6ffedef -> FETCH_HEAD
  Error: Could not install esp-idf

  Caused by:
      0: Failed to locate python. Is python installed and in your $PATH?
      1: command '"python" "--version"' failed to start
      2: program not found

Because of the "Could not install esp-idf" message, I had to specify the path to the esp-idf installed in VSCode's "Espressif IDF".

python --version

C:\train-rust-esp32\test>python --version
Python 3.10.2

@hakohumi
Copy link
Author

hakohumi commented May 18, 2022

.cargo/config.toml

The config.toml is used as the project is newly created.

~~~

[env]
# Note: these variables are not used when using pio builder
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF stable (v4.4)
ESP_IDF_VERSION = { value = "branch:release/v4.4" }
# Enables the esp-idf-sys "native" build feature (`cargo build --features native`) to build against ESP-IDF master (mainline)
#ESP_IDF_VERSION = { value = "master" }

Backtrace of cargo build


C:\train-rust-esp32\test>cargo +esp build 
   Compiling esp-idf-sys v0.31.5
error: failed to run custom build command for `esp-idf-sys v0.31.5`

Caused by:
  process didn't exit successfully: `C:\train-rust-esp32\test\target\debug\build\esp-idf-sys-579560c2cbc04aea\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=IDF_PATH
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_VERSION
  cargo:rerun-if-env-changed=ESP_IDF_REPOSITORY
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=MCU

  --- stderr
  Using managed esp-idf repository: EspIdfRemote { repo_url: None, git_ref: Branch("release/v4.4") }
  Error: Could not install esp-idf

  Caused by:
      0: Failed to locate python. Is python installed and in your $PATH?
      1: command '"python" "--version"' failed to start
      2: program not found

  Stack backtrace:
     0: std::backtrace_rs::backtrace::trace_unsynchronized
     1: std::backtrace::Backtrace::capture
     2: std::backtrace::Backtrace::capture
     3: anyhow::context::ext::impl$0::ext_context<enum$<embuild::utils::CmdError>,str>
               at C:\Users\<user name>\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\anyhow-1.0.57\src\context.rs:27
     4: anyhow::context::impl$0::context::closure$0<alloc::string::String,enum$<embuild::utils::CmdError>,str>
               at C:\Users\<user name>\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\anyhow-1.0.57\src\context.rs:50
     5: enum$<core::result::Result<alloc::string::String,enum$<embuild::utils::CmdError> > >::map_err<alloc::string::String,enum$<embuild::utils::CmdError>,anyhow::Error,anyhow::context::impl$0::context::closure_env$0<alloc::string::String,enum$<embuild::utils::C
               at R:\library\core\src\result.rs:842
     6: anyhow::context::impl$0::context<alloc::string::String,enum$<embuild::utils::CmdError>,str>
               at C:\Users\<user name>\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\anyhow-1.0.57\src\context.rs:50
     7: embuild::python::check_python_at_least
               at C:\Users\<user name>\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\embuild-0.29.1\src\python.rs:12
     8: embuild::espidf::Installer::install
               at C:\Users\<user name>\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\embuild-0.29.1\src\espidf.rs:473
     9: build_script_build::build_driver::build_cargo_first::closure$1
               at .\build\native.rs:187
    10: build_script_build::build_driver::build_cargo_first
               at .\build\native.rs:220
    11: build_script_build::build_driver::build
               at .\build\native.rs:45
    12: build_script_build::main
               at .\build\build.rs:46
    13: core::ops::function::FnOnce::call_once<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> (*)(),tuple$<> >
               at R:\library\core\src\ops\function.rs:227
    14: std::sys_common::backtrace::__rust_begin_short_backtrace<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> (*)(),enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> >
               at R:\library\std\src\sys_common\backtrace.rs:122
    15: std::rt::lang_start::closure$0<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> >
               at R:\library\std\src\rt.rs:145
    16: std::panic::catch_unwind
    17: std::rt::lang_start_internal
    18: std::rt::lang_start<enum$<core::result::Result<tuple$<>,anyhow::Error>, 1, 18446744073709551615, Err> >
               at R:\library\std\src\rt.rs:144
    19: main
    20: invoke_main
               at d:\a01\_work\20\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    21: __scrt_common_main_seh
               at d:\a01\_work\20\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    22: BaseThreadInitThunk
    23: RtlUserThreadStart

C:\train-rust-esp32\test>

@hakohumi
Copy link
Author

I was able to build successfully

What we did

Installed Python 3.10.4 with the official Python installer.
Select "Add to PATH" during installation.

C:\train-rust-esp32\test>python --version
Python 3.10.4

C:\train-rust-esp32\test>where python
C:\Users\<user name>\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\<user name>\.pyenv\pyenv-win\shims\python
C:\Users\<user name>\.pyenv\pyenv-win\shims\python.bat

Build log

C:\train-rust-esp32\test>cargo build
   Compiling bindgen v0.59.2
   Compiling embuild v0.29.1
   Compiling esp-idf-sys v0.31.5
   Compiling test v0.1.0 (C:\train-rust-esp32\test)
    Finished dev [optimized + debuginfo] target(s) in 1m 00s

I was using pytnon with pyenv-win, but found that this does not work.

I don't know why I shouldn't have to install a new one, since the path should be through pyenv alone.

Was the problem with embuild in the first place, rather than esp-idf-sys...?

@MabezDev
Copy link
Member

I just looked at the pyenv docs, it seems like it adds a $PATH entry to the user $PATH, whereas I think the python installer uses the system $PATH. That's my best guess, but python on windows is somewhat wonky 😅. Glad you managed to get it built, closing for now :).

@N3xed
Copy link
Collaborator

N3xed commented May 18, 2022

I was using python with pyenv-win, but found that this does not work.

I don't know why I shouldn't have to install a new one, since the path should be through pyenv alone.

I can only speculate as I don't know how pyenv-win does its python shims. This issue relates to how we run python (for example in the embuild::python::check_python_at_least function).

Currently, we use the std::process::Command API and it's not really documented how that API deals with file extensions on Windows. But from reading the code and going though some issues it may be that it actually always adds a .exe extension if the program has no file extension (in our case we use just python as the program path) (see rust-lang/rust#37519, rust-lang/cargo#10455 and stdlib impl).

So even though there is python and python.bat in $PATH it actually runs python.exe which is not found and fails.

I just looked at the pyenv docs, it seems like it adds a $PATH entry to the user $PATH, whereas I think the python installer uses the system $PATH.

That shouldn't be an issue, at least this SuperUser answer says that the system $PATH is prepended to the user $PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants