Page 1 of 1

Issues when trying to integrate rust with existing c project

Posted: Thu Dec 18, 2025 8:35 pm
by jbsimon000
For learning purposes, I am trying to integrate rust with an existing c project, using the rust standard library
(without trying to use the standard library I get it to build and execute on my hardware)

Development system is ubuntu.

$ lsb_release -a

Code: Select all

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.3 LTS
Release:        24.04
Codename:       noble
When I run idf.py build I get...

Code: Select all

  Tool doesn't match supported version from list ['esp-15.1.0_20250607']:
  /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc


  Please try to run 'idf.py fullclean' to solve it.
I think this means that it is expecting a different version of esp idf than I am using ?
(I tried running the "fullclean' but it made no difference, still the same error).

$ idf.py --version

Code: Select all

ESP-IDF v6.0-dev-2039-g2044fba6e7-dirty
The esp-15... appears to be coming from export-esp.sh which I think was generated by rustup

cat ~/export-esp.sh

Code: Select all

export PATH="/home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin:$PATH"
export LIBCLANG_PATH="/home/users/joe/.rustup/toolchains/esp/xtensa-esp32-elf-clang/esp-20.1.1_20250829/esp-clang/lib"
$ ls /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/

Code: Select all

esp-15.2.0_20250920
if I run cargo build from the rust_crate it appears to build.

/components/esp_rust_component/rust_crate$ cargo build -Z build-std=std,panic_abort

Code: Select all

    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.06s

Re: Issues when trying to integrate rust with existing c project

Posted: Sat Dec 20, 2025 6:31 pm
by jbsimon000
Additional information, I Changed ESP IDF version to 5.3.2, this time the build gives me:

Code: Select all

  Tool doesn't match supported version from list ['esp-13.2.0_20240530']:
  /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc


  Please try to run 'idf.py fullclean' to solve it.
'idf.py fullclean' does not appear to make any difference


idf.py --version

Code: Select all

ESP-IDF v5.3.2-dirty
idf.py build

Code: Select all

Executing action: all (aliases: build)
Running cmake in directory /home/users/joe/git/projects/esp/Esp32SensorApp/build
Executing "cmake -G 'Unix Makefiles' -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/home/users/joe/.espressif/python_env/idf5.3_py3.12_env/bin/python -DESP_PLATFORM=1 -DCCACHE_ENABLE=0 /home/users/joe/git/projects/esp/Esp32SensorApp"...
-- IDF_TARGET is not set, guessed 'esp32' from sdkconfig '/home/users/joe/git/projects/esp/Esp32SensorApp/sdkconfig'
-- Found Git: /usr/bin/git (found version "2.43.0") 
-- The C compiler identification is GNU 15.2.0
-- The CXX compiler identification is GNU 15.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
NOTICE: Updating lock file at /home/users/joe/git/projects/esp/Esp32SensorApp/dependencies.lock
NOTICE: Processing 2 dependencies:
NOTICE: [1/2] k0i05/esp_type_utils (1.2.7)
NOTICE: [2/2] idf (5.3.2)
-- Project sdkconfig file /home/users/joe/git/projects/esp/Esp32SensorApp/sdkconfig
/tmp/kconfgen_tmp61g8gyaf:70: warning: malformed string literal in assignment to SOC_BROWNOUT_RESET_SUPPORTED (defined at /home/users/joe/esp-idf-v5.3.2/./components/soc/esp32/include/soc/Kconfig.soc_caps.in:6). Assignment ignored.
warning: the value '0x40' is invalid for SOC_CPU_WATCHPOINT_MAX_REGION_SIZE (defined at /home/users/joe/esp-idf-v5.3.2/./components/soc/esp32/include/soc/Kconfig.soc_caps.in:314), which has type int -- assignment ignored
/tmp/kconfgen_tmp61g8gyaf:198: warning: '1' is not a valid value for the bool symbol SOC_MPI_OPERATIONS_NUM (defined at /home/users/joe/esp-idf-v5.3.2/./components/soc/esp32/include/soc/Kconfig.soc_caps.in:794). Assignment ignored.
/tmp/kconfgen_tmp61g8gyaf:204: warning: '1' is not a valid value for the bool symbol SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS (defined at /home/users/joe/esp-idf-v5.3.2/./components/soc/esp32/include/soc/Kconfig.soc_caps.in:818). Assignment ignored.
-- Compiler supported targets: xtensa-esp-elf
CMake Error at /home/users/joe/esp-idf-v5.3.2/tools/cmake/tool_version_check.cmake:36 (message):
  

  Tool doesn't match supported version from list ['esp-13.2.0_20240530']:
  /home/users/joe/.rustup/toolchains/esp/xtensa-esp-elf/esp-15.2.0_20250920/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc


  Please try to run 'idf.py fullclean' to solve it.

Call Stack (most recent call first):
  /home/users/joe/esp-idf-v5.3.2/components/esp_common/project_include.cmake:10 (check_expected_tool_version)
  /home/users/joe/esp-idf-v5.3.2/tools/cmake/build.cmake:400 (include)
  /home/users/joe/esp-idf-v5.3.2/tools/cmake/build.cmake:632 (__build_process_project_includes)
  /home/users/joe/esp-idf-v5.3.2/tools/cmake/project.cmake:710 (idf_build_process)
  CMakeLists.txt:24 (project)


-- Configuring incomplete, errors occurred!
cmake failed with exit code 1, output of the command is in the /home/users/joe/git/projects/esp/Esp32SensorApp/build/log/idf_py_stderr_output_930509 and /home/users/joe/git/projects/esp/Esp32SensorApp/build/log/idf_py_stdout_output_930509