vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
666 stars 78 forks source link

Installation error because can't build eventmachine gem #319

Closed codepuncher closed 5 years ago

codepuncher commented 6 years ago

I couldn't install Landrush and was getting this error:

➜  trellis git:(master) ✗ vagrant plugin install landrush
Installing the 'landrush' plugin. This can take a few minutes...
Fetching: eventmachine-1.0.9.1.gem (100%)
Building native extensions.  This could take a while...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

ERROR: Failed to build gem native extension.

    current directory: /home/lee/.vagrant.d/gems/2.4.3/gems/eventmachine-1.0.9.1/ext
/opt/vagrant/embedded/bin/ruby -r ./siteconf20180405-26435-1gmqmd0.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/opt/vagrant/embedded/bin/$(RUBY_BASE_NAME)
    --with-ssl-dir
    --without-ssl-dir
    --with-ssl-include
    --without-ssl-include=${ssl-dir}/include
    --with-ssl-lib
    --without-ssl-lib=${ssl-dir}/lib
    --with-openssl-config
    --without-openssl-config
    --with-pkg-config
    --without-pkg-config
/opt/vagrant/embedded/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /opt/vagrant/embedded/lib/ruby/2.4.0/mkmf.rb:542:in `try_link0'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/mkmf.rb:557:in `try_link'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/mkmf.rb:658:in `try_ldflags'
    from /opt/vagrant/embedded/lib/ruby/2.4.0/mkmf.rb:1818:in `pkg_config'
    from extconf.rb:65:in `pkg_config_wrapper'
    from extconf.rb:92:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/lee/.vagrant.d/gems/2.4.3/extensions/x86_64-linux/2.4.0/eventmachine-1.0.9.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/lee/.vagrant.d/gems/2.4.3/gems/eventmachine-1.0.9.1 for inspection.
Results logged to /home/lee/.vagrant.d/gems/2.4.3/extensions/x86_64-linux/2.4.0/eventmachine-1.0.9.1/gem_make.out

In my case, this is because I needed to install the build-essential package from my package manager.

On Linux Mint 18.2 I ran this command sudo apt install build-essential which allowed the extensions to be built.

hferentschik commented 6 years ago

To build native extensions things like gcc, make, etc need to be on the system. By installing build-essential you got these tools installed. So it is not per se an issue of Landrush. One could argue that the docs could mention it as a requirement.

hferentschik commented 5 years ago

Added some more troubleshooting info via pull request #337

Tom32i commented 4 years ago

I've got the exact same error on MacOs 10.15.6. Here's how to get the build-essential on MacOs: xcode-select --install (it fixed it for me).