Fix “command ‘gcc’ failed with exit status 4” Once Installing lxml

Today I’m installing sentry on my VPS, I’m using ubuntu 14.04 on smallest instance on DigitalOcean. But the installation failed because of sentry depend on lxml and the lxml failed to install through python pip. Here is the error stacktrace.

cc: internal compiler error: Killed (program cc1)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
    Compile failed: command 'gcc' failed with exit status 4
    cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitRJR8OE.c -o tmp/xmlXPathInitRJR8OE.o
    cc tmp/xmlXPathInitRJR8OE.o -lxml2 -o a.out
    error: command 'gcc' failed with exit status 4

I don’t know what exactly going on with this, but after looking up on stackoverflow. Some answer told that this is memory problem, to fix this we just need to increase our memory by adding swapfile. Here is how to fix this.

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Now I could install sentry without any trouble with this lxml issue.

Reference: http://stackoverflow.com/questions/24455238/lxml-installation-error-ubuntu-14-04-internal-compiler-error

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s