geerlingguy/ansible-role-ruby

failing to execute make and sudo make install

serixscorpio opened this issue · 4 comments

First of all, thanks so much for putting this together. This is super helpful!
I use this role as part of preparing a docker image.

I came across a failure to execute make and sudo make install when I got to the build task:

...
TASK: [geerlingguy.ruby | Install packages required to build ruby (Debian).] ***
... (output omitted) ...
checking for pthread.h... yes
checking if make is GNU make... no
checking for safe null command for make... 
failed: [localhost] => (item=make) => {"cmd": "make", "failed": true, "item": "make", "rc": 2}
msg: [Errno 2] No such file or directory
failed: [localhost] => (item=sudo make install) => {"changed": true, "cmd": ["sudo", "make", "install"], "delta": "0:00:00.084430", "end": "2015-03-13 02:03:22.352892", "item": "sudo make install", "rc": 1, "start": "2015-03-13 02:03:22.268462", "warnings": []}
stderr: sudo: make: command not found

The docker base image I am using is ansible/ubuntu14.04-ansible:stable. Presumably this base image has minimal packages pre-installed. So I looked into the packages required to install ruby from source on ubuntu. After installing build-essential libffi-dev libgdbm-dev libncurses5-dev libreadline-dev libssl-dev libyaml-dev zlib1g-dev, the make error from the build task went away.

So, I think the role depends on the build tools being available in order to install ruby from source. Thoughts?

All the packages besides build-essential should be installed on any Debian/Ubuntu-based system (see: https://github.com/geerlingguy/ansible-role-ruby/blob/master/tasks/install-from-source.yml#L16-L24). I haven't had any issues installing on my own Ubuntu 12.04 or 14.04 minimal images (but using a VM instead of Docker); do you know what specific package might be missing that's included in build-essential to get this to install?

I saw the same behavior on an Ubuntu 14.04 cloud image installed on a VM. Adding build-essential to the package list fixes it. Is there a reason it isn't included?

I've added it now, in an effort to make the source build a little more plug-and-play (especially since I'm now using it to build ruby for some other roles' Docker-based tests :).

(Use 2.4.1 or later of this role).