fog-openstack
fog-openstack copied to clipboard
Add hint regarding build-essential package (Ubuntu/Debian) for development
What's the problem?
Working on a clean Ubuntu/Debian system (VM or container), running bin/setup fails since native extensions of Ruby dependencies which should be installed cannot be built.
Error message:
Fetching parser 2.4.0.0
Installing parser 2.4.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/var/lib/gems/2.3.0/gems/json-2.1.0/ext/json/ext/generator
/usr/bin/ruby2.3 -r ./siteconf20171024-6-1d5p8it.rb extconf.rb
creating Makefile
current directory: /var/lib/gems/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR=" clean
sh: 1: make: not found
current directory: /var/lib/gems/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR="
sh: 1: make: not found
make failed, exit code 127
In my opinion, build-essential should not be assumed to be present anyway, since this is clearly not the case for containers or fresh VMs.
How to reproduce?
$ cat > Dockerfile << EOF
> FROM ubuntu:xenial
> RUN apt-get update && \
apt-get install -y software-properties-common git && \
add-apt-repository -y ppa:brightbox/ruby-ng && \
apt-get update && \
apt-get install ruby2.3 ruby2.3-dev && \
gem install bundler
> RUN git clone https://github.com/fog/fog-openstack.git
> WORKDIR fog-openstack
> ENTRYPOINT ["./bin/setup"]
> EOF
$ docker build -t apophis90/fog-test
$ docker run --rm apophis90/fog-test
bundle install
+ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/.
....
Fetching parser 2.4.0.0
Installing parser 2.4.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
How to fix?
In case of Ubuntu/Debian, installing the build-essential package is enough.
$ cat > Dockerfile << EOF
> FROM ubuntu:xenial
> RUN apt-get update && \
apt-get install -y software-properties-common git build-essential && \
add-apt-repository -y ppa:brightbox/ruby-ng && \
apt-get update && \
apt-get install ruby2.3 ruby2.3-dev && \
gem install bundler
> RUN git clone https://github.com/fog/fog-openstack.git
> WORKDIR fog-openstack
> ENTRYPOINT ["./bin/setup"]
> EOF
$ docker build -t apophis90/fog-test
$ docker run --rm apophis90/fog-test
Admittedly, I cannot tell how the situation e.g. on RHEL/CentOS looks like and if additional packages must be installed for these. I've not tested yet.
I suggest adding a corresponding hint to the development instructions in README. It might be similar to this:
# If you're on Ubuntu/Debian, install build tools before installing dependencies
$ sudo apt-get install build-essential
...
# Install dependencies
$ bin/setup
...
However, since this is a distribution-specific issue, this cannot simply be added to the copy-paste part discussed in PR #318 . So maybe this should be covered in a separate subsection beforehand.