visual studio code and esp-idf problem, cannot compile using idf.py build and visual studio ESP-IDF extension

akmishra99
Posts: 7
Joined: Sat Mar 07, 2020 5:48 pm

visual studio code and esp-idf problem, cannot compile using idf.py build and visual studio ESP-IDF extension

Postby akmishra99 » Thu Mar 07, 2024 4:15 am

I installed visual studio code and ESP-IDF extension and I am having problem in running

idf.py build in hello world directory , I am on Mac mini apple silicon and I am getting following error (also in visual studio code)




-- Build files have been written to: /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build
[1/169] Generating x509_crt_bundle
FAILED: esp-idf/mbedtls/x509_crt_bundle /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build/esp-idf/mbedtls/x509_crt_bundle
cd /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build/esp-idf/mbedtls && /Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/bin/python /Users/akmishra/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py --input /Users/akmishra/esp/esp-idf/components/mbedtls/esp_crt_bundle/cacrt_all.pem /Users/akmishra/esp/esp-idf/components/mbedtls/esp_crt_bundle/cacrt_local.pem -q
ImportError: dlopen(/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 0x0002): tried: '/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (no such file), '/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.3/src/err/mod.rs:788:5:
Python API call failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/Users/akmishra/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 25, in <module>
from cryptography import x509
File "/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency, verification
File "/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py", line 11, in <module>
from cryptography.hazmat.bindings._rust import x509 as rust_x509
pyo3_runtime.PanicException: Python API call failed
[2/169] Performing build step for 'bootloader'
[0/1] Re-running CMake...
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
-- Adding linker script /Users/akmishra/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Bootloader project name: "bootloader" version: 1
-- Adding linker script /Users/akmishra/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /Users/akmishra/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /Users/akmishra/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /Users/akmishra/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /Users/akmishra/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /Users/akmishra/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_bootloader_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /Users/akmishra/esp/esp-idf/components/bootloader /Users/akmishra/esp/esp-idf/components/bootloader_support /Users/akmishra/esp/esp-idf/components/efuse /Users/akmishra/esp/esp-idf/components/esp_app_format /Users/akmishra/esp/esp-idf/components/esp_bootloader_format /Users/akmishra/esp/esp-idf/components/esp_common /Users/akmishra/esp/esp-idf/components/esp_hw_support /Users/akmishra/esp/esp-idf/components/esp_rom /Users/akmishra/esp/esp-idf/components/esp_system /Users/akmishra/esp/esp-idf/components/esptool_py /Users/akmishra/esp/esp-idf/components/freertos /Users/akmishra/esp/esp-idf/components/hal /Users/akmishra/esp/esp-idf/components/log /Users/akmishra/esp/esp-idf/components/bootloader/subproject/main /Users/akmishra/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /Users/akmishra/esp/esp-idf/components/newlib /Users/akmishra/esp/esp-idf/components/partition_table /Users/akmishra/esp/esp-idf/components/soc /Users/akmishra/esp/esp-idf/components/spi_flash /Users/akmishra/esp/esp-idf/components/xtensa
-- Configuring done (4.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build/bootloader
[1/1] cd /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build/bootloader/esp-idf/esptool_py && /Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/bin/python /Users/akmishra/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /Users/akmishra/esp/esp-idf/examples/get-started/hello_world/build/bootloader/bootloader.bin
Bootloader binary size 0x6870 bytes. 0x790 bytes (7%) free.
ninja: build stopped: subcommand failed.

* The terminal process "/bin/zsh '-l', '-c', 'ninja '" terminated with exit code: 1.

akmishra99
Posts: 7
Joined: Sat Mar 07, 2020 5:48 pm

Re: visual studio code and esp-idf problem, cannot compile using idf.py build and visual studio ESP-IDF extension

Postby akmishra99 » Fri Mar 08, 2024 2:03 am

I also found following error message


ImportError: dlopen(/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so, 0x0002): tried: '/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (no such file), '/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/_cffi_backend.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.20.3/src/err/mod.rs:788:5:
Python API call failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/Users/akmishra/esp/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py", line 25, in <module>
from cryptography import x509
File "/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency, verification
File "/Users/akmishra/.espressif/python_env/idf5.3_py3.9_env/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py", line 11, in <module>
from cryptography.hazmat.bindings._rust import x509 as rust_x509
pyo3_runtime.PanicException: Python API call failed
ninja: build stopped: subcommand failed.

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: visual studio code and esp-idf problem, cannot compile using idf.py build and visual studio ESP-IDF extension

Postby ESP_Roland » Fri Mar 08, 2024 8:18 am

Could you please install a Python with Homebrew or Macports and use it during the installation process to set up the environment? The one you are using have trouble to detect your architecture. You can see in your logs that the following error is repeating.

Code: Select all

(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

Who is online

Users browsing this forum: No registered users and 348 guests