Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Not enough memory to compile on OrangePi Zero

Featured Replies

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.

Solved by NicoD

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
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

 

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".

 

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.

 

  • Author

Thanks a bunch, it did work (at least, for the first soft I wanted to compile).
That's great!

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.