ivmarkov / rust-esp32-std-demo

Rust on ESP32 STD demo app. A demo STD binary crate for the ESP32[XX] and ESP-IDF, which connects to WiFi, Ethernet, drives a small HTTP server and draws on a LED screen.
Apache License 2.0
784 stars 105 forks source link

rust-analyzer failed to run build scripts #84

Closed mdeloof closed 2 years ago

mdeloof commented 2 years ago

Compilation is successful but rust analyzer throws an error in VSCode. Is this expected behaviour or does rust analyzer need some further configuration in order to work?

Rust Analyzer Server Logs:

[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to run build scripts

error: failed to run custom build command for `esp-idf-sys v0.31.1`

Caused by:
  process didn't exit successfully: `/Users/maxim/Downloads/rust-esp32-std-demo/target/debug/build/esp-idf-sys-17bab936def69208/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  Found compatible PlatformIO Core 5.2.5 -> /Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/penv/bin/platformio
  cargo:rerun-if-changed=./patches/missing_riscv_atomics_fix.diff
  cargo:rerun-if-changed=./patches/missing_xtensa_atomics_fix.diff
  cargo:rerun-if-changed=./patches/pthread_destructor_fix.diff
  cargo:rerun-if-changed=/Users/maxim/Downloads/rust-esp32-std-demo/sdkconfig.defaults
  cargo:rerun-if-changed=/Users/maxim/Downloads/rust-esp32-std-demo/sdkconfig.defaults.ESP32
  cargo:rerun-if-changed=/Users/maxim/Downloads/rust-esp32-std-demo/sdkconfig.defaults.esp32
  cargo:rerun-if-changed=/Users/maxim/Downloads/rust-esp32-std-demo/sdkconfig.defaults.esp32s2
  Warning! Ignore unknown configuration option `patches` in section [env]
  Processing debug (board: esp32cam; platform: espressif32; framework: espidf)
  --------------------------------------------------------------------------------
  Verbose mode can be enabled via `-v, --verbose` option
  CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
  PLATFORM: Espressif 32 (4.2.0) > AI Thinker ESP32-CAM
  HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
  DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
  PACKAGES: 
   - framework-espidf 3.40302.0 (4.3.2) 
   - tool-cmake 3.16.4 
   - tool-esptoolpy 1.30300.0 (3.3.0) 
   - tool-ninja 1.9.0 
   - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
   - toolchain-xtensa-esp32 8.4.0+2021r2-patch3
  Reading CMake configuration...
  LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
  LDF Modes: Finder ~ chain, Compatibility ~ soft
  Found 0 compatible libraries
  Scanning dependencies...
  No dependencies
  Building in debug mode
  Retrieving maximum program size .pio/build/debug/firmware.elf
  Checking size .pio/build/debug/firmware.elf
  Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
  RAM:   [          ]   4.0% (used 12980 bytes from 327680 bytes)
  Flash: [==        ]  15.9% (used 166769 bytes from 1048576 bytes)
  ========================= [SUCCESS] Took 5.31 seconds =========================

  Environment    Status    Duration
  -------------  --------  ------------
  debug          SUCCESS   00:00:05.314
  ========================= 1 succeeded in 00:00:05.314 =========================
  cargo:rerun-if-changed=/Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.31.1/src/include/esp-idf/bindings.h

  --- stderr
  Output: "/Users/maxim/Downloads/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-fca8576a82006e93/out/bindings.rs"
  Bindgen builder flags: ["/Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.31.1/src/include/esp-idf/bindings.h", "--rust-target", "1.47", "--blocklist-function", "strtold", "--blocklist-function", "_strtold_r", "--blocklist-function", "v.*printf", "--blocklist-function", "v.*scanf", "--blocklist-function", "_v.*printf_r", "--blocklist-function", "_v.*scanf_r", "--blocklist-function", "esp_log_writev", "--no-layout-tests", "--with-derive-default", "--ctypes-prefix", "c_types", "--generate", "functions,types,vars,methods,constructors,destructors", "--use-core", "--no-rustfmt-bindings", "--", "-D__bindgen", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_pm/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/target/xtensa-esp32-espidf/debug/build/esp-idf-sys-fca8576a82006e93/out/esp-idf/.pio/build/debug/config", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/newlib/platform_include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/freertos/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/freertos/port/xtensa/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_hw_support/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_hw_support/port/esp32/.", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/heap/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/log/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/lwip/include/apps", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/lwip/include/apps/sntp", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/lwip/lwip/src/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/lwip/port/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/lwip/port/esp32/include/arch", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/soc/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/soc/esp32/.", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/soc/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/hal/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/hal/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_rom/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_rom/esp32", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_rom/include/esp32", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_common/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_system/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/driver/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/driver/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_ringbuf/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/efuse/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/efuse/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/xtensa/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/xtensa/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/espcoredump/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_timer/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_ipc/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/vfs/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_wifi/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_wifi/esp32/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_event/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_netif/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_eth/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/tcpip_adapter/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/app_trace/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/mbedtls/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/mbedtls/mbedtls/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/mbedtls/esp_crt_bundle/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/app_update/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/spi_flash/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/bootloader_support/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/nvs_flash/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/pthread/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/xtensa", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_gdbstub/esp32", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/wpa_supplicant/include/esp_supplicant", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/perfmon/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/asio/asio/asio/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/asio/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/cbor/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/unity/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/unity/unity/src", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/cmock/CMock/src", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/coap/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/coap/port/include/coap", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/coap/libcoap/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/coap/libcoap/include/coap2", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/console", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/nghttp/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/nghttp/nghttp2/lib/includes", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp-tls", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp-tls/esp-tls-crypto", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_adc_cal/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_hid/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/tcp_transport/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_http_client/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_http_server/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_https_ota/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/protobuf-c/protobuf-c", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/protocomm/include/common", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/protocomm/include/security", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/protocomm/include/transports", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/mdns/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_local_ctrl/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/sdmmc/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_serial_slave_link/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/esp_websocket_client/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/expat/expat/expat/lib", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/expat/port/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/wear_levelling/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/fatfs/diskio", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/fatfs/vfs", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/fatfs/src", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/freemodbus/common/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/idf_test/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/idf_test/include/esp32", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/jsmn/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/json/cJSON", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/libsodium/libsodium/src/libsodium/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/libsodium/port_include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/mqtt/esp-mqtt/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/openssl/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/spiffs/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/ulp/include", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/framework-espidf/components/wifi_provisioning/include", "-DESP_IDF_COMP_APP_UPDATE_ENABLED", "-DESP_IDF_COMP_CONSOLE_ENABLED", "-DESP_IDF_COMP_ESP_ADC_CAL_ENABLED", "-DESP_IDF_COMP_ESP_ETH_ENABLED", "-DESP_IDF_COMP_ESP_EVENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_CLIENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_SERVER_ENABLED", "-DESP_IDF_COMP_ESP_NETIF_ENABLED", "-DESP_IDF_COMP_ESP_PM_ENABLED", "-DESP_IDF_COMP_ESP_SERIAL_SLAVE_LINK_ENABLED", "-DESP_IDF_COMP_ESP_TIMER_ENABLED", "-DESP_IDF_COMP_ESP_TLS_ENABLED", "-DESP_IDF_COMP_ESP_WIFI_ENABLED", "-DESP_IDF_COMP_ESPCOREDUMP_ENABLED", "-DESP_IDF_COMP_FATFS_ENABLED", "-DESP_IDF_COMP_MDNS_ENABLED", "-DESP_IDF_COMP_MQTT_ENABLED", "-DESP_IDF_COMP_NVS_FLASH_ENABLED", "-DESP_IDF_COMP_SPI_FLASH_ENABLED", "-DESP_IDF_COMP_PTHREAD_ENABLED", "-DESP_IDF_COMP_SOC_ENABLED", "-DESP_IDF_COMP_SPIFFS_ENABLED", "-DESP_IDF_COMP_VFS_ENABLED", "-DESP_IDF_COMP_ESP_WIFI_PROVISIONING_ENABLED", "--sysroot=/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/toolchain-xtensa-esp32/bin/../xtensa-esp32-elf", "-I/Users/maxim/Downloads/rust-esp32-std-demo/.embuild/platformio/packages/toolchain-xtensa-esp32/bin/../xtensa-esp32-elf/include", "-x", "c", "-DESP_IDF_COMP_APP_UPDATE_ENABLED", "-DESP_IDF_COMP_CONSOLE_ENABLED", "-DESP_IDF_COMP_ESP_ADC_CAL_ENABLED", "-DESP_IDF_COMP_ESP_ETH_ENABLED", "-DESP_IDF_COMP_ESP_EVENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_CLIENT_ENABLED", "-DESP_IDF_COMP_ESP_HTTP_SERVER_ENABLED", "-DESP_IDF_COMP_ESP_NETIF_ENABLED", "-DESP_IDF_COMP_ESP_PM_ENABLED", "-DESP_IDF_COMP_ESP_SERIAL_SLAVE_LINK_ENABLED", "-DESP_IDF_COMP_ESP_TIMER_ENABLED", "-DESP_IDF_COMP_ESP_TLS_ENABLED", "-DESP_IDF_COMP_ESP_WIFI_ENABLED", "-DESP_IDF_COMP_ESPCOREDUMP_ENABLED", "-DESP_IDF_COMP_FATFS_ENABLED", "-DESP_IDF_COMP_MDNS_ENABLED", "-DESP_IDF_COMP_MQTT_ENABLED", "-DESP_IDF_COMP_NVS_FLASH_ENABLED", "-DESP_IDF_COMP_SPI_FLASH_ENABLED", "-DESP_IDF_COMP_PTHREAD_ENABLED", "-DESP_IDF_COMP_SOC_ENABLED", "-DESP_IDF_COMP_SPIFFS_ENABLED", "-DESP_IDF_COMP_VFS_ENABLED", "-DESP_IDF_COMP_ESP_WIFI_PROVISIONING_ENABLED", "-target", "xtensa"]
  error: unknown target triple 'xtensa', please use -triple or -arch
  thread 'main' panicked at 'libclang error; possible causes include:
  - Invalid flag syntax
  - Unrecognized flags
  - Invalid flag arguments
  - File I/O errors
  - Host vs. target architecture mismatch
  If you encounter an error missing from this list, please file an issue or a PR!', /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/ir/context.rs:538:15
  stack backtrace:
     0: _rust_begin_unwind
     1: core::panicking::panic_fmt
     2: core::panicking::panic_display
     3: core::panicking::panic_str
     4: core::option::expect_failed
     5: core::option::Option<T>::expect
               at /Users/githubrunner/esp-rs/_work/rust-build/rust-build/library/core/src/option.rs:715:21
     6: bindgen::ir::context::BindgenContext::new
               at /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/ir/context.rs:532:13
     7: bindgen::Bindings::generate
               at /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:2357:27
     8: bindgen::Builder::generate
               at /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.59.2/src/lib.rs:1478:9
     9: embuild::bindgen::run_for_file
               at /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/embuild-0.29.0/src/bindgen.rs:162:20
    10: embuild::bindgen::run
               at /Users/maxim/.cargo/registry/src/github.com-1ecc6299db9ec823/embuild-0.29.0/src/bindgen.rs:149:5
    11: build_script_build::main
               at ./build/build.rs:91:25
    12: core::ops::function::FnOnce::call_once
               at /Users/githubrunner/esp-rs/_work/rust-build/rust-build/library/core/src/ops/function.rs:227:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
mdeloof commented 2 years ago

Ok, found the issue. I had exported LIBCLANG_PATH inside my shell, so it was picked up when running cargo build, but not by rust-analyzer. Setting the environment variable in config.toml solved this.

[env]

LIBCLANG_PATH = { value = "/path/to/espressif/clang/lib/" }