Compile errors with PhantomJS


Posted October 20th, 2015 inApplications

PhantomJS is a headless WebKit scriptable Javascript API, which I wanted to try out. Unfortunately there aren't many binary packages available so I had to compile it from source, but it came up with a bunch of compile errors.

Error message

This is the error message I got, but you'll probably get a different specific error, depending at which stage the compilation process fails:

{standard input}: Assembler messages:{standard input}:75591: Warning: end of file not at end of a line; newline inserted{standard input}:76119: Error: bad register name `%r'{standard input}: Error: open CFI at the end of file; missing .cfi_endproc directiveg++: internal compiler error: Killed (program cc1plus)Please submit a full bug report,with preprocessed source if appropriate.See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.make[2]: *** [.obj/generated/JSDOMWindow.o] Error 4make[2]: Leaving directory `/home/chris/phantomjs/src/qt/qtwebkit/Source/WebCore'make[1]: *** [sub-Target-pri-make_first-ordered] Error 2make[1]: Leaving directory `/home/chris/phantomjs/src/qt/qtwebkit/Source/WebCore'make: *** [sub-Source-WebCore-WebCore-pro-make_first-ordered] Error 2 The solution

I found on this message threada suggestion to increase the amount of RAM on the system. I was running a Debian 7.9 virtual machine on VMWare Fusion with just under 1GB of RAM. I shut it down, upped the RAM to 2GB, rebooted and started the build process again. This time it worked.

Unfortunately you may not have the luxury of simply adding more RAM to a VPS or VM, which potentially means you can't build it yourself. However, try running the build process again after it fails, because it will have already done a lot of the work and possibly won't need to much RAM next time.