ESP32 Won't Compile. xtensa-esp32-elf-g++: internal compiler error: Killed (program cc1plus)

Hello, ESPHome keeps failing to compile.
It’s always this error:
xtensa-esp32-elf-g++: internal compiler error: Killed (program cc1plus)

This started happening when I updated Home Assistant to 2022.11.3, and ESPHOME to version 2022.11.1. I did have a working ESP32 working but that is also having the same error. So I’ve come to conclude it is something with the software.

Any help would be helpful. Thanks

Things I’ve tried:
-rebooting Home assistant
-trying different ESP32s
-restarting ESPHOME
-reinstalling ESPHOME

===INFORMATION===
Home Assistant 2022.11.3
Supervisor 2022.10.2
Operating System 9.3
Frontend 20221108.0 - latest

ESPHOME 2022.11.1

===CODE===

esphome:
  name: esphome-web-0edb00

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-0Edb00"
    password: "90ZIt4EGiof3"

captive_portal:

===LOGS===

INFO Reading configuration /config/esphome/esphome-web-0edb00.yaml...
INFO Generating C++ source...
INFO Core config or version changed, cleaning build files...
INFO Deleting /data/esphome-web-0edb00/.pioenvs
INFO Deleting /data/esphome-web-0edb00/.piolibdeps
INFO Compiling app...
Processing esphome-web-0edb00 (board: esp32dev; framework: arduino; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
Library Manager: Installing esphome/AsyncTCP-esphome @ 1.2.2
INFO Installing esphome/AsyncTCP-esphome @ 1.2.2
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Installing esphome/ESPAsyncWebServer-esphome @ 2.1.0
INFO Installing esphome/ESPAsyncWebServer-esphome @ 2.1.0
Unpacking  [####################################]  100%
Library Manager: [email protected] has been installed!
INFO [email protected] has been installed!
Library Manager: Resolving dependencies...
INFO Resolving dependencies...
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- AsyncTCP-esphome @ 1.2.2
|-- WiFi @ 1.0
|-- FS @ 1.0
|-- Update @ 1.0
|-- ESPAsyncWebServer-esphome @ 2.1.0
|   |-- AsyncTCP-esphome @ 1.2.2
|-- DNSServer @ 1.1.0
|-- ESPmDNS @ 1.0
Compiling /data/esphome-web-0edb00/.pioenvs/esphome-web-0edb00/src/esphome/components/api/api_connection.cpp.o
Compiling /data/esphome-web-0edb00/.pioenvs/esphome-web-0edb00/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/esphome-web-0edb00/.pioenvs/esphome-web-0edb00/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/esphome-web-0edb00/.pioenvs/esphome-web-0edb00/src/esphome/components/api/api_pb2_service.cpp.o
xtensa-esp32-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
*** [/data/esphome-web-0edb00/.pioenvs/esphome-web-0edb00/src/esphome/components/api/api_pb2.cpp.o] Error 4
========================= [FAILED] Took 34.92 seconds =========================

As it’s not likely the code being compiled, could it be resources such as insufficient memory on the device running HA?

1 Like

You’re kinda late. But you are correct. I decided to hook it up to a display and was getting an error along the lines of “insufficient memory, killing process…blah…blah…blah…”

Now in the process of find a new pi.

Oh wait…

1 Like

It doesn’t have to be a pi.

I have the same / similar issue. I read in the latest ESPHome update that you could run the pi on 1 core, and it would help. The issue is I can’t find the post with the details on how to set the Pi to run on a single core?

Its a RAM issue, so that probably isn’t an issue.

I tried again shortly after restarting HA, and it compiled.

Hi, it would be possible to avoid the compile process before to load the program to an ESP? I mean that the project would be compiled on another machine (IE a PC) and RPI would only load it to an ESP wirelessy connected to it… Is it possible?

this works!!

Sorry that I missed your message, yes it is possible.

I want to contribute to this too. Im running HA in a virtual machine with 1024MB Ram. but when I join the “party line” (open the VM from virt-manager) there actually are messages that the process got killed because out of RAM.

Why not install ESPHome on a fast machine and start it when you need it? The Addon is convenient, but not a must. You’ll probably be done building way soomer.

The only downside I know of is that the update sensors in HA for the devices won’t work, but everything else should work just fine.
https://esphome.io/guides/installing_esphome.html

1 Like

in case anyone is coming here looking for an alternative:
if you are running HAOS on a raspberry pi from a usb SSD* (which I highly recommend vs an sd card), you can add swap space using this method and it will resolve this and any other out of memory issues you have.

  • you can do the same thing on the SD card, but it will drastically reduce the lifespan of your SD card due to the high number of writes.