Error: Installing vagrant gem in ruby 2.0.0 - ruby

When I tried to install vagrant gem in ruby 2.0.0-p0, I am getting follwoing error:
~ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
~ gem -v
2.0.0.rc.2
~ gem list json
*** LOCAL GEMS ***
json (1.7.7)
~ gem install vagrant
Building native extensions. This could take a while...
ERROR: Error installing vagrant:
ERROR: Failed to build gem native extension.
/home/user_name/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
checking for ruby/re.h... yes
checking for ruby/encoding.h... yes
creating Makefile
make
compiling generator.c
generator.c: In function ‘cState_aref’:
generator.c:736:5: warning: variable ‘state’ set but not used [-Wunused-but-set-variable]
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext
/usr/bin/install: cannot create regular file `/home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/json/ext': No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5 for inspection.
Results logged to /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/json-1.5.5/ext/json/ext/generator/gem_make.out
I figure, its using json-1.5.5 from /home/user_name/.rvm/gems/ruby-2.0.0-p0/gems/ while building the gem and getting the above error.
I tried re-installing the latest json-1.7.7 gem and still it fails to install.

Update your rubygems with: gem update --system
Here is the commit that fixed this issue: https://github.com/rubygems/rubygems/commit/1ca11d00833bbca33215ff581303d1fee8f2d1ef

Related

gem install not finding ruby.h file

I am trying to use bundle install to install fastlane. I am having an issue installing one of the dependencies, json 2.6.1. I get the following error.
Fetching json 2.6.1
Installing json 2.6.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
C:/tools/ruby30/bin/ruby.exe -I C:/tools/ruby30/lib/ruby/3.0.0 -r
./siteconf20211128-18184-scdpps.rb extconf.rb
creating Makefile
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
make DESTDIR\= clean
current directory:
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1/ext/json/ext/generator
make DESTDIR\=
generating generator-x64-mingw32.def
compiling generator.c
In file included from generator.c:1:
../fbuffer/fbuffer.h:5:10: fatal error: ruby.h: No such file or directory
5 | #include "ruby.h"
| ^~~~~~~~
compilation terminated.
make: *** [Makefile:245: generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/tools/ruby30/lib/ruby/gems/3.0.0/gems/json-2.6.1 for inspection.
Results logged to
C:/tools/ruby30/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/json-2.6.1/gem_make.out
An error occurred while installing json (2.6.1), and Bundler cannot continue.
Make sure that `gem install json -v '2.6.1' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
fastlane was resolved to 2.198.1, which depends on
json
I have the following specs on my system.
windows 10
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
Gemfile
source "https://rubygems.org"
gem "fastlane"
Thanks for the help!

gem install json issue with Mac OS X 10.11

I'm trying to install Ruby/JSON on Mac OS X 10.11.
However, the gem install command gives the error message:
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/smcho/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20151025-39148-au2m2x.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: warning: directory not found for option '-L/Users/haven/.sm/pkg/active/lib'
make "DESTDIR=" install
./install -m 0755 generator.bundle ./.gem.20151025-39148-i7g03f/json/ext
make: ./install: No such file or directory
make: *** [install-so] Error 1
make install failed, exit code 2
Gem files will remain installed in /Users/smcho/.rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /Users/smcho/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
The message says make: ./install: No such file or directory, but I'm not sure how to fix this issue.
Is this a known issue, or is there a way to bypass this one?
This is my system version. I executed gem update --system to get the latest version.
> ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
> gem -v
2.4.8
I should have used the latest ruby (2.2.3) not the old one (2.2.1)
ruby-rails-sample> rvm --default use 2.2.3
Using /Users/smcho/.rvm/gems/ruby-2.2.3
smcho#macho ruby-rails-sample> gem install json
Building native extensions. This could take a while...
Successfully installed json-1.8.3
Parsing documentation for json-1.8.3
Installing ri documentation for json-1.8.3
Done installing documentation for json after 1 seconds
1 gem installed

Error installing RedCloth (4.2.9) on OS X 10.9.2

I try to install Jekyll with pages, using enter link description here.
The process stops when installing RedCloth (4.2.9): "Make sure that gem install RedCloth -v '4.2.9' succeeds before bundling."
The results below (I changed https in H due to url limitations in this Question).
I run OS X 10.9.2
Step 1 = OK
mikea:mego mikea$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Step 2 = OK
mikea:mego mikea$ sudo gem install bundler
Password:
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
1 gem installed
Step 3 = NOK
mikea:mego mikea$ bundle install
Fetching gem metadata from H://rubygems.org/.......
Fetching additional metadata from h://rubygems.org/..
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-cflags=-w
checking for main() in -lc... yes
creating Makefile
make "DESTDIR="
compiling redcloth_attributes.c
compiling redcloth_inline.c
compiling redcloth_scan.c
linking shared-object redcloth_scan.bundle
clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [redcloth_scan.bundle] Error 1
Gem files will remain installed in /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9 for inspection.
Results logged to /Users/mikea/.bundler/tmp/25125/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
I solved this by install rbenv with brew, and then install ruby 2.1.1 through rbenv. Finally change the ruby version to 2.1.1. Here is the command:
$brew update
$brew install rbenv
$rbenv install 2.1.1
$rbenv global 2.1.1
log out. Now you can try your 3 step.
I did not use hue answer to install rbenv with brew. Maybe you can use it.
I solved the problem by using Terminal, first go to the folder in Sites and then type:
jekyll serve --watch --baseurl ""

Error updating Ruby gem sequel_pg

when I try to install the Ruby gem sequel_pg I get the following error meassage:
~$ sudo gem update
Updating installed gems
Updating sequel_pg
Building native extensions. This could take a while...
ERROR: Error installing sequel_pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for PQsetSingleRowMode()... no
creating Makefile
make
compiling sequel_pg.c
sequel_pg.c: In function ‘spg_timestamp_error’:
sequel_pg.c:279:3: error: format not a string literal and no format arguments [- Werror=format-security]
cc1: some warnings being treated as errors
make: *** [sequel_pg.o] Error 1
Gem files will remain installed in /var/lib/gems/1.9.1/gems/sequel_pg-1.6.5 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/sequel_pg-1.6.5/ext/sequel_pg/gem_make.out
Nothing to update
I am running Lubuntu 13.04. The depencies: pg and sequel are installed. Packages files postgresql and postgresql-server-dev-9.1 is also installed
Does anyone have a clue?
This bug was fixed in master of the gem with this patch. You should wait for new release or install head version of the gem.

Error installing caldecott on Ubuntu

In Ubuntu 12.10 when I run the following command
gem install caldecott
I get the following error message
Building native extensions. This could take a while...
ERROR: Error installing caldecott:
ERROR: Failed to build gem native extension.
/home/luisramalho/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
generator.c: In function ‘cState_aref’:
generator.c:632:5: warning: variable ‘state’ set but not used [-Wunused-but-set-variable]
generator.c: In function ‘isArrayOrObject’:
generator.c:867:5: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
linking shared-object json/ext/generator.so
make install
/usr/bin/install -c -m 0755 generator.so /home/luisramalho/.rvm/gems/ruby-2.0.0-p0/gems/json-1.6.8/ext/json/ext/json/ext
/usr/bin/install: cannot create regular file `/home/luisramalho/.rvm/gems/ruby-2.0.0-p0/gems/json-1.6.8/ext/json/ext/json/ext': No such file or directory
make: *** [install-so] Error 1
Gem files will remain installed in /home/luisramalho/.rvm/gems/ruby-2.0.0-p0/gems/json-1.6.8 for inspection.
Results logged to /home/luisramalho/.rvm/gems/ruby-2.0.0-p0/gems/json-1.6.8/ext/json/ext/generator/gem_make.out
Anyone has any idea what might be causing this?
Just to make it easier for the next person here is the soln from user comment here (https://github.com/appfog/af/issues/27#issuecomment-19190069) :
$ rvm install ruby-1.9.3-p484
$ rvm use 1.9.3
$ gem install af
[...]
$ gem install caldecott
[... long list of dependencies being installed which didn't happen for Ruby 2.0]
$ af login
$ af tunnel

Resources