mitchellh / vagrant-aws

Use Vagrant to manage your EC2 and VPC instances.
MIT License
2.61k stars 574 forks source link

failed to install due to iconv dependency #513

Open blalor opened 7 years ago

blalor commented 7 years ago
[:~] $ vagrant version
Installed Version: 1.9.5
Latest Version: 1.9.4

Huh, that's weird…

[:~] $ vagrant plugin install vagrant-aws
Installing the 'vagrant-aws' plugin. This can take a few minutes...
Fetching: ipaddress-0.8.3.gem (100%)
Fetching: mini_portile2-2.1.0.gem (100%)
Fetching: nokogiri-1.7.2.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.

    /opt/vagrant/embedded/bin/ruby -r ./siteconf20170517-23162-inpqgg.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv using --with-opt-* flags... no
checking for iconv... no
pkg-config could not be used to find libiconv
Please install either `pkg-config` or the pkg-config gem per

    gem install pkg-config -v "~> 1.1.7"

checking for iconv using pkg-config libiconv... no
-----
libiconv is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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)
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build

extconf failed, exit code 1

Gem files will remain installed in /Users/blalor/.vagrant.d/gems/2.2.5/gems/nokogiri-1.7.2 for inspection.
Results logged to /Users/blalor/.vagrant.d/gems/2.2.5/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.7.2/gem_make.out

I have libiconv installed via homebrew.

RobAWilkinson commented 7 years ago

Not sure the problem, but I dropped back to 1.9.1 and it installed fine

DanHam commented 7 years ago

This installed fine for me with version 1.9.4 of Vagrant.

I get the same error message as blalor with version 1.9.5.

@chrisroberts I noticed that nokogiri was removed for 1.9.5. The install of this plugin worked when Vagrant shipped with nokogiri included...

I've noticed this has already been mentioned here. However export NOKOGIRI_USE_SYSTEM_LIBRARIES=true does not seem to work for me

Roguelazer commented 7 years ago

Note to folks hit with this:

If you're on OS X and have libiconv installed via homebrew, you can work around this issue by installing nokogiri with the following command line:

LDFLAGS="-L$(brew --prefix libiconv)/lib" CFLAGS="-I$(brew --prefix libiconv)/include" vagrant plugin install nokogiri
axot commented 7 years ago
gem install nokogiri -- --use-system-libraries
export NOKOGIRI_USE_SYSTEM_LIBRARIES=true
LDFLAGS=$(brew --prefix libiconv)/lib CFLAGS=-I$(brew --prefix libiconv)/include vagrant plugin install vagrant-aws

works for me

richardreid14 commented 7 years ago

I'm able to install the plugin now with the solution above, but can't actually use it.

When I attempt a vagrant up, I get the following error:

require: dlopen(/Users/richardreid/.vagrant.d/gems/2.2.5/extensions/x86_64-darwin-13/2.2.0/nokogiri-1.8.0/nokogiri/nokogiri.bundle, 9): Library not loaded: /vagrant-substrate/staging/embedded/lib/libexslt.0.dylib (LoadError)

I've tried downgrading Vagrant, downgrading/upgrading Nokogiri, changing Ruby versions, and I'm still stumped. Anyone else experienced this?

greeno commented 7 years ago

Needed pkg-config from brew to fix me. brew install pkg-config