Compilation fails : xtensa-lx106-elf-g++: fatal error: Killed signal terminated program cc1plus

I had the same problem on my RasPi 3B+. The compile_process_limit: 1 option didn’t help. The compile would fail at random points, which is consistent with a memory shortage. What did work is running it on a different computer, as others have said above and in the thread at Esphome killing home assistant (a very good resource for this issue). As an extra bonus, compiling on my Windows machine is MUCH faster. The downside is that you have to learn to use the ESPHome command line interface, but the only command you really need to use is “esphome run <file.yaml>”. The commands are listed at Command Line Interface — ESPHome.

First, install ESPHome on your computer by following the steps at Installing ESPHome Manually — ESPHome. You have to install Python, then use pip to install esphome. The steps in the guide are pretty clear and they worked for me with no problem.

Then make a working folder and copy the yaml file from your HA ESPhome dashboard into that folder. Open a Windows command window (Start > type “cmd”) and cd into the working folder). Then type the command “esphome run yaml-file-name”). ESPHome will compile the yaml and load it OTA or by USB onto your ESP device. You will probably recognize what it is doing since it looks like the ESPHome dashboard results.

When it works, it is pretty painless, and pretty fast. And best of all, since the compile is done on your Windows (or Mac) machine, it doesn’t use any memory on the RasPi or HA device. You don’t need to stop other processes or addons. You can edit the yaml file on your Windows machine using Notepad, or you can edit it on the ESPHome dashboard if you want the indentation markings and red squiggly lines showing errors.

Once the yaml is compiled and loaded onto the ESP device, the ESP will communicate with the HA device like normal. In other words, compiling and loading from the “big” computer doesn’t affect how the ESP devices communicates with the Home Assistant computer.

This post doesn’t say anything that other people haven’t said better already (thanks). I’m mainly trying to say that (1) don’t be afraid to run ESPHome on a different computer, (2) don’t be afraid of the CLI, you probably only need one command, and (3) this solves the compilation problems completely by moving the compilation to a stronger computer.

Good luck.

9 Likes

I have RPi 3 B+ and have the same issue.

Same - RPi 4

I had a similar error. I was able to fix it by swapping to a real power supply for a Raspberry. I had previously used the USB socket of the power strip and then any power supply. With both I had an xtensa error. Since the new power supply no longer.

Brilliant - This worked for me, thanks :slight_smile: Seems like a memory problem for my device. I stopped everything I could, too - but the compile limit was the key.

1 Like

Hi,
I followed your instruction and got the esphome folder as well as the .esphome folder in the same folder I had my yaml.
But, I couldn’t find the bin file, to be uploaded to the d1 mini.
where is it? or I should do something else?
Thanks.

If you’re still troubleshooting this, fumbling thru it myself. I “think” the .bin file you’re looking for, if it showed compiled correctly when you did it should be under the .esphome folder → build → “name you specified” → .pioenvs → “name you specified” ← in this folder you should find a “firmware.bin” file.

I was getting the same errors and what worked for me was just enabling this option in HA so you don’t have to put the “compile_process_limit: 1” like in each your device config files:

Settings → Add-ons → Esphome → configuration tab → Toggle on:
“Show unused optional configuration options” and then put 1 in
“default_compile_process_limit”

This worked, but only AFTER a reboot (rebooting all add-ons)

When I just tried to add the line in the device config file it did not work. Bust this was probably because I did not reboot after getting the compile error.

3 Likes

this was super helpful, thanks. Only addition was needing to also save “secrets.yaml”

I have same problem


then I installed Python on my windows computer, and I run esphome file.yaml but I got this new error
Now I need help to upgrade PlatformIO Core 6 … thanks in advance

Do not cross post…

For me the seem, rpi3B stopt all my add-ons, and compiling works fine.

For me running on VM 2Gb RAM, had that error, increased for 4Gb and problem solved.

I just ran into the same issue on rpi 3b going from esphome 2023.12.6-8. Adding the “default_compile_process_limit” equals 1 option and rebooted but still had issues. I ended up stopping file editor, node-red, and nuts, then it compiled. Thanks for the tips everyone. Maybe it’s time to upgrade to a rpi 4 or 5. :wink:

Had this very issue just last night on a Dell Wyse thin client with 8gb of ram and this little tidbit really helped so thank you very much!

Putting the default_compile_process_limit on 1 worked for me (Raspberry pi 2). Processor ballast changed from almost 100% to 35% during the compilation process.

Its a memory related issue i was using Rpi 3 1gb with esphome and Frigate installed hitting idle utilization at 0.7 gigs , after manually stopping Frigate and some more services its working now