Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "nokogiri" as a runtime dependency #298

Merged
merged 1 commit into from
May 25, 2017

Conversation

legal90
Copy link
Collaborator

@legal90 legal90 commented May 20, 2017

This PR fixes #297

In Vagrant 1.9.5 there was "nokogiri" gem removed from the Vagrant bundle: hashicorp/vagrant#8571
So now we should specify it as a dependency of vagrant-parallels gem if we want to use it.

NB! After that PR is merged & released, it will cause a crash of plugin upgrade/installation with Vagrant 1.9.5, similar to this hashicorp/vagrant#8594
To work it around we need to define a special env variable while installing the plugin:

export NOKOGIRI_USE_SYSTEM_LIBRARIES=true 
vagrant plugin install vagrant-parallels

Hopefully, this trick will not be needed for future versions of Vagrant (after 1.9.5), since it was fixed in the Vagrant installer: hashicorp/vagrant-installers#104

@domibarton
Copy link

domibarton commented May 22, 2017

I didn't had any problems installing vagrant-parallels via:

vagrant plugin install vagrant-parallels

But as soon as I do a vagrant up I get the following error:

/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- nokogiri (LoadError)

Installing the nokogiri gem is not possible, beacuse of a certification error:

ERROR:  Could not find a valid gem 'nokogiri' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

The default cert file points to an invalid location:

/opt/vagrant/embedded/bin/ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE'

So the workaround is to install Vagrant 1.9.4 until this issue is fixed…

@moxley
Copy link

moxley commented May 24, 2017

This is happening to me, on a clean system (macOS Sierra 10.12.5), starting from scratch:

$ vagrant --version
Vagrant 1.9.5
$ prlctl | grep version
prlctl version 12.2.0 (41591)
$ vagrant plugin install vagrant-parallels
Installing the 'vagrant-parallels' plugin. This can take a few minutes...
Fetching: vagrant-parallels-1.7.4.gem (100%)
Installed the plugin 'vagrant-parallels (1.7.4)'!
$ mkdir ubuntu
$ cd ubuntu/
$ vagrant init parallels/ubuntu-14.04
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
$ vagrant up
/opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- nokogiri (LoadError)
	from /opt/vagrant/embedded/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	from /Users/moxley2/.vagrant.d/gems/2.2.5/gems/vagrant-parallels-1.7.4/lib/vagrant-parallels/driver/base.rb:2:in `<top (required)>'
	from /Users/moxley2/.vagrant.d/gems/2.2.5/gems/vagrant-parallels-1.7.4/lib/vagrant-parallels/driver/meta.rb:4:in `require_relative'
	from /Users/moxley2/.vagrant.d/gems/2.2.5/gems/vagrant-parallels-1.7.4/lib/vagrant-parallels/driver/meta.rb:4:in `<top (required)>'
	from /Users/moxley2/.vagrant.d/gems/2.2.5/gems/vagrant-parallels-1.7.4/lib/vagrant-parallels/provider.rb:16:in `usable?'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:387:in `block in default_provider'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:385:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:385:in `default_provider'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/plugin/v2/command.rb:174:in `block in with_target_vms'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/plugin/v2/command.rb:201:in `call'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/plugin/v2/command.rb:183:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/up/command.rb:131:in `install_providers'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/plugins/commands/up/command.rb:85:in `execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/cli.rb:42:in `execute'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/lib/vagrant/environment.rb:308:in `cli'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.9.5/bin/vagrant:138:in `<main>'
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=true vagrant plugin install nokogiri
Installing the 'nokogiri' plugin. This can take a few minutes...
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 ./siteconf20170524-2870-un0mdg.rb extconf.rb
checking if the C compiler accepts ... *** 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
/opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:456: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.2.0/mkmf.rb:571:in `block in try_compile'
	from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
	from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
	from extconf.rb:138:in `nokogiri_try_compile'
	from extconf.rb:162:in `block in add_cflags'
	from /opt/vagrant/embedded/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
	from extconf.rb:161:in `add_cflags'
	from extconf.rb:406:in `<main>'

extconf failed, exit code 1

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

$ # Installed Apple's Developer Tools, to install clang
$ # Installed Apple's Developer Tools, to install clang
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=true vagrant plugin install nokogiri
Installing the 'nokogiri' plugin. This can take a few minutes...
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 ./siteconf20170524-2903-1y3ja25.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 system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

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

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

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

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

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

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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=true
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-xml2-dir
	--without-xml2-dir
	--with-xml2-include
	--without-xml2-include=${xml2-dir}/include
	--with-xml2-lib
	--without-xml2-lib=${xml2-dir}/lib
	--with-libxml-2.0-config
	--without-libxml-2.0-config
	--with-pkg-config
	--without-pkg-config
	--with-xslt-dir
	--without-xslt-dir
	--with-xslt-include
	--without-xslt-include=${xslt-dir}/include
	--with-xslt-lib
	--without-xslt-lib=${xslt-dir}/lib
	--with-libxslt-config
	--without-libxslt-config
	--with-pkg-config
	--without-pkg-config
	--with-exslt-dir
	--without-exslt-dir
	--with-exslt-include
	--without-exslt-include=${exslt-dir}/include
	--with-exslt-lib
	--without-exslt-lib=${exslt-dir}/lib
	--with-libexslt-config
	--without-libexslt-config
	--with-pkg-config
	--without-pkg-config

extconf failed, exit code 1

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

$ gem install pkg-config -v "~> 1.1.7"
Fetching: pkg-config-1.1.9.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
$ sudo gem install pkg-config -v "~> 1.1.7"
Password:
Fetching: pkg-config-1.1.9.gem (100%)
Successfully installed pkg-config-1.1.9
Parsing documentation for pkg-config-1.1.9
Installing ri documentation for pkg-config-1.1.9
1 gem installed
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=true vagrant plugin install nokogiri
Installing the 'nokogiri' plugin. This can take a few minutes...
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 ./siteconf20170524-2927-qzyqsa.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 system libraries.
pkg-config could not be used to find libxml-2.0
Please install either `pkg-config` or the pkg-config gem per

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

pkg-config could not be used to find libxslt
Please install either `pkg-config` or the pkg-config gem per

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

pkg-config could not be used to find libexslt
Please install either `pkg-config` or the pkg-config gem per

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

ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed.
*** 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=true
	--with-zlib-dir
	--without-zlib-dir
	--with-zlib-include
	--without-zlib-include=${zlib-dir}/include
	--with-zlib-lib
	--without-zlib-lib=${zlib-dir}/lib
	--with-xml2-dir
	--without-xml2-dir
	--with-xml2-include
	--without-xml2-include=${xml2-dir}/include
	--with-xml2-lib
	--without-xml2-lib=${xml2-dir}/lib
	--with-libxml-2.0-config
	--without-libxml-2.0-config
	--with-pkg-config
	--without-pkg-config
	--with-xslt-dir
	--without-xslt-dir
	--with-xslt-include
	--without-xslt-include=${xslt-dir}/include
	--with-xslt-lib
	--without-xslt-lib=${xslt-dir}/lib
	--with-libxslt-config
	--without-libxslt-config
	--with-pkg-config
	--without-pkg-config
	--with-exslt-dir
	--without-exslt-dir
	--with-exslt-include
	--without-exslt-include=${exslt-dir}/include
	--with-exslt-lib
	--without-exslt-lib=${exslt-dir}/lib
	--with-libexslt-config
	--without-libexslt-config
	--with-pkg-config
	--without-pkg-config

extconf failed, exit code 1

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

@legal90
Copy link
Collaborator Author

legal90 commented May 24, 2017

@moxley Currently the easiest solution is downgrading Vagrant to 1.9.4. You can download it here:
https://releases.hashicorp.com/vagrant/1.9.4/vagrant_1.9.4_x86_64.dmg

Then vagrant plugin install vagrant-parallels will be completed successfully, without any errors related to nokogiri.

@moxley
Copy link

moxley commented May 24, 2017

@legal90: Thanks, that worked!

@romankulikov
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to start up parallels provider since Vagrant 1.9.5
4 participants