Repository navigation
Closed
Closed
Copy link
Labels
0.kind: bugSomething is broken
Description
Nixpkgs version
- Unstable (25.11)
Describe the bug
When a project uses the esp-idf framework, it fails to build. If esphome compile is run more than once, two different errors are shown, one in the clean run, the other in the rest.
Steps to reproduce
-
Write a
configuration.yamlfile with contents:esphome: name: someproject esp32: board: az-delivery-devkit-v4 framework: type: esp-idf # Enable logging logger: # Enable Home Assistant API api: password: "" ota: - platform: esphome password: "" wifi: ssid: "somewifi" password: "somepassword"The most important bit in this case is
esp32.framework.type: esp-idf, is what triggers the IDF platform to be used instead of the Arduino one. -
Run:
nix run github:NixOS/nixpkgs/c5f7acaaf14cd126bbccd30c6e40c32366a66e2d#esphome compile configuration.yaml
Expected behaviour
The project builds, same as when using the Arduino framework.
Screenshots
No response
Relevant log output
First run error
❯ nix run github:NixOS/nixpkgs/c5f7acaaf14cd126bbccd30c6e40c32366a66e2d#esphome compile configuration.yaml
INFO ESPHome 2025.8.4
INFO Reading configuration configuration.yaml...
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Compiling app...
**************************************************************************************************************************************************************************************************
If you like PlatformIO, please:
- star it on GitHub > https://github.com/platformio/platformio-core
- follow us on LinkedIn to stay up-to-date on the latest project news > https://www.linkedin.com/company/platformio/
- try PlatformIO IDE for embedded development > https://platformio.org/platformio-ide
**************************************************************************************************************************************************************************************************
Processing someproject (board: az-delivery-devkit-v4; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Platform Manager: Installing https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Platform Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/esp_install/releases/download/v5.3.1/esp_install-v5.3.1.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/esp-idf/releases/download/v5.4.2/esp-idf-v5.4.2.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/xtensa-esp-elf-14.2.0_20241119.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected]+20241119 has been installed!
Tool Manager: Installing espressif/toolchain-esp32ulp @ 2.35.0-20220830
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/esptoolpy-v5.0.2.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-3.2.0.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/cmake-3.30.2.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/esp-rom-elfs-20241011.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/ninja-1.13.1.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing https://github.com/pioarduino/registry/releases/download/0.0.1/scons-4.8.1.zip
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40801.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: [email protected] has been installed!
idf_tools.py installation failed
idf_tools.py installation failed
idf_tools.py installation failed
idf_tools.py installation failed
idf_tools.py installation failed
idf_tools.py installation failed
Verbose mode can be enabled via `-v, --verbose` option
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/tool-esptoolpy
Tool Manager: [email protected] has been installed!
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/toolchain-xtensa-esp-elf
Tool Manager: [email protected]+20241119 has been installed!
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/tool-mklittlefs
Tool Manager: [email protected] has been installed!
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/tool-cmake
Tool Manager: [email protected] has been installed!
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/tool-ninja
Tool Manager: [email protected] has been installed!
Tool Manager: Installing file:///home/ereslibre/.platformio/tools/tool-esp-rom-elfs
Tool Manager: [email protected] has been installed!
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (54.3.21) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf @ 3.50402.0 (5.4.2)
- tool-scons @ 4.40801.0 (4.8.1)
- toolchain-esp32ulp @ 2.35.0-20220830
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType:
File "/nix/store/0jf6x26nwzgx9d616qiw163d3jgm404k-platformio-6.1.18/lib/python3.13/site-packages/platformio/builder/main.py", line 175:
env.SConscript("$BUILD_SCRIPT")
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py", line 620:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py", line 280:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/ereslibre/.platformio/platforms/espressif32/builder/main.py", line 526:
target_elf = env.BuildProgram()
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py", line 252:
return self.method(*nargs, **kwargs)
File "/nix/store/0jf6x26nwzgx9d616qiw163d3jgm404k-platformio-6.1.18/lib/python3.13/site-packages/platformio/builder/tools/piobuild.py", line 62:
env.ProcessProgramDeps()
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py", line 252:
return self.method(*nargs, **kwargs)
File "/nix/store/0jf6x26nwzgx9d616qiw163d3jgm404k-platformio-6.1.18/lib/python3.13/site-packages/platformio/builder/tools/piobuild.py", line 142:
env.BuildFrameworks(env.get("PIOFRAMEWORK"))
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Util/envs.py", line 252:
return self.method(*nargs, **kwargs)
File "/nix/store/0jf6x26nwzgx9d616qiw163d3jgm404k-platformio-6.1.18/lib/python3.13/site-packages/platformio/builder/tools/piobuild.py", line 352:
SConscript(env.GetFrameworkScript(name), exports="env")
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py", line 684:
return method(*args, **kw)
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py", line 620:
return _SConscript(self.fs, *files, **subst_kw)
File "/home/ereslibre/.platformio/packages/tool-scons/scons-local-4.8.1/SCons/Script/SConscript.py", line 280:
exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
File "/home/ereslibre/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 151:
assert os.path.isdir(TOOLCHAIN_DIR)
File "<frozen genericpath>", line 51:
================================================================================== [FAILED] Took 32.33 seconds ==================================================================================
Second run error
❯ nix run github:NixOS/nixpkgs/c5f7acaaf14cd126bbccd30c6e40c32366a66e2d#esphome compile configuration.yaml
INFO ESPHome 2025.8.4
INFO Reading configuration configuration.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing someproject (board: az-delivery-devkit-v4; framework: espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/54.03.21-2/platform-espressif32.zip)
-----------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (54.3.21) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-espidf @ 3.50402.0 (5.4.2)
- tool-cmake @ 3.30.2
- tool-esp-rom-elfs @ 2024.10.11
- tool-esptoolpy @ 5.0.2
- tool-mklittlefs @ 3.2.0
- tool-ninja @ 1.13.1
- tool-scons @ 4.40801.0 (4.8.1)
- toolchain-esp32ulp @ 2.35.0-20220830
- toolchain-xtensa-esp-elf @ 14.2.0+20241119
Creating a new virtual environment for IDF Python dependencies
Installing ESP-IDF's Python dependencies
Reading CMake configuration...
-- Found Git: /nix/store/4q2dd3sf6xq9bky0aq2wyp2pf958j0rz-git-2.51.0/bin/git (found version "2.51.0")
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- The C compiler identification is GNU 14.2.0
-- The CXX compiler identification is GNU 14.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/ereslibre/.platformio/packages/toolchain-xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/ereslibre/.platformio/packages/toolchain-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: /Users/ereslibre/.platformio/packages/toolchain-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
Dependencies lock doesn't exist, solving dependencies.
..NOTICE: Updating lock file at /Users/ereslibre/sometest/.esphome/build/someproject/dependencies.lock
Processing 2 dependencies:
[1/2] espressif/mdns (1.8.2)
[2/2] idf (5.4.2)
-- Project sdkconfig file /Users/ereslibre/sometest/.esphome/build/someproject/sdkconfig.someproject
-- Configuring incomplete, errors occurred!
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/ereslibre/.platformio/penv/.espidf-5.4.2/lib/python3.13/site-packages/kconfgen/__main__.py", line 5, in <module>
from .core import main
File "/Users/ereslibre/.platformio/penv/.espidf-5.4.2/lib/python3.13/site-packages/kconfgen/core.py", line 29, in <module>
import esp_idf_kconfig.gen_kconfig_doc as gen_kconfig_doc
File "/Users/ereslibre/.platformio/penv/.espidf-5.4.2/lib/python3.13/site-packages/esp_idf_kconfig/gen_kconfig_doc.py", line 14, in <module>
import kconfiglib.core as kconfiglib
ModuleNotFoundError: No module named 'kconfiglib.core'; 'kconfiglib' is not a package
CMake Error at /Users/ereslibre/.platformio/packages/framework-espidf/tools/cmake/kconfig.cmake:209 (message):
Failed to run kconfgen
(/Users/ereslibre/.platformio/penv/.espidf-5.4.2/bin/python;-m;kconfgen;--list-separator=semicolon;--kconfig;/Users/ereslibre/.platformio/packages/framework-espidf/Kconfig;--sdkconfig-rename;/Users/ereslibre/.platformio/packages/framework-espidf/sdkconfig.rename;--config;/Users/ereslibre/sometest/.esphome/build/someproject/sdkconfig.someproject;--env-file;/Users/ereslibre/sometest/.esphome/build/someproject/.pioenvs/someproject/config.env).
Error 1
Call Stack (most recent call first):
/Users/ereslibre/.platformio/packages/framework-espidf/tools/cmake/build.cmake:691 (__kconfig_generate_config)
/Users/ereslibre/.platformio/packages/framework-espidf/tools/cmake/project.cmake:718 (idf_build_process)
CMakeLists.txt:3 (project)
================================================================== [FAILED] Took 9.66 seconds ==================================================================
Additional context
No response
System metadata
❯ nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 6.12.42, NixOS, 25.11 (Xantusia), 25.11.20250910.ab0f360`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.28.5`
- nixpkgs: `/nix/store/9rfm3gjhphdvi7qnzdsi7piw1gi4c8vp-source`
Notify maintainers
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
- I assert that this is a bug and not a support request.
- I assert that this is not a duplicate of an existing issue.
- I assert that I have read the NixOS Code of Conduct and agree to abide by it.
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Reacted by James Hillyerd, Jeffrey C. Ollie, hatch01, Thane Gill, Alex Bakon, Janne Heß, Dima Ryskin, B. Kelly, Simonas Kazlauskas, Tero Teelahti and 4 more
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is broken
Activity
hatch01 commentedon Sep 14, 2025
Is this a new issue, or has this never worked?
hatch01 commentedon Sep 14, 2025
Got using esphome from stable :
mweinelt commentedon Sep 14, 2025
@hatch01 unrelated.
@ereslibre That's a platformio packaging issue, not esphome.
[-]esphome: fails to build projects based on `esp-idf` framework[/-][+]esphome: fails to build projects based on `esp-idf` framework due to platformio[/+]ereslibre commentedon Sep 15, 2025
@mweinelt ok thanks, I have added platformio maintainers in the loop.
techyporcupine commentedon Sep 25, 2025
Bumping this; having the issue as well.
aSapien commentedon Sep 25, 2025
I'm getting the "second run" error from the get go, and consistently:
ToxicFrog commentedon Oct 2, 2025
I'm seeing the same thing, and it affects the web UI as well.
Since some recent ESP32s like the ESP32c6 aren't supported by the arduino platform, this makes them unusable.
nagisa commentedon Oct 5, 2025
I tried looking for some workaround to get builds going at least temporarily. Here are my findings so far:
You can get a bit further along by running the following first:
platformio-coreseems to be necessary to at least successfully installidf_tools.py. This fails when running plain esphome.Despite that
pio run -d .esphome/build/$yourprojectwill still fail with thekconfiglibissue. This seems to be in part at least akconfiglib(version?) compatibility problem.kconfgencomes alongside with theespidfpackage (i.e. is taken from~/.platformio/penv/.espidf-5.4.2/lib/python3.13/site-packages/kconfgen/) whereas thekconfiglibcomes from the nix store and although you can importkconfiglibitself,kconfiglib.coreis not importable in the plain package.At least in this aspect this seems more an
esphomeissue, as it is preciselyesphomethat pulls in this dep, notplatformio.Unfortunately it does not look like
kconfiglib 14.1.0is supported even withesp-idf 5.5.1released recently. That said, upstream seems to have taken note of this and if you set up your project to use the latestesp-idf:platformio will then attempt to manually reinstall correct version(s) of the python package(s), unconditionally:
This unfortunately seems to be impossible to fix with virtual environments either, because this patched
/nix/store/b58avxjlwyv35kgswgz2gb5hn0v0rsn5-python3-3.13.7-env/bin/python3.13overrides the python prefix to/nix/store/b58avxjlwyv35kgswgz2gb5hn0v0rsn5-python3-3.13.7-env.The most straightforward fix here would be to downgrade
kconfigliband call it a day. A correct solution, however would be to probably not have esphome+platformio pull python libraries used for project builds from nixpkgs, because versions of those python packages can differ depending on how the project is configured! PlatformIO+esp-idf seems to be quite comfortable with managing its own python prefix in.platformio/penv/.espidf-$VERSION/...nagisa commentedon Oct 5, 2025
What works for me is setting up a FHS shell with
buildFHSEnv, setting up a venv, installingesphomein it and going from there.hatch01 commentedon Oct 6, 2025
This is not very the nix way but just using the esphome container works well :
esphome: Update dependencies