I have Gentoo installed on computer with relatively small amount of RAM (1 GB). When I install llvm (emerge -a llvm), the computer always goes out of memory. All 4 cc1plus processes are using about 25 % of RAM when the system is unusable. I think using only one process at a time could help.

How can I run llvm build (uses cmake and ninja) with only one compiler process?


I had a typo in make.conf:


I was trying a lot of other variants but I will write in few days. (Because the compilation takes several hours and if there is no RAM available, I must reboot it by disconnecting power even I use swap.)


Even though ninja isn’t make, its ebuild should recognize and respect any -j parameter specified in the MAKEOPTS environment variable. That means you should be able to force a maximum of one job via MAKEOPTS=-j1. You can do this on a one-time basis:

MAKEOPTS=-j1 emerge -a llvm

You can also set this change globally/permenantly for all packages on your system by editing the MAKEOPTS= line in /etc/portage/make.conf.

However, if you set MAKEOPTS=-j1 via your shell or make.conf, the parallelization settings will be applied to all packages which emerge installs. If you want to apply it to just that one package, you can create the file called /etc/portage/env/sys-devel/llvm (create any missing directories if necessary) and place these contents in it:


This will apply the variable only to the llvm package itself.

How to do this in the shell:

mkdir -p /etc/portage/env/sys-devel
echo MAKEOPTS=-j1>>/etc/portage/env/sys-devel/llvm

Ninja and MAKEOPTS

In Gentoo, because people rely on MAKEOPTS=-j«n» to control the number of jobs, various eclasses and ebuilds will map this variable’s -j parameter to the equivalent for the acutal build system in use. You can see this in eclass/ninja-utils.eclass (which is used by cmake-utils.eclass which is used by llvm). That snippet extracts just the -j parameter and passes it to ninja because ninja supports that parameter while it might not support other things people place in MAKEOPTS.

Disclaimer: I haven’t actually tested this with the latest llvm ebuild. Please comment if there are issues with this answer!

  • See update of the answer. :-( – jiwopene Sep 19 '18 at 14:57
  • @jiwopene Ah, I see. So it looks like you were trying to use MAKEFLAGS, ended up accidentally calling it MAKEFAGS instead, and yet neither of those are supported envvars. It’s MAKEOPTS ;-) – binki Sep 19 '18 at 15:09
  • I was compiling again, so I am going to stop it and retry. – jiwopene Sep 19 '18 at 15:12
  • It looks it is now OK. – jiwopene Sep 19 '18 at 16:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.