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

file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with exactly three arguments. (IDFGH-14239) #15035

Open
3 tasks done
SB211 opened this issue Dec 15, 2024 · 5 comments
Labels
Status: Opened Issue is new Type: Bug bugs in IDF

Comments

@SB211
Copy link

SB211 commented Dec 15, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.3.2-176-g64e5b924f4

Espressif SoC revision.

ESP32/ESP32-S3 to ESP32-C3/ESP32-C6

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3 and ESP32-ROVER

Power Supply used.

External 5V

What is the expected behavior?

idf.py set-target esp32 is supposed to adjust the ESP framework according the used/defined ESP hardware.

What is the actual behavior?

After the most recent update (git pull) of ESP-IDF 5.3.2, idf.py bails out as shown below. It seems the IDF_TOOL variable seems unset. Searching/grepping the folder IDF_PATH points to does not reveal any obvious and intuitive setting procedere of this variable.

[...]
Processing 1 dependencies:
[1/1] idf (5.3.2)
-- Project sdkconfig file /pool/home/ohartmann/Projects/datensammler/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
CMake Deprecation Warning at /pool/home/ohartmann/Projects/esp-idf/components/mbedtls/mbedtls/CMakeLists.txt:21 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.

Update the VERSION argument value. Or, use the ... syntax
to tell CMake that the project requires at least but has been updated
to work with policies introduced by or earlier.

-- Found Python3: /usr/local/bin/python (found version "3.11.11") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "datensammler" version: 0.0.1
-- Adding linker script /pool/home/ohartmann/Projects/datensammler/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /pool/home/ohartmann/Projects/datensammler/build/esp-idf/esp_system/ld/sections.ld.in
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
Including esp_timer in color
CMake Error at /pool/home/ohartmann/Projects/esp-idf/tools/cmake/gdbinit.cmake:40 (file):
file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with
exactly three arguments.
Call Stack (most recent call first):
/home/ohartmann/Projects/esp-idf/tools/cmake/project.cmake:356 (__generate_gdbinit)
/home/ohartmann/Projects/esp-idf/tools/cmake/project.cmake:923 (__project_info)
CMakeLists.txt:11 (project)

-- Configuring incomplete, errors occurred!

Steps to reproduce.

  1. Step: update to most recent ESP-IDF 3.5.2
  2. Step: try rebuilding project via idf.py which worked fine with ESP-IDF 3.5.1
  3. Step: be amazed ...
    ...

Debug Logs.

[...]
Processing 1 dependencies:
[1/1] idf (5.3.2)
-- Project sdkconfig file /pool/home/ohartmann/Projects/datensammler/sdkconfig
-- Compiler supported targets: xtensa-esp-elf
CMake Deprecation Warning at /pool/home/ohartmann/Projects/esp-idf/components/mbedtls/mbedtls/CMakeLists.txt:21 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Found Python3: /usr/local/bin/python (found version "3.11.11") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "datensammler" version: 0.0.1
-- Adding linker script /pool/home/ohartmann/Projects/datensammler/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /pool/home/ohartmann/Projects/datensammler/build/esp-idf/esp_system/ld/sections.ld.in
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /pool/home/ohartmann/Projects/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
Including esp_timer in color
CMake Error at /pool/home/ohartmann/Projects/esp-idf/tools/cmake/gdbinit.cmake:40 (file):
  file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with
  exactly three arguments.
Call Stack (most recent call first):
  /home/ohartmann/Projects/esp-idf/tools/cmake/project.cmake:356 (__generate_gdbinit)
  /home/ohartmann/Projects/esp-idf/tools/cmake/project.cmake:923 (__project_info)
  CMakeLists.txt:11 (project)


-- Configuring incomplete, errors occurred!

More Information.

No response

@SB211 SB211 added the Type: Bug bugs in IDF label Dec 15, 2024
@github-actions github-actions bot changed the title file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with exactly three arguments. file FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be called with exactly three arguments. (IDFGH-14239) Dec 15, 2024
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 15, 2024
@igrr
Copy link
Member

igrr commented Dec 15, 2024

@SB211 Could you please mention, which version of CMake are you running (cmake --version)?

IDF v5.3.2 requires CMake >= 3.16. It seems, however, that gdbinit.cmake (which uses a more recent CMake syntax) gets included before the version check happens, hence the confusing error message.

I think upgrading CMake to a more recent version should solve the issue you are seeing.

@SB211
Copy link
Author

SB211 commented Dec 15, 2024

cmake version 3.31.2

@SB211
Copy link
Author

SB211 commented Dec 15, 2024

According to "git log", ESP-IDF v5.3.2 has despite being a release version undergone some changes in gdbinit.

The error occured recently occured is related to "./tools/cmake/gdbinit.cmake", line 40, which is

file(TO_CMAKE_PATH $ENV{ESP_ROM_ELF_DIR} ESP_ROM_ELF_DIR)

My first guess is/was that ESP_ROM_ELF_DIR is unknown/unset. My skills according to "cmake/ninja" are limited, usually I would check via "make -V ESP_ROM_ELF_DIR" the setting of that variable. So far.

Searching for ESP_ROM_ELF_DIR within ESP-IDF check-out folder via "grep -r ESP_ROM_ELF_DIR .", I found this lines:

[...]
./components/esp_rom/test_esp_rom.py: rom_elfs_dir = os.getenv('ESP_ROM_ELF_DIR', '')
./components/esp_rom/gen_gdbinit.py: rom_elfs_dir = os.getenv('ESP_ROM_ELF_DIR')
./components/esp_rom/gen_gdbinit.py: 'ESP_ROM_ELF_DIR environment variable is not defined. Please try to run IDF "install" and "export" scripts.')
./docs/en/api-guides/tools/idf-monitor.rst:The ROM ELF file is automatically loaded from a location based on the IDF_PATH and ESP_ROM_ELF_DIR environment variables. This can be overridden by calling esp_idf_monitor and providing a path to a specific ROM ELF file: python -m esp_idf_monitor --rom-elf-file [path to ROM ELF file].
./docs/zh_CN/api-guides/tools/idf-monitor.rst:ROM ELF 文件会根据 IDF_PATHESP_ROM_ELF_DIR 环境变量的路径自动加载。如需覆盖此行为,可以通过调用 esp_idf_monitor 并指定特定的 ROM ELF 文件路径:python -m esp_idf_monitor --rom-elf-file [ROM ELF 文件的路径]
./tools/tools.json: "ESP_ROM_ELF_DIR": "${TOOL_PATH}/"
./tools/cmake/gdbinit.cmake: file(TO_CMAKE_PATH $ENV{ESP_ROM_ELF_DIR} ESP_ROM_ELF_DIR)
[...]

Please correct me if I'm wrong: ./tools/tools.json: "ESP_ROM_ELF_DIR": "${TOOL_PATH}/" seems to be the crucial section. I guess TOOL_PATH is unset for unknown reasons.
Isn't the ROM file something being built according to selected ESP32 type (RISC-V oder Tensilica Core, Revision of the chip), is it? Calling "idf.py menuconfig" therefore can't know anything about ROM files - except according to the file system's hierachy (project's directory) the will-be-build-in location of the ROM would be known - but not set accordingly. Just a guess. I do not know what tool might set ESP_ROM_ELF_DIR or whether this variable is a new environment variable which has to be set by the develeoper.

@SB211
Copy link
Author

SB211 commented Dec 15, 2024

Reverting

commit 3af39a0

solves the problem!

@igrr
Copy link
Member

igrr commented Dec 15, 2024

I guess TOOL_PATH is unset for unknown reasons.

You are right, it seems like the absence of ESP_ROM_ELF_DIR variable is the most likely cause.

Could you please run . ./export.sh in ESP-IDF directory again and then run printenv to check if ESP_ROM_ELF_DIR environment variable gets set by the export script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants