fortanix / rust-mbedtls

Idiomatic Rust wrapper for MbedTLS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to build for ESP-IDF target

stevefan1999-personal opened this issue · comments

--- stderr
  System is unknown to cmake, create:
  Platform/espidf to use this system, please post your config file on discourse.cmake.org so it can be added to cmake
  Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please post that file on discourse.cmake.org.
  /home/steve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mbedtls-sys-auto-3.5.0-alpha.3+0b3de6f/vendor/library/entropy_poll.c:45:2: error: #error "Platform entropy sources only work on Unix and Windows, see MBEDTLS_NO_PLATFORM_ENTROPY in mbedtls_config.h"
     45 | #error \
        |  ^~~~~
  gmake[3]: *** [library/CMakeFiles/mbedcrypto.dir/build.make:550: library/CMakeFiles/mbedcrypto.dir/entropy_poll.c.obj] Error 1
  gmake[3]: *** Waiting for unfinished jobs....
  gmake[2]: *** [CMakeFiles/Makefile2:166: library/CMakeFiles/mbedcrypto.dir/all] Error 2
  gmake[1]: *** [CMakeFiles/Makefile2:254: library/CMakeFiles/lib.dir/rule] Error 2
  gmake: *** [Makefile:221: lib] Error 2
  thread 'main' panicked at /home/steve/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 2

Hmm, it seems like we can't find a way to include the newlib headers on ESP-IDF since it is version dependent. This is going to be a headache

Well, it seems like we does accounted for cross compilation. However --print-sysroot returned an empty result. This is gotta be interesting...

Meanwhile setting your own cross-compiler CFLAGS should be okay...

export CFLAGS_riscv32imc_esp_espidf='-I /home/steve/.rustup/toolchains/esp/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/riscv32-esp-elf/sys-include'