Failed to run confgen.py error in custom aws repository

Hello everyone,
I was trying to create a custom repository of amazon-freertos v202106 with esp-idf 4.2.1 for my project.
I was following the steps mention here.
My repo looks like this

- freertos
- freertos-configs
  - aws_clientcredential.h
  - aws_clientcredential_keys.h
  - iot_mqtt_agent_config.h
  - iot_config.h
- components
- src
- CMakeLists.txt

main CMakeList.txt

cmake_minimum_required(VERSION 3.13)

project(freertos_examples)

# Pull in ESP-IDF defined CMake build infrastructure logic to configure the project, discover all the components, etc
set(esp_idf_dir "${CMAKE_CURRENT_LIST_DIR}/freertos/vendors/espressif/esp-idf")
include(${esp_idf_dir}/tools/cmake/idf.cmake)
# Tell IDF build to link against this target.
set(IDF_PROJECT_EXECUTABLE my_app)
get_filename_component(
    IDF_EXECUTABLE_SRCS
    "src/main.c" ABSOLUTE
    )
# Add some extra components. IDF_EXTRA_COMPONENT_DIRS is an variable used by ESP-IDF
# to collect extra components.
# get_filename_component(
#     EXTRA_COMPONENT_DIRS
#     "components" ABSOLUTE
# )
# idf_build_component(${EXTRA_COMPONENT_DIRS})
list(APPEND IDF_EXTRA_COMPONENT_DIRS ${EXTRA_COMPONENT_DIRS})
get_filename_component(
    EXTRA_COMPONENT_DIRS
    "components" ABSOLUTE
)
list(APPEND IDF_EXTRA_COMPONENT_DIRS ${EXTRA_COMPONENT_DIRS})

# Override the configurations for FreeRTOS.
include_directories(BEFORE freertos-configs)

# Add FreeRTOS as a subdirectory. AFR_BOARD tells which board to target.
set(AFR_BOARD espressif.esp32_devkitc CACHE INTERNAL "")
add_subdirectory(freertos)

# Link against the mqtt library so that we can use it. Dependencies are transitively
# linked.
target_link_libraries(my_app PRIVATE 
                    AFR::core_mqtt
                    AFR::backoff_algorithm
                    AFR::core_json
                    AFR::transport_interface_secure_sockets
                    AFR::secure_sockets
                    AFR::pkcs11_helpers
                    AFR::demo_wifi_provisioning
                    AFR::demo_numeric_comparison
                    AFR::mqtt_demo_helpers
                    AFR::device_shadow
)

When I run the command
cmake -DVENDOR=espressif -DBOARD=esp32_devkit -DCOMPILER=xtensa-esp32 -S . -B build -GNinja -DCMAKE_BUILD_TYPE=release -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DIDF_SDKCONFIG_DEFAULTS=./sdkconfig

I m getting the error:

00:59:39.820031 git.c:439               trace: built-in: git describe --always
WARNING: IDF_PATH environment variable is not cleared.
    If CMake is generating an error, consider clearing the IDF_PATH environment
    variable, and generating a clean build. This message can be ignored if
    CMake was successful.
-- Checking Python dependencies...
Python requirements from /home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/requirements.txt are satisfied.
-- Project sdkconfig file /home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/build/sdkconfig
Loading defaults file /home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/sdkconfig...
Traceback (most recent call last):
  File "/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/tools/kconfig_new/confgen.py", line 641, in <module>
    main()
  File "/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/tools/kconfig_new/confgen.py", line 285, in main
    raise RuntimeError("Defaults file not found: %s" % name)
RuntimeError: Defaults file not found: /home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/sdkconfig
CMake Error at freertos/vendors/espressif/esp-idf/tools/cmake/kconfig.cmake:227 (message):
  Failed to run confgen.py
  (python;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/tools/kconfig_new/confgen.py;--kconfig;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/Kconfig;--sdkconfig-rename;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/esp-idf/sdkconfig.rename;--config;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/build/sdkconfig;--defaults;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/sdkconfig;--env-file;/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/build/freertos/config.env).
  Error 1
Call Stack (most recent call first):
  freertos/vendors/espressif/esp-idf/tools/cmake/build.cmake:442 (__kconfig_generate_config)
  freertos/vendors/espressif/boards/esp32/CMakeLists.txt:600 (idf_build_process)
  freertos/CMakeLists.txt:70 (include)


-- Configuring incomplete, errors occurred!
See also "/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/build/CMakeFiles/CMakeOutput.log".

I found some discussion on the freertos forum
Here they gave some patch to resolve the issues. but I found those patches are already there in the espressif/boards/esp32/CmakeLists.txt file.

So, I not understand then why this issue is coming.

Thanks for your help.

Moving to the Espressif category so that the @Espressif team can have better visibility as well.

Also, I see that you set -DIDF_SDKCONFIG_DEFAULTS=./sdkconfig.
What happens when you set it to
-DIDF_SDKCONFIG_DEFAULTS=/home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos/vendors/espressif/boards/esp32/aws_demos/sdkconfig.defaults?

@abrinao I fixed this issue by putting the sdkconfig and sdkconfig.defaults file in /home/horsemann/Desktop/WorkSpace/aws_latest_repository/customRepo/freertos,
Thanks for the help.

1 Like