Esphome re-compile all libraries even for minor changes

Hi,
I’ve not compiled stuff for a few months, now i’ve updated esphome integration and cleaned up prebuilds: after the first run, it recompiles most of the time everything. I’m running HAOS in a Proxmox VM (2 cores, 8GB RAM assigned).
This happens with new device and also with existing devices when changing minor things, not adding components.

Any idea why this is happening? Thanks for any hint.
See log.

INFO ESPHome 2025.11.4
INFO Reading configuration /config/esphome/rack-display.yaml...
INFO Detected timezone 'Europe/Rome'
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Setting CONFIG_LWIP_MAX_SOCKETS to 11 (registered: api=4, captive_portal=4, mdns=2, ota=1)
INFO Compiling app... Build path: /data/build/rack-display
Processing rack-display (board: az-delivery-devkit-v4; framework: arduino, espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/55.03.31-2/platform-espressif32.zip)
--------------------------------------------------------------------------------
INFO Package configuration completed successfully
INFO Package configuration completed successfully
HARDWARE: ESP32 240MHz, 520KB RAM, 4MB Flash
 - contrib-piohome @ 3.4.4 
 - framework-arduinoespressif32 @ 3.3.2 
 - framework-arduinoespressif32-libs @ 5.5.0+sha.129cd0d247 
 - framework-espidf @ 3.50501.0 (5.5.1) 
 - tool-cmake @ 4.0.3 
 - tool-esp-rom-elfs @ 2024.10.11 
 - tool-esptoolpy @ 5.1.0 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.13.1 
 - tool-scons @ 4.40801.0 (4.8.1) 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
Dependency Graph
|-- Networking @ 3.3.2
|-- ESP32 Async UDP @ 3.3.2
|-- DNSServer @ 3.3.2
|-- WiFi @ 3.3.2
|-- ESPmDNS @ 3.3.2
|-- Update @ 3.3.2
|-- noise-c @ 0.1.10
|-- Wire @ 3.3.2
Compiling .pioenvs/rack-display/src/esphome/components/api/api_connection.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/api_frame_helper.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/api_frame_helper_noise.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/api_pb2.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/api_pb2_service.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/api_server.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/list_entities.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/proto.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/api/subscribe_state.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/display/display.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/display/display_buffer.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/display/rect.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/esp32/core.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/esp32/gpio.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/esp32/helpers.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/esp32/preferences.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/esphome/ota/ota_esphome.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/font/font.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/homeassistant/text_sensor/homeassistant_text_sensor.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/homeassistant/time/homeassistant_time.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/i2c/i2c.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/i2c/i2c_bus_arduino.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/logger/logger.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/logger/logger_esp32.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/logger/task_log_buffer.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/md5/md5.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/mdns/mdns_component.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/mdns/mdns_esp32.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/network/util.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/ota/ota_backend.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/restart/switch/restart_switch.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/safe_mode/safe_mode.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/sha256/sha256.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/socket/bsd_sockets_impl.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/socket/socket.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/ssd1306_base/ssd1306_base.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/ssd1306_i2c/ssd1306_i2c.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/switch/automation.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/switch/switch.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/text_sensor/filter.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/text_sensor/text_sensor.cpp.o
Compiling .pioenvs/rack-display/src/esphome/components/time/automation.cpp.o
[cont...]

Because of that.
If you recompile, even after changing nothing, new versions of dependencies from the updated esphome kick in

1 Like

Thanks, yes I know that, but it keeps recompiling all dependancies, for the same device even for minor changes.

Does it also recompile everything if there is no change to anything?

If so, then there might be something wrong with your installation.

If not, it is much more likely the change you made is not so minor. Figuring out exactly what needs to be built can be challenging. Simple build systems typically do it by looking at the last time the input files (and dependencies) were changed and compare it to the time of the output files. If any input has a later date, it will build the output. It has to do this recursively so a simple change can easily cause a full rebuild. Changing the log level is an example of this.

Hi Neel, thanks for the hint: recompiling with no change does not recompile everything. I will do some more testing.

What you have described is normal operation. If you clear the cache unnecessarily, it will rebuild it.

Thanks, I cleared the cache just once, when I started developing a new device.
I did it because I was getting a freeze during the unpacking of arduino libs, tried several times clearing cache but ultimately solved increasing RAM from 6 to 8GB to the VM.
Now full recompiling happens very often.

An uninstall, reboot twice, and then reinstall of ESPHome may solve your problems in case there are some corrupt files. Be sure to backup your yaml files for each device before you start in case they disappear during this process.

1 Like