ESPHome, compile error

I am troubleshooting a problem where NodeMCU devices compiled using ESPHome V2024.4.x would not connect to WiFi.

I reinstalled ESPHome 2024.3.2 and the devices connect just fine.

On a spare Raspberry Pi-
I installed HAOS (Core2024.4.4, Supervisor2024.04.4) , and installed ESPHome 2024.4.2

When I compile the device, I get this error:

Compiling .pioenvs/wemosblink/src/esphome/components/api/api_connection.cpp.o
xtensa-lx106-elf-g++: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
compilation terminated.
*** [.pioenvs/wemosblink/src/esphome/components/api/api_connection.cpp.o] Error 1
========================= [FAILED] Took 31.84 seconds =========================

I removed and reinstalled ESPHome Add-on, but the compile problem persists.

Any tips would be appreciated.

Screenshot 2024-04-30 215056

1 Like

I put the wifi and device base into separate packages because they are the same on most of my projects.

Device configuration:

# Blink the LED_BUILTIN (D4) on an ESP board

substitutions:
  device_name: wemosblink
  friendly_name: wemos blink
  my_ssid: iot

packages:
  wifi: !include common/wifi.yaml
  device_base: !include common/esp8266.yaml

#Override the default board:
esp8266:
  board: nodemcuv2

############################################

# Blink the LED on D4 (GPIO2, LED_BUILTIN)
switch:
  - platform: gpio
    pin:
      number: D4 
      mode: output
    id: builtinLED

interval:
  - interval: 750ms
    then:
      - switch.toggle: builtinLED

wifi.yaml:

wifi:
  ssid: !secret iot_ssid
  password: !secret iot_password

sensor:
  - platform: wifi_signal
    name: ${friendly_name} WiFi Level
    #id: ${device_name}_WiFi_level
    update_interval: 10s

# Get the WiFi details
text_sensor:
  - platform: wifi_info
    ip_address:
      name: ${friendly_name} IP
    ssid:
      name: ${friendly_name} SSID
    mac_address:
      name: ${friendly_name} Mac Address    

web_server:
  port: 80    

esp8266.yaml:

substitutions:
  project_name: ${device_name}
  project_version: "1.0"

esphome:
  name: ${project_name}
  project:
    name: steve.${device_name}
    version: ${project_version}
    
esp8266:
  board: esp01_1m
  framework:
    version: recommended
    
# Logger level "debug" is needed to get 1-Wire addresses, like the ds18b20.
logger:
  level: DEBUG

ota:
  safe_mode: True

# Enable Home Assistant API
api:

And, the log:

INFO ESPHome 2024.4.2
INFO Reading configuration /config/esphome/wemos-blink.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing wemosblink (board: nodemcuv2; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 2.0.0
|-- ESPAsyncWebServer-esphome @ 3.1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- ArduinoJson @ 6.18.5
Compiling .pioenvs/wemosblink/src/esphome/components/api/api_connection.cpp.o
xtensa-lx106-elf-g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
*** [.pioenvs/wemosblink/src/esphome/components/api/api_connection.cpp.o] Error 1
========================= [FAILED] Took 106.77 seconds =========================

It looks like the c++ compiler didn’t install.
This is HAOS on a Raspberry Pi3.

I was never able to compile ESPHome on my Pi3, not enough RAM.

Yep, that looks very much like the Pi isn’t happy about the load and kills the process. Try again to compile and take a close look at CPU and RAM load. You’ll likely see 100% load and after a while, the process gets killed and the load falls back to normal.

That was the reason why I changed from Pi3 to Pi4 and ultimately to a small home server. ESPHome is quite heavy an your CPU load. Not long, but enough to kill a not very potent setup.

As an alternative you can install ESPHome on your normal PC or laptop, and use that one to compile the firmware. Afterwards you download it and flash it OTA via your standard ESPHome add-on from HA.

Thanks. I’ve never run Home Assistant on a Pi before so I wasn’t expecting any memory problems.

At any rate I installed ESPHome 2024.4.1 on my PC to continue my testing. The Pi goes back into the drawer.

It is still possible to compile on RPI3 if you increase the swap file size. 2GB should do the trick. I had to do it for RPI3B+ that would usually crash HA when I tried to compile in esphome.
How to increase swap file size

Thanks for the information. I’ve marked it as the solution since others will likely have the same issue.

In my case, I was troubleshooting an ESPHome WiFi problem and wanted a “disposable” installation. Basically, a device compiled on ESPHome2024.4 will not connect to the WiFi, while the same device and configuration file compiled on ESPHome 2024.3 does connect.

My HomeAssistant host is an Intel NUC i3 with a 500Gb SSD. Since I found a way to have older versions of the ESPHome Add-On installed, I am able to continue my troubleshooting there.

FYI: