Cannot build phantomjs on a Ubuntu 14.04 VM

155 views
Skip to first unread message

Luc Juggery

unread,
Apr 10, 2015, 7:38:25 AM4/10/15
to phan...@googlegroups.com
Hello,

I got the following error when running ./build.sh

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.8/README.Bugs> for instructions.
make[2]: *** [.obj/loader/FrameLoader.o] Error 4
make[2]: Leaving directory `/home/luc/phantomjs/src/qt/qtwebkit/Source/WebCore'
make[1]: *** [sub-Target-pri-make_first-ordered] Error 2
make[1]: Leaving directory `/home/luc/phantomjs/src/qt/qtwebkit/Source/WebCore'
make: *** [sub-Source-WebCore-WebCore-pro-make_first-ordered] Error 2

Any idea what I can be missing ?
Thanks a lot,
Luc

Sean McNamara

unread,
Apr 10, 2015, 8:31:03 AM4/10/15
to phan...@googlegroups.com
As the error message says, this is some kind of internal compiler error within gcc. This is not a PhantomJS bug.

However, because of the fact that it says "Killed" (implying the cc1plus child process was terminated by a signal, e.g. SIGKILL), the most likely cause is that cc1plus ran out of memory. 

Check your dmesg log (kernel log ring buffer) to see if the OOM killer had been invoked. You can do this by running the dmesg command in a console.

If this was indeed due to OOM (Out Of Memory), the cause could be one of two things: either gcc is a 32-bit application and used up all of its ~4 GB of virtual address space (which doesn't mean you ran out of memory, just that the architecture limit of 32-bit was hit); or gcc is a 64-bit application and you literally ran out of memory. A slight nuance, though: if you hit the 4 GB limit but didn't run out of memory, the OOM killer would not be invoked; gcc would just crash because a malloc() failed. You might be seeing a different error message than "Killed" in that case, which makes me suspicious that the problem is *not* because of the 32-bit 4 GB limit. I'm pretty dang certain that the OOM killer was involved, unless you have some other daemon on your system that sends SIGKILLs to other processes for some other reason.

Here are some things to try: 

(a) give your VM more memory;
(b) increase your swap space;
(c) close down any other memory-intensive programs (like any GUI desktop environment you have running) to free up some memory;
(d) don't run a parallel build if you are doing so. 

Depending on how much memory the compiler will ultimately need to perform that compile step vs. the amount of memory you have available, you may need to perform one, two, three, or all four of these remedies.

PhantomJS includes extremely complicated libraries like QtWebKit that have been known to make compilers choke due to their sheer complexity. However, the amount of memory the compiler consumes is not necessarily the fault of the code. It could be a compiler bug that's either leaking memory, or using more memory than necessary.

If you want to explore the possibility of successfully compiling without changing the amount of memory allocated to the VM, the bitness of the compiler, *or* the swap space, you can try a different version of gcc (newer OR older, since the memory explosion may only appear in newer releases; who knows). The general rule of thumb is: if your current gcc version is several major releases older than the latest, you might as well try the latest release. If your gcc version is already the latest, try the highest-available minor release of the previous major release.

You can also try using a different compiler, such as Clang or icc. I have no idea if PhantomJS can build with either of those without source modifications, but you can still try it. Maybe they won't have the same huge memory requirements as gcc. Or maybe they will. :)

Sean

 

Any idea what I can be missing ?
Thanks a lot,
Luc

--
You received this message because you are subscribed to the Google Groups "phantomjs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phantomjs+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phantomjs.
For more options, visit https://groups.google.com/d/optout.

Luc Juggery

unread,
Apr 10, 2015, 8:40:18 AM4/10/15
to phan...@googlegroups.com
Thanks Sean, that makes a lot of sense, I may have some RAM issue on my VM.
Meanwhile, I used 'sudo apt-get install phantomjs' that work just fine (and obviously mush more faster to install :) ).
The bad thing is that it installs version 1.9
Thanks for your help.
Luc
Reply all
Reply to author
Forward
0 new messages