Problem
When I use the official document to install Apache Mesos on Ubuntu 12.04, I receive the following problem in the console:
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
make[2]: *** [slave/containerizer/mesos/libmesos_no_3rdparty_la-containerizer.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f log/.deps/liblog_la-log.Tpo log/.deps/liblog_la-log.Plo
mv -f slave/containerizer/.deps/libmesos_no_3rdparty_la-docker.Tpo slave/containerizer/.deps/libmesos_no_3rdparty_la-docker.Plo
mv -f log/.deps/liblog_la-consensus.Tpo log/.deps/liblog_la-consensus.Plo
mv -f slave/containerizer/.deps/libmesos_no_3rdparty_la-external_containerizer.Tpo slave/containerizer/.deps/libmesos_no_3rdparty_la-external_containerizer.Plo
mv -f log/.deps/liblog_la-coordinator.Tpo log/.deps/liblog_la-coordinator.Plo
mv -f slave/.deps/libmesos_no_3rdparty_la-slave.Tpo slave/.deps/libmesos_no_3rdparty_la-slave.Plo
mv -f master/.deps/libmesos_no_3rdparty_la-master.Tpo master/.deps/libmesos_no_3rdparty_la-master.Plo
make[2]: Leaving directory `/root/Mesos/mesos/build/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/Mesos/mesos/build/src'
make: *** [all-recursive] Error 1
What am I supposed to do?
Asked by pugna
Solution #1
Try running dmesg (shortly after the failure).
Do you see something along these lines?
Out of memory: Kill process 23747 (cc1plus) score 15 or sacrifice child
Killed process 23747, UID 2243, (cc1plus) total-vm:214456kB, anon-rss:178936kB, file-rss:5908kB
That is most likely your issue. When you execute make -j 8, it starts a number of processes that require a lot of memory. When your system runs out of memory, the scenario described above happens. Instead of the entire system collapsing in this instance, the operating system conducts a process to score each process on the system. The operating system kills the one with the highest score to free up memory. If the process that is killed is cc1plus, gcc reads this as the process crashing and concludes that it must be a compiler problem (possibly wrongly). But it isn’t; the issue is that the OS destroyed cc1plus rather than crashing it.
You are running out of RAM if this is the case. So instead of make, try make -j 4. This will mean fewer parallel jobs and will mean the compilation will take longer but hopefully will not exhaust your system memory.
Answered by Jon Combe
Solution #2
(It could be a memory problem.)
If anyone is still having trouble with this (nearly 2 years after the question was posed), CryptoCurrencyTalk has a method that seems to work.
I’m posting it here for your convenience.
Run these (adjust bs= and count= to the amount of swap you want)
You should now be able to compile your code. However, after compilation, be sure to revert the swapon with the following:
Answered by ribbit
Solution #3
Type: to see if your CentOS installation already has swap enabled:
sudo swapon --show
If the output is empty, it signifies that swap space is not enabled on your system.
Set up a swap file.
1.Make a file that will serve as a swap space. One block is equal to bs. The number of blocks is called count. It will be given 1024K * 1M = 1G of storage capacity.
sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
2.Make sure the swap file can only be read and written by the root user:
chmod 600 /swapfile sudo
3.create a swap area on the file in Linux
sudo mkswap /swapfile
4.activate the swap
sudo swapon /swapfile
You may see the swap space by typing “sudo swapon —show” or “sudo free -h.”
Answered by Li Yingjun
Solution #4
In my circumstance (compiling Mesos on CentOS 7) on an AWS EC2 instance, this was the key.
I fixed issue by boosting memory and CPU to at least 4 GB of RAM and 2 vCPUs, respectively.
Answered by Traiano Welcome
Post is based on https://stackoverflow.com/questions/30887143/make-j-8-g-internal-compiler-error-killed-program-cc1plus