Help - CMake build error when following Getting Started

Hello - I have been attempting to set up my ESP32 build environment using FreeRTOS, by following this Getting Started doc: https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_espressif.html

  • Dev platform: Windows 10
  • Cmake version 3.17.2
  • Python version 2.7.14
  • xtensa-esp32-elf-gcc --version: 5.20

Everything has gone fine up until the step “Build FreeRTOS on Windows”. I run the following command in the FreeRTOS directory as instructed:

cmake -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 -GNinja -S . -B build

And I get the following output:

– Submodule update
– Checking Python dependencies…
Python requirements from C:/Project Workspace/ESP32_FreeRTOS_AWS/amazon-freertos/vendors/espressif/esp-idf\requirements.txt are satisfied.
– Building for target esp32
CMake Error at vendors/espressif/esp-idf/tools/cmake/scripts/expand_requirements.cmake:144 (list):
list GET given empty list
Call Stack (most recent call first):
vendors/espressif/esp-idf/tools/cmake/scripts/expand_requirements.cmake:199 (filter_components_list)

CMake Error at vendors/espressif/esp-idf/tools/cmake/idf_functions.cmake:338 (message):
Failed to expand component requirements
Call Stack (most recent call first):
vendors/espressif/boards/esp32/CMakeLists.txt:494 (idf_import_components)
CMakeLists.txt:70 (include)

– Configuring incomplete, errors occurred!
See also “C:/Project Workspace/ESP32_FreeRTOS_AWS/amazon-freertos/build/CMakeFiles/CMakeOutput.log”.
See also “C:/Project Workspace/ESP32_FreeRTOS_AWS/amazon-freertos/build/CMakeFiles/CMakeError.log”.

CMakeError.log:

Compiling the C compiler identification source file “CMakeCCompilerId.c” failed.
Compiler: C:/Program Files/Espressif/ESP-IDF Tools/tools/bin/xtensa-esp32-elf-gcc.exe
Build flags: -mlongcalls
Id flags:

The output was:
1
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lsim
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lhandlers-sim
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lhal
collect2.exe: error: ld returned 1 exit status

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” failed.
Compiler: C:/Program Files/Espressif/ESP-IDF Tools/tools/bin/xtensa-esp32-elf-g++.exe
Build flags: -mlongcalls
Id flags:

The output was:
1
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lsim
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lhandlers-sim
c:/program files/espressif/esp-idf tools/tools/bin/…/lib/gcc/xtensa-esp32-elf/5.2.0/…/…/…/…/xtensa-esp32-elf/bin/ld.exe: cannot find -lhal
collect2.exe: error: ld returned 1 exit status

CMakeOutput.log:

The target system is: Generic - -
The host system is: Windows - 10.0.18362 - AMD64
Compiling the C compiler identification source file “CMakeCCompilerId.c” succeeded.
Compiler: C:/Program Files/Espressif/ESP-IDF Tools/tools/bin/xtensa-esp32-elf-gcc.exe
Build flags: -mlongcalls
Id flags: -c

The output was:
0

Compilation of the C compiler identification source “CMakeCCompilerId.c” produced “CMakeCCompilerId.o”

The C compiler identification is GNU, found in “C:/Project Workspace/ESP32_FreeRTOS_AWS/amazon-freertos/build/CMakeFiles/3.17.2/CompilerIdC/CMakeCCompilerId.o”

Compiling the CXX compiler identification source file “CMakeCXXCompilerId.cpp” succeeded.
Compiler: C:/Program Files/Espressif/ESP-IDF Tools/tools/bin/xtensa-esp32-elf-g++.exe
Build flags: -mlongcalls
Id flags: -c

The output was:
0

Compilation of the CXX compiler identification source “CMakeCXXCompilerId.cpp” produced “CMakeCXXCompilerId.o”

The CXX compiler identification is GNU, found in “C:/Project Workspace/ESP32_FreeRTOS_AWS/amazon-freertos/build/CMakeFiles/3.17.2/CompilerIdCXX/CMakeCXXCompilerId.o”

Checking whether the ASM compiler is GNU using “–version” matched “(GNU assembler)|(GCC)|(Free Software Foundation)”:
xtensa-esp32-elf-gcc.exe (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a5) 5.2.0
Copyright © 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I am not able to follow the errors to any reasonable understanding of the problem. Does anybody have possible insights or further troubleshooting steps?

Thank you!
-Tony

Hi Antonio,

Thanks for your interest in FreeRTOS,
I will try to reproduce the problem you are facing, and will get back to you shortly.

Thanks,
Alfred

1 Like

Hello Antonio,

Can you verify that the IDF_PATH envornment variable is not defined?

On windows, if you enter set in the command prompt, you will see a list of all your environment variables.

I verified IDF_PATH is not defined as an env variable. Thanks.

Hi, has there been any resolution to this?
I’m having the same issue on Ubuntu (WSL) and same Error Logs. IDF_PATH is not defined in my case either.

Hello,

@sturmgans Please note that WSL is not officially supported as mentioned in the first portion of Build FreeRTOS on Windows section of the guide. However I suspect it should be possible without too much alteration.

Many times, this class of issue occurs when the espressif toolchain hasn’t been installed appropriately, can’t be used appropriately, or because the toolchain is not discoverable in the PATH. Though that is purely pattern and speculation. Nonetheless it may not hurt to go over Setting Up the Toolchain section of the guide and double check, maybe reinstall, the toolchain for your host system.

Something interesting to note, after I successfully run the cmake/make commands I also see some of these errors:

> The output was:
> 1
> /Users/dchalco/boards/esp32/toolchain/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find crt1-sim.o: No such file or directory
> /Users/dchalco/boards/esp32/toolchain/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find _vectors.o: No such file or directory
> /Users/dchalco/boards/esp32/toolchain/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lsim
> /Users/dchalco/boards/esp32/toolchain/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhandlers-sim
> /Users/dchalco/boards/esp32/toolchain/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: cannot find -lhal
> collect2: error: ld returned 1 exit status

However, my cmake and make calls succeed, so I dont’ think these are the root cause. The following does not occur in my successful runs:

CMake Error at vendors/espressif/esp-idf/tools/cmake/scripts/expand_requirements.cmake:144 (list):
list GET given empty list

That particular line points to:
list(GET ALL_COMPONENTS ${component_idx} component)

If that list is empty, that likely explains why idf_import_components is failing.

Could you rerun your cmake command with --trace-expand option and -DDEBUG=1. Trace expand will trace the cmake calls in the output, and expand variables. The DEBUG variable is used in esp-idf cmake files to output more debug information. Could you please capture the stdout/stderr to a log and search for a line that calls idf_import_components:

/Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/boards/esp32/CMakeLists.txt(496): idf_import_components(components /Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/esp-idf esp-idf )

shortly after this call, the trace should show IDF_COMPONENT_DIRS getting set to some value:

/Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/esp-idf/tools/cmake/idf_functions.cmake(60): set_default(IDF_COMPONENT_DIRS /Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/boards/esp32/aws_demos/application_code/espressif_code;/Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/boards/esp32/components /Users/dchalco/spaces/afr/master/amazon-freertos/vendors/espressif/esp-idf/components )

Hello David,

After going through your answer thoroughly I realize teh root cause is another one than here, I just got the same symptoms. I should probably start a new thread instead.

Thank you very much for your help!