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

Upgrade json version to latest #267

Closed
wants to merge 1 commit into from
Closed

Upgrade json version to latest #267

wants to merge 1 commit into from

Conversation

dandunckelman
Copy link
Contributor

I wanted to install this plugin with the latest Vagrant (v.1.8.1 when I went to https://www.vagrantup.com/downloads.html) but received errors when bundle tries installing the json gem v1.7.7. So, I figured I'd try getting the install to work with the latest JSON gem.

To do this, I performed the following on an Ubuntu v14.04 VM with Ruby v2.2.2 (via RVM):

  • Fork repo

  • Clone repo to my box

    git clone https://github.com/dandunckelman/vagrant-openstack-provider.git
    
  • Create topic branch

    cd vagrant-openstack-provider
    git checkout -b upgrade-json-dependency
    
  • Setup Ruby environment (since I use RVM):

    cd source/
    echo "2.2.2" > .ruby-version
    echo "vagrant-openstack-provider" > .ruby-gemset
    
  • Install specific bundler version (since the Vagrant v1.7.4 gem requires bundler (<= 1.10.5, >= 1.5.2))

    gem install bundler -v 1.10.5
    
  • Install gems

    bundle
    
  • Run tests

    bundle exec rake
    
  • Build as a gem

    bundle exec rake build
    
  • Install plugin from gem

    cd ../../my-vagrant-project/
    vagrant plugin install ../vagrant-openstack-provider/source/pkg/vagrant-openstack-provider-0.7.0.gem
    

Then the install worked as expected. I assume that this would fix the following issues: #265 &
#266

@dandunckelman
Copy link
Contributor Author

@ggiamarchi should I update the .travis.yml to do the following?

  • Add 2.2.0 to the rvm list
  • Add VAGRANT_VERSION=v1.8.1 BUNDLER_VERSION=1.10.5 to the matrix list

or something similar?

@dandunckelman
Copy link
Contributor Author

@ggiamarchi my bad! I just saw this PR: #237

Closing...

@shubhamrajvanshi
Copy link

I get below error while following your steps. Sorry never worked on ruby

bundle
Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching https://github.com/mitchellh/vagrant.git
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
vagrant was resolved to 1.7.4, which depends on
bundler (<= 1.10.5, >= 1.5.2)

Current Bundler version:
bundler (1.11.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?

Could not find gem 'bundler (<= 1.10.5, >= 1.5.2)', which is required by gem 'vagrant', in any of the sources.
Shubhams-MacBook-Pro:source shubham$ bundle exec rake
The git source https://github.com/mitchellh/vagrant.git is not yet checked out. Please run bundle install before trying to start your application
Shubhams-MacBook-Pro:source shubham$

@dandunckelman
Copy link
Contributor Author

@shubhamrajvanshi The response tells you 2 important things:

Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.

Check the content of your Gemfile and ensure there is only one instance of gem "vagrant-openstack-provider"

Bundler could not find compatible versions for gem "bundler":
In Gemfile:
vagrant was resolved to 1.7.4, which depends on
bundler (<= 1.10.5, >= 1.5.2)

Current Bundler version:
bundler (1.11.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?

Could not find gem 'bundler (<= 1.10.5, >= 1.5.2)', which is required by gem 'vagrant', in any of the sources.

Your current version of bundler is 1.11.2, which is the latest. The vagrant gem requires any version between 1.5.2 and 1.10.5. So, ensure you have installed the correct version of bundler:

gem install bundler -v 1.10.5

@v1k0d3n
Copy link
Contributor

v1k0d3n commented Jan 10, 2016

it seems like users are still having issues perhaps? this is leading down a dependency headache on multiple systems; at least from what i've tested so far, which is CentOS/Fedora and OSX. i've been looking at this over this for a couple of days, but like eparis mentioned in one his posts (referenced below), I'm not familiar enough with vagrant/ruby enough to contribute anything of value.

there are similar dependency issues referenced in #236 #237 #265 #266. as i mentioned in one of the other issues, i don't know if ditching system package managers is really the right approach. is there possibly another solution that could better solve this issue? i'm running into problems on OS X, Fedora, and CentOS so far, and none of the recommendations seemed to work (referring to #236), they just seem to hit on other, more complicated dependency problems.

Are there specific instructions for vagrant 1.8 and higher, or was 1.8 the version that seemed to break everything?

as i mentioned in #266 going to 1.7.4 seemed to resolve the dependency issue for OS X (but not for CentOS or Fedora), but then i ran into an issue with the plugin couldn't determine the Network ID declared in a Vagrantfile for another repository.

kubernetes-retired/contrib#349 (comment)

these issues seem a little more complicated to resolve, when compared to other Vagrant plugins i've used in the past (especially for non-ruby users like myself).

Installing json 1.7.7 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby -r ./siteconf20160110-22964-1x7z0ca.rb extconf.rb
creating Makefile

make "DESTDIR=" clean
rm -f
rm -f generator.so  *.o  *.bak mkmf.log .*.time

make "DESTDIR="
gcc -I. -I/usr/include -I/usr/include/ruby/backward -I/usr/include -I. -DJSON_GENERATOR    -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC -O3 -Wall -O0 -ggdb -m64 -o generator.o -c generator.c
In file included from /usr/include/stdio.h:27:0,
                 from /usr/include/ruby/defines.h:26,
                 from /usr/include/ruby/ruby.h:29,
                 from /usr/include/ruby.h:33,
                 from ../fbuffer/fbuffer.h:5,
                 from generator.c:1:
/usr/include/features.h:328:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_to_s':
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                               ^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
     VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                    ^
Makefile:238: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/share/gems/gems/json-1.7.7 for inspection.
Results logged to /usr/local/lib64/gems/ruby/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

@dandunckelman
Copy link
Contributor Author

@v1k0d3n are you trying to use a Ruby version newer than 2.0.0? If so, please try using v2.0.0 since Vagrant is only supporting that version and not newer ones. Because of that, this plugin also doesn't support a newer Ruby version.

@v1k0d3n
Copy link
Contributor

v1k0d3n commented Jan 11, 2016

@dandunckelman On OSX (system error as shown above):

$ ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
$ 

@v1k0d3n
Copy link
Contributor

v1k0d3n commented Jan 11, 2016

and this is kind of what i'm referring to, no matter what solution...this takes users down a crazy road of dependency issues. i wish i knew more about ruby and vagrant, so i could even help out...but i just don't.

and just to give some background...i blew away everything vagrant related (including some licenses i had) to try and start clean, but it's still failing.

OSX01:WORKING user$ cd ~/WORKING/

OSX01:WORKING user$ git clone https://github.com/dandunckelman/vagrant-openstack-provider.git
Cloning into 'vagrant-openstack-provider'...
remote: Counting objects: 4220, done.
remote: Total 4220 (delta 0), reused 0 (delta 0), pack-reused 4220
Receiving objects: 100% (4220/4220), 883.65 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2940/2940), done.
Checking connectivity... done.
Checking out files: 100% (121/121), done.

OSX01:WORKING user$ cd vagrant-openstack-provider

OSX01:vagrant-openstack-provider user$ git checkout -b upgrade-json-dependency
Switched to a new branch 'upgrade-json-dependency'

OSX01:vagrant-openstack-provider user$ cd source/

OSX01:source user$ echo "2.2.2" > .ruby-version

OSX01:source user$ echo "vagrant-openstack-provider" > .ruby-gemset

OSX01:source user$ gem install bundler -v 1.10.5

OSX01:source user$ sudo gem install bundler -v 1.10.5
Fetching: bundler-1.10.5.gem (100%)
Successfully installed bundler-1.10.5
Parsing documentation for bundler-1.10.5
Installing ri documentation for bundler-1.10.5
1 gem installed

OSX01:source user$ bundle
Your Gemfile lists the gem vagrant-openstack-provider (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching https://github.com/mitchellh/vagrant.git
Checking out files: 100% (1261/1261), done.
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 10.4.2
Installing addressable 2.4.0
Using bundler 1.10.5
Installing thor 0.19.1
Installing appraisal 1.0.0
Installing ast 2.2.0
Installing parser 2.2.3.0
Installing astrolabe 1.3.1
Installing builder 3.2.2
Installing byebug 8.2.1 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14/ruby/config.h', needed by `breakpoint.o'.  Stop.


Gem files will remain installed in /var/folders/0r/_801_sx56pv_m8b491fcnfsh0000gn/T/bundler20160111-234-jc9bm8byebug-8.2.1/gems/byebug-8.2.1 for inspection.
Results logged to /var/folders/0r/_801_sx56pv_m8b491fcnfsh0000gn/T/bundler20160111-234-jc9bm8byebug-8.2.1/gems/byebug-8.2.1/ext/byebug/gem_make.out
An error occurred while installing byebug (8.2.1), and Bundler cannot continue.
Make sure that `gem install byebug -v '8.2.1'` succeeds before bundling.
OSX01:source user$ 

@Sharpie
Copy link
Contributor

Sharpie commented Jan 18, 2016

If so, please try using v2.0.0 since Vagrant is only supporting that version and not newer ones.

Hashicorp's Vagrant 1.8.x packages, released last month, ship Ruby 2.2.3 --- which is why this JSON issue is popping back into the spotlight.

@charlesa101
Copy link

@Sharpie: how did you solve this ?

@Sharpie
Copy link
Contributor

Sharpie commented Jan 19, 2016

@charlesa101 The changes proposed in this PR resolve the JSON dependency problem.

@charlesa101
Copy link

oh ok..thank you @Sharpie ...works now!

@v1k0d3n
Copy link
Contributor

v1k0d3n commented Jan 19, 2016

@Sharpie I posted that I was running ruby version 2.0.0.

@dandunckelman
Copy link
Contributor Author

@Sharpie thanks! Because I deleted the original fork, I've created a new PR: #268

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.

5 participants