Skip to content

build/Kconfig not generated → Kconfig error during idf.py reconfigure (ESP-IDF v5.5.1) (IDFGH-16830) #17904

@lbussy

Description

@lbussy

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.5.1

Operating System used.

macOS

How did you build your project?

Other (please specify in More Information)

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

None

What is the expected behavior?

When configuring a project using ESP-IDF v5.5.1, the build system generates a build/kconfigs.in file that includes:

source "/<project-path>/build/Kconfig"

However, he file build/Kconfig is never created, causing kconfgen to fail with a KconfigError during idf.py reconfigure (and also during initial configuration). Manually creating an empty build/Kconfig allows the configuration to succeed.

This appears to be a regression or oversight in how ESP-IDF populates its COMPONENT_KCONFIGS list when generating kconfigs.in.

  • ESP-IDF should not reference build/Kconfig unless the file is actually produced during the configuration process, OR
  • ESP-IDF should auto-generate a minimal build/Kconfig file before writing a source statement to kconfigs.in.

What is the actual behavior?

build/kconfigs.in contains:

source "/Users/<user>/.../arduino_idf_demo/build/Kconfig"

build/Kconfig does not exist.

Running idf.py reconfigure fails:

kconfiglib.core.KconfigError: kconfigs.in:80:
'/.../arduino_idf_demo/build/Kconfig' not found
(in 'source ".../build/Kconfig"')

Creating an empty file:

touch build/Kconfig

... allows the configuration to succeed.

Steps to reproduce.

  1. Create a project using ESP-IDF v5.5.1.

  2. Add any component containing a valid Kconfig file, e.g.:
    components/drd_handler/Kconfig

  3. Remove build/, managed_components/, and dependencies.lock.
    rm -rf build managed_components dependencies.lock

  4. Run:
    idf.py -D CMAKE_EXPORT_COMPILE_COMMANDS=ON reconfigure

  5. Observe the error from kconfgen.

  6. Inspect build/kconfigs.in and notice the reference to build/Kconfig.

  7. Create an empty file:

    mkdir -p build
    touch build/Kconfig
  8. Re-run idf.py reconfigure and observe that it succeeds.

Build or installation Logs.

Excerpt from `build/kconfigs.in`:

...
78  source "/Users/.../esp-idf/components/wear_levelling/Kconfig"
79  source "/Users/.../esp-idf/components/wifi_provisioning/Kconfig"
80  source "/Users/<user>/.../arduino_idf_demo/build/Kconfig"
81  source "/Users/<user>/.../arduino_idf_demo/managed_components/espressif__esp-dsp/Kconfig"
...

Error traceback:

kconfiglib.core.KconfigError: kconfigs.in:80:
'/Users/<user>/arduino_idf_demo/build/Kconfig' not found
(in 'source "/Users/<user>/arduino_idf_demo/build/Kconfig"').
Check that environment variables are set correctly (e.g. $srctree).

Diagnostic report archive.

Running idf_diag in directory /Users/<user>/Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo
Executing "/Users/<user>//.espressif/python_env/idf5.5_py3.14_env/bin/python -m esp_idf_diag create --no-hints --force-terminal --project-dir /Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo --build-dir /Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build --output idf-diag-4ea28ecb-57d1-491d-8a4d-2bd86e68c9e9"...
Creating report in "idf-diag-4ea28ecb-57d1-491d-8a4d-2bd86e68c9e9" directory.
Searching for device serial port ...
Serial port: /dev/cu.usbserial-210
Shell environment information
* Enviromental Variables
* Python Environmental Variables
Basic ESP-IDF information
* ESP-IDF Version
* ESP-IDF Git Version
IDF Component Manager information
* IDF Component Manager
ESP-IDF project information and artifacts
* Project Description
* Compile Commands
* Linker Scripts
warning: File "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/esp-idf/esp_system/ld/sections.ld" does not exist: [Errno 2] No such file or directory: '/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/esp-idf/esp_system/ld/sections.ld'
* Flash Arguments
* Sdkconfig
* Logs
warning: No files with content matching regex "^Command: ninja all$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
warning: No files with content matching regex "^Command: ninja all$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
warning: No files with content matching regex "^Command: ninja flash$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
warning: No files with content matching regex "^Command: ninja flash$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
warning: No files with content matching regex "^Command: .*idf_monitor.py.*$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
warning: No files with content matching regex "^Command: .*idf_monitor.py.*$" found in "/Users/<user>//Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build/log"
* Link Map File
warning: No files matching glob "*.map" found in "/Users/<user>/

/Library/CloudStorage/OneDrive-Personal/Documents/GitHub/arduino_idf_demo/build"
ESP-IDF python and virtual environment information
* Python Version
* Python Virtual Environment Packages
System information
* Platform Information
* Darwin Information
Target information
* Esptool - flash_id
* Esptool - get_security_info
warning: Exec command "esptool.py --port /dev/cu.usbserial-210 get_security_info" failed with exit code 2
* Espefuse - summary
ESP-IDF tools information
* ESP-IDF Tools Info
The report has been created in the "idf-diag-4ea28ecb-57d1-491d-8a4d-2bd86e68c9e9" directory.
Please make sure to thoroughly check it for any sensitive information before sharing and remove files you do not want to share. Kindly include any additional files you find relevant that were not automatically added. Please archive the contents of the final report directory using the command:
"idf.py diag --zip idf-diag-4ea28ecb-57d1-491d-8a4d-2bd86e68c9e9".

idf-diag-4ea28ecb-57d1-491d-8a4d-2bd86e68c9e9.zip

More Information.

Environment

  • ESP-IDF version: v5.5.1

  • Target: ESP32

  • Host OS: macOS

  • Python: 3.14.0 (managed by IDF’s virtual environment)

  • Build system: CMake + Ninja (via idf.py)

  • Removing a project-root Kconfig.projbuild does not remove the erroneous reference to build/Kconfig.

  • The project’s component Kconfig files are valid.

  • The issue appears to originate from the content of build/config.env, where COMPONENT_KCONFIGS includes:
    ...;<project>/build/Kconfig;...
    even though that file does not exist and is not written by any part of the IDF build pipeline.

  • The workaround is to create an empty build/Kconfig before running idf.py, but this should not be required.

Suggested Fix:

  • Modify ESP-IDF’s Kconfig aggregation logic so that build/Kconfig is not included in COMPONENT_KCONFIGS unless generated.

  • Or ensure that a minimal build/Kconfig is created before generating kconfigs.in.

  • Or filter out invalid/nonexistent paths before writing the list into kconfigs.in.

Minimal Project Tree

.
├── CMakeLists.txt
├── cleanproject.sh
├── components
│   └── drd_handler
│       ├── CMakeLists.txt
│       ├── drd_handler.cpp
│       └── Kconfig
├── main
│   ├── CMakeLists.txt
│   └── main.cpp
├── sdkconfig
├── sdkconfig.defaults
└── partitions_16mb.csv

Minimal repro project:

espidf_kconfig_repro.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions