2

Here is the error message:

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.6/README.Bugs> for instructions.
make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

The very last thing make was processing is apprentice.lo which appears to be part of the image manipulation libraries (maybe?). I am using Ansible to provision my instance. It is a Digital Ocean single core 512MB VM.

I have been using vagrant / ansible with the same config locally for dev and it has compiled fine, this is the first cloud VM I am attempting to provision. The only difference is the base image for my DO server is coming from DO and for my local dev, I built my own Vagrant box via VirtualBox from a stock CentOS basic server install. I pull it down from my DropBox.

The problem has been experienced by others and reported as a php bug report

My php ansible role up to the error:

---
- name: Download php source
  get_url: url={{ php_source_url }} dest=/tmp
  register: get_url_result

- name: untar the source package
  command: tar -xvf php-{{ php_version }}.tar.gz chdir=/tmp
  when: get_url_result.changed or php_reinstall

- name: configure php 5.5
  command: >
    ./configure
    --prefix={{ php_prefix }}
    --with-config-file-path={{ php_config_file_path }}
    --enable-fpm
    --enable-ftp
    --enable-mbstring
    --enable-pdo
    --enable-soap
    --enable-sockets=shared
    --enable-zip
    --with-curl
    --with-fpm-group={{ nginx_group }}
    --with-fpm-user={{ nginx_user }}
    --with-freetype-dir=/usr/lib64/
    --with-gd
    --with-jpeg-dir=/usr/lib64/
    --with-libdir=lib64
    --with-mcrypt
    --with-openssl
    --with-pdo-mysql
    --with-pear
    --with-readline
    --with-tidy
    --with-xsl
    --with-zlib
    --without-pdo-sqlite
    --without-sqlite3
    chdir=/tmp/php-{{ php_version }}
  when: get_url_result.changed or php_reinstall

- name: make clean when reinstalling
  command: make clean chdir=/tmp/php-{{ php_version }}
  when: php_reinstall

- name: make php
  command: make chdir=/tmp/php-{{ php_version }}
  when: get_url_result.changed or php_reinstall

Thanks in advance for any help. :)

  • 2
    If you're running this on a 512MB VM, try grep -i OOM /var/log/messages - it's just a guess but you may have run out of memory and had gcc terminated by the kernel. If this is the problem, there are actually gcc optimization flags that cause the compiler to use less ram during compilation (as a side effect of doing less compiler optimization). – Some Linux Nerd May 29 '14 at 02:48
  • 1
    You were right, it is a out of memory problem. I was able to bypass it by enabling a [swap file](http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-swap-adding.html) for the current session. Thanks for pointing me in the right direction! Its amazing to think that software libs have gotten bloated, because servers with 128MB could handle this no problem just a few years ago... – Christopher Mancini May 29 '14 at 06:28
  • Why don't you use existing php packages, e.g. from remi-php55 – Michael Hampton May 30 '14 at 16:52
  • So that I have more control over what and how my stack gets installed. It also saves me from breaking an application because something was upgraded via yum before the application/s was fully tested. Not to mention, certain stack components like PHP or Nginx can see significant performance boosts by only installing the specific modules / extensions needed for your applications. – Christopher Mancini May 31 '14 at 18:32

1 Answers1

7

This was due to an OOM (out of memory) event causing the compiler process to be killed which I was able to determine with 'Some Linux Nerds' help. To circumvent this when you can't just add memory to the machine, I used a swap file. Here are the commands I used that I found here:

dd if=/dev/zero of=/swapfile bs=1024 count=262144
mkswap /swapfile
swapon /swapfile

I did not enable it to persist after reboot because 512MB is enough for what I need this box for on a day to day basis, so I omitted that command. I reran my make on the PHP source code and it completed successfully.