Hi, now I went through all my add-ons and stopped the ones I don’t need to have enough RAM memory. And this was the solution!
So, I recommend to stop all components which are not important for the moment and run the compilation. For example: Grafana, Home Assistant Google… and after compiling in ESPHome you can start them again.
Totally true, I thought I had 2G rasp4 but It looks I have 1G and it is why as you said i don’t have enough ram memory.
I have the exact problem. Also, I don’t think this is a RAM problem. I added the system monitor add-on, and it might just be an overheating problem, RAM seems fine.
So as a workaround, I installed esphome to my macbookair and from the terminal I went to the esphome folder over samba and tried to compile my yaml file there from the command line and it didn’t work. I then copied my yaml esphome project file to a local folder and tried to compile it there and it worked.
This is what the error shows like from the esphome folder at homeassistant:
Compiling .pioenvs/lgtv-controller/lib37d/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
Compiling .pioenvs/lgtv-controller/lib37d/ESPAsyncTCP-esphome/ESPAsyncTCPbuffer.cpp.o
Archiving .pioenvs/lgtv-controller/lib788/libESP8266WiFi.a
xtensa-lx106-elf-ar: .pioenvs/lgtv-controller/lib788/libESP8266WiFi.a: error reading .pioenvs/lgtv-controller/lib788/ESP8266WiFi/WiFiServerSecureAxTLS.cpp.o: Is a directory
*** [.pioenvs/lgtv-controller/lib788/libESP8266WiFi.a] Error 1
Compiling .pioenvs/lgtv-controller/lib37d/ESPAsyncTCP-esphome/SyncClient.cpp.o
However this error is much later in the compile. When I compile at homeassistant mine gets stuck at the 4th line as well.
I thought this might also be a problem that’s in the esphome folder in the homeassitant. I copied the homeassistant esphome folder to local and did a compile on it locally but it worked this time, so folder is fine I guess. I will backup the homeassistant esphome folder and create a fresh one and place the project yaml there and try to compile again. Also I was able to succesfully do a compile in homeassistant once while using a handheld blower blowing air to my raspberry pi3b. I ordered an ice tower in hopes to avoid this overheating issue. I will let you know how that works too.
This also might be related to this problem as well:
https://community.home-assistant.io/t/home-assistant-just-stops-working/300865
I believe I solved the compile freeze problem.
It seems to be an overheating issue.
I believe installing an Ice Tower Cooler fixed the issue.
The nice thing was that I was able to use it with the original pi case by trimming a bit of the mounting plastics in the case.
This is what it looks like now after installing it.
It came with a transparent fan with multi-color LEDs, which was a bit noisy and used ~40mA @5V. This fan came already installed on the cooler.
The package also included an additional noiseless fan without LEDs which used ~20mA @5V. I replaced the transparent one with this better fan.
This is how my Pi 3B+ processor temperature looked like before installing the Ice Tower Cooler, averaging at 54 °C.
And this is how it looks like after installing the cooler, averaging at 34°C.
The cooler made a big difference in the temperature, which is about -20°C. You can see the temperature spike on the picture above where I was able to successfully compile after installing the cooler. It seems that compilation creates an additional 8°C. Adding 8 to 54 you get 64, which apparently was enough for the pi to go crazy.