Jump to content

Not enough memory to compile on OrangePi Zero


Go to solution Solved by NicoD,

Recommended Posts

Posted

Hi,

 

I think I already know the answer to my question, but I'll ask it anyway.
 

 arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/libxml2 -Isrc -Isrc/lxml/includes -I/usr/include/python3.6m -c src/lxml/etree.c -o build/temp.linux-armv7l-3.6/src/lxml/etree.o -w
  arm-linux-gnueabihf-gcc: internal compiler error: Killed (program cc1)

Most of the time, when I get gcc killed on a board, that's because of a lack of memory. I have launched several times the compilation and monitored with htop, and it looks like the memory and swap are full.
I did not fully understand what's going on with the zram and so on, but I think that we can't add swap on the SDCard (which is such a bad idea, I know) on top of this zram.

So, my question is: can we add some more swap, so that I can go to the end of the compilation process?
Thanks.

Posted

See I am a noob at all this. But I found somewhere that these commands can release RAM. Maybe give them a try prior to compiling

/usr/lib/armbian/armbian-ramlog write >/dev/null 2>&1

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches

The first one clears RamLog and the second clears the Buff/Cache.

Try these just for fun.

Or wait for the gurus to give the apt answer

  • Solution
Posted
7 hours ago, gounthar said:

So, my question is: can we add some more swap, so that I can go to the end of the compilation process?

You can create a swap file for this.
If you're using an sd-card then it will be very slow, but it will work. You can use zram and swap files together. It will first use zram, then swap file.
Here is how to create a swapfile. This is for 8GB, if you only need 1GB then use 1GB. When done just reverse the commands and delete /swapfile (sudo rm /swapfile)

sudo fallocate -l 8G /swapfile                Allocate 8GB for swapfile
sudo chmod 600 /swapfile                      Give the correct rights for the swapfile
sudo mkswap /swapfile                         Make it a swapfile
sudo swapon /swapfile                         Turn on the swapfile
sudo nano /etc/fstab                          Open fstab and add the line ...

 /swapfile swap swap defaults 0 0

 

Posted

Note also that many build scripts will attempt to use several cores to speed things up, but the RAM-to-core ratio of SBCs is often not very favourable to this.

 

You can usually add an option on the command line (often -j) to set the number of parallel jobs to run. 1 or 2 is probably more suitable than defaults like 4 or "number of cores" or "number of cores + 1".

 

Posted
6 hours ago, NicoD said:

You can create a swap file for this.
If you're using an sd-card then it will be very slow, but it will work. You can use zram and swap files together. It will first use zram, then swap file.
Here is how to create a swapfile. This is for 8GB, if you only need 1GB then use 1GB. When done just reverse the commands and delete /swapfile (sudo rm /swapfile)


sudo fallocate -l 8G /swapfile                Allocate 8GB for swapfile
sudo chmod 600 /swapfile                      Give the correct rights for the swapfile
sudo mkswap /swapfile                         Make it a swapfile
sudo swapon /swapfile                         Turn on the swapfile
sudo nano /etc/fstab                          Open fstab and add the line ...

 /swapfile swap swap defaults 0 0

This setup works for me, but I use a fast 32Gb SDCARD. I can compile GCC 9.2.0 without failure on this board.

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines