Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Windows install fails due to JSON gem dependency. #60

Open
jamiebegin opened this issue Mar 21, 2013 · 7 comments
Open

Windows install fails due to JSON gem dependency. #60

jamiebegin opened this issue Mar 21, 2013 · 7 comments

Comments

@jamiebegin
Copy link

I'm not much of a Ruby guy, but it looks like there's a dependency on a JSON gem somewhere. This particular gem includes C extension that needs to be compiled, which causes the build to bomb on Windows:

C:\temp\vagtest>vagrant plugin install vagrant-salt
Installing the 'vagrant-salt' plugin. This can take a few minutes...
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:556:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        C:/vagrant/vagrant/embedded/bin/ruby.exe extconf.rb
creating Makefile

make
generating generator-i386-mingw32.def
compiling generator.c
make: gcc: Command not found
make: *** [generator.o] Error 127


Gem files will remain installed in C:/Users/jjbegin/.vagrant.d/gems/gems/json-1.7.7 for inspection.
Results logged to C:/Users/jjbegin/.vagrant.d/gems/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:534:in `block in build_extensions'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:509:in `each'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:509:in `build_extensions'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:297:in `block in install'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `each_with_index'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:270:in `install'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-.1.2/plugins/commands/plugin/action/install_gem.rb:27:in `block in call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/plugins/commands/plugin/gem_helper.rb:42:in `block in with_environment'
        from C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/user_interaction.rb:40:in `use_ui'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/plugins/commands/plugin/gem_helper.rb:41:in `with_environment'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-.1.2/plugins/commands/plugin/action/install_gem.rb:23:in `call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-.1.2/plugins/commands/plugin/action/bundler_check.rb:20:in `call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/action/warden.rb:34:in `call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/action/builder.rb:109:in `call'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/action/runner.rb:61:in `block in run'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/util/busy.rb:19:in `busy'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/action/runner.rb:61:in `run'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/plugins/commands/plugin/command/base.rb:17:in `action'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-.1.2/plugins/commands/plugin/command/install.rb:28:in `execute'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/plugins/commands/plugin/command/root.rb:47:in `execute'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/cli.rb:46:in `execute'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/environment.rb:406:in `cli'
        from C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/bin/vagrant:60:in `<top (required)>'
        from C:/vagrant/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `load'
        from C:/vagrant/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `<main>'

C:\temp\vagtest>

Is there any way "json_pure" can be used to eliminate the need for the C extension?

@jamiebegin
Copy link
Author

After further research, this doesn't appear to be a salty-vagrant problem and may not even be an issue with Vagrant itself. (If someone could clarify, that would be great.) However, I was able to resolve this issue:

Poking around in some old issues in the Vagrant project led me to this Stackoverflow answer. I then downloaded DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe from rubyinstaller.org. It's a self-extracting 7zip file that I expanded into 'C:\Users\jjbegin\Downloads\devkit' on my computer. I then executed the following:

C:\temp\vagtest>C:\vagrant\vagrant\embedded\bin\gem uninstall json
Successfully uninstalled json-1.5.4

C:\Users\jjbegin\Downloads\devkit> devkitvars.bat
Adding the DevKit to PATH...

C:\Users\jjbegin\Downloads\devkit>C:\vagrant\vagrant\embedded\bin\gem install json --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed json-1.7.7
1 gem installed
Installing ri documentation for json-1.7.7...
Installing RDoc documentation for json-1.7.7...

C:\Users\jjbegin\Downloads\devkit>vagrant plugin install vagrant-salt
Installing the 'vagrant-salt' plugin. This can take a few minutes...
Installed the plugin 'vagrant-salt (0.3.2)'!

C:\Users\jjbegin\Downloads\devkit>

@jamiebegin
Copy link
Author

While I seem to have solved the JSON problem, unfortunately I'm still having an issue with salty-vagrant on Windows 7. The relevant output when I run vagrant init:

::snip::
DEBUG vagrant: Creating Vagrant environment
 INFO environment: Environment initialized (#<Vagrant::Environment:0x2debd70>)
 INFO environment:   - cwd: C:/temp/vagtest
 INFO environment: Home path: C:/Users/jjbegin/.vagrant.d
 INFO environment: Local data path: C:/temp/vagtest/.vagrant
DEBUG environment: Creating: C:/temp/vagtest/.vagrant
DEBUG environment: Loading plugins from: C:/Users/jjbegin/.vagrant.d/plugins.jso
n
 INFO environment: Loading plugin from JSON: vagrant-notify
 INFO manager: Registered plugin: vagrant notify
 INFO environment: Loading plugin from JSON: vagrant-salt
ERROR root: Failed to load plugin: vagrant-salt
ERROR root:  -- Error: #<NameError: uninitialized constant Vagrant::Provisioners
>
ERROR root:  -- Backtrace:
ERROR root: C:/Users/jjbegin/.vagrant.d/gems/gems/vagrant-salt-0.3.2/lib/vagrant
-salt/provisioner.rb:2:in `<module:VagrantSalt>'
C:/Users/jjbegin/.vagrant.d/gems/gems/vagrant-salt-0.3.2/lib/vagrant-salt/provis
ioner.rb:1:in `<top (required)>'
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
36:in `require'
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
36:in `require'
C:/Users/jjbegin/.vagrant.d/gems/gems/vagrant-salt-0.3.2/lib/vagrant-salt.rb:2:i
n `<top (required)>'
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
60:in `require'
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
60:in `rescue in require'
C:/vagrant/vagrant/embedded/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
35:in `require'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant.rb:185:in `requi
re_plugin'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/environment.rb:6
47:in `block in load_plugins'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/environment.rb:6
44:in `each'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/environment.rb:6
44:in `load_plugins'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/lib/vagrant/environment.rb:1
28:in `initialize'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/bin/vagrant:53:in `new'
C:/vagrant/vagrant/embedded/gems/gems/vagrant-1.1.2/bin/vagrant:53:in `<top (req
uired)>'
C:/vagrant/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `load'
C:/vagrant/vagrant/bin//../embedded/../embedded/gems/bin/vagrant:23:in `<main>'
 INFO interface: error: Failed to load the "vagrant-salt" plugin. View logs for
more details.

Failed to load the "vagrant-salt" plugin. View logs for more details.

::snip::

Any ideas?

@akoumjian
Copy link
Contributor

Well, for one salty-vagrant is not yet released for the latest vagrant. You will need to run <1.1. Sorry about that! Release should be out very shortly!

@jamiebegin
Copy link
Author

Well, I guess that would explain it. :-) Confirmed that using Vagrant 1.0.7 doesn't result in these problems. Thank you for the quick suggestion. Closing.

@jamiebegin
Copy link
Author

The original problem that I raised is still an issue on the latest release (using the new plugin system). The good news, however, is that the workaround I discovered also still works. Is the root issue solvable here or is something that needs to raised with the Vagrant project?

@akoumjian
Copy link
Contributor

Has this issue been resolved?

@thusoy
Copy link

thusoy commented Oct 17, 2013

Not noticing that this had been merged into vagrant core, I tried to install it as a plugin and still got this error. But since it's now in vagrant 1.3, this wasn't needed, so close this and maybe add a banner to the readme stating that it's no longer necessary to install this as a plugin?

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

No branches or pull requests

3 participants