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

rake bootstrap fails with Ruby 2.2 due to json gem #63

Open
chrisballinger opened this issue May 25, 2016 · 4 comments
Open

rake bootstrap fails with Ruby 2.2 due to json gem #63

chrisballinger opened this issue May 25, 2016 · 4 comments

Comments

@chrisballinger
Copy link

I noticed this when attempting to test my fix for this issue: CocoaPods/CocoaPods#5291

It can be fixed by modifying cocoapods-trunk's Gemfile to point to this gem:

# This is the version that ships with OS X 10.10, so be sure we test against it.
# At the same time, the 1.7.7 version won't install cleanly on Ruby > 2.2,
# so we use a fork that makes a trivial change to a macro invocation.
gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7.7-ruby-2.2'
Bootstrapping cocoapods-trunk
rake --no-search bootstrap
/Users/chrisbal/.rbenv/versions/2.2.3/bin/bundle

--------------------------------------------------------------------------------
Installing gems
--------------------------------------------------------------------------------

bundle install
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
Using i18n 0.7.0
Installing json 1.7.7 with native extensions

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

    /Users/chrisbal/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160524-86331-ilxmzy.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:47: error: too few arguments provided to function-like macro invocation
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
                                              ^
/Users/chrisbal/.rbenv/versions/2.2.3/include/ruby-2.2.0/ruby/intern.h:793:9: note: macro 'rb_str_new' defined here
#define rb_str_new(str, len) __extension__ (    \
        ^
In file included from generator.c:1:
./../fbuffer/fbuffer.h:175:11: warning: incompatible pointer to integer conversion initializing 'VALUE' (aka 'unsigned long') with an expression of type 'VALUE (const char *, long)' (aka 'unsigned long (const char *, long)') [-Wint-conversion]
    VALUE result = rb_str_new(FBUFFER_PAIR(fb));
          ^        ~~~~~~~~~~
1 warning and 1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/chrisbal/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/json-1.7.7 for inspection.
Results logged to /Users/chrisbal/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/json-1.7.7/gem_make.out
@guillaumealgis
Copy link

Disclaimer: I'm a huge Ruby noob. Please bear with me :/

I think the patch applied to the Gemfiles broke the install when using Ruby 2.0.0.
I'm using a default Ruby install on 10.11, and when running rake bootstrap I'm getting:

--------------------------------------------------------------------------------
Installing gems
--------------------------------------------------------------------------------

bundle install
Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Resolving dependencies...
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.7.7 from https://github.com/segiddins/json.git (at seg-1.7.7-ruby-2.2@a9588bc)

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="
linking shared-object json/ext/generator.bundle

make "DESTDIR=" install
/usr/bin/install -c -m 0755 generator.bundle ./.gem.20160831-7164-whwbxw/json/ext
install: ./.gem.20160831-7164-whwbxw/json/ext: No such file or directory
make: *** [install-so] Error 71


Gem files will remain installed in /Users/guillaume/.bundle/ruby/2.0.0/json-a9588bc4334c for inspection.
Results logged to /Users/guillaume/.bundle/ruby/2.0.0/json-a9588bc4334c/ext/json/ext/generator/gem_make.out

... SNIP ...

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.
rake aborted!
Command failed with status (5): [bundle install...]
/Users/guillaume/Projects/Rainforest/cocoapods-trunk/Rakefile:9:in `block in <top (required)>'
/Users/guillaume/.gem/ruby/2.0.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => bootstrap
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [rake --no-search bootstrap...]
/Users/guillaume/Projects/Rainforest/Rakefile:115:in `block (3 levels) in <top (required)>'
/Users/guillaume/Projects/Rainforest/Rakefile:113:in `chdir'
/Users/guillaume/Projects/Rainforest/Rakefile:113:in `block (2 levels) in <top (required)>'
/Users/guillaume/Projects/Rainforest/Rakefile:112:in `each'
/Users/guillaume/Projects/Rainforest/Rakefile:112:in `block in <top (required)>'
/Users/guillaume/Projects/Rainforest/Rakefile:54:in `block in <top (required)>'
/Users/guillaume/.gem/ruby/2.0.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => bootstrap_repos
(See full trace by running task with --trace)

Reverting the patch by replacing gem 'json', :git => 'https://github.com/segiddins/json.git', :branch => 'seg-1.7.7-ruby-2.2' by gem 'json', '1.7.7' in all Gemfiles I could find fixed the issue and rake bootstrap finished nicely.

Bundle complete! 12 Gemfile dependencies, 35 gems now installed.

System info

$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G31

$ type -a ruby
ruby is /usr/bin/ruby

$ ruby --version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

@dlo
Copy link

dlo commented Nov 17, 2016

I'm getting this error as well.

@tejasmanohar
Copy link

Same :\

@icecrystal23
Copy link

I worked around this particular issue by explicitly installing bundler v1.3 (instead of 2.0.x which was installed by default when I ran gem install bundler)

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

No branches or pull requests

5 participants