Native extension error installing JSON gem - ruby

I've set up the Brightbox Ruby 2.1.0 apt package and encountering a native compilation error installing json package.
$ sudo gem install json -v '1.8.1'
Fetching: json-1.8.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
I've installed ruby2.0-dev as mentioned here, but it puts the headers in a different folder (/usr/include/ruby-2.0.0/ruby, and copying them to /usr/lib/ruby/include didn't help). Any idea how to install this gem?

I imagine you'll need to install the ruby2.1-dev package, rather than ruby2.0-dev, if you're using Ruby 2.1. I've not used the Brightbox packages though, so I'm only guessing I'm afraid.

Related

Rubocop installing error: Failed to build gems

I'm currently having this problem when i try to install Rubocop(I can't install nokigiri either):
~$ sudo gem install rubocop
Building native extensions. This could take a while...
ERROR: Error installing rubocop:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
/usr/bin/ruby2.5 -r ./siteconf20190320-24856-1cn9xqz.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/jaro_winkler-1.5.2 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/jaro_winkler-1.5.2/gem_make.out
I've tried others solutions, but none worked.
Anyone knows why i'm getting this error ?
Thx
You need to install development headers for ruby 2.5, you don't have a development environment installed:
sudo apt-get install ruby2.5-dev
May also be called -devel depending on your packaging system.

cannot install sqlite3 using gem

I'm trying to install Metasploit on my Raspberry Pi 2.
But when I try to execute this command:
gem install wirble sqlite3 bundler
I get this error:
Successfully installed wirble-0.1.3 Parsing documentation for
wirble-0.1.3 Done installing documentation for wirble after 2 seconds
Building native extensions. This could take a while... ERROR: Error
installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in
/var/lib/gems/2.1.0/gems/sqlite3-1.3.13 for inspection. Results logged
to
/var/lib/gems/2.1.0/extensions/arm-linux/2.1.0/sqlite3-1.3.13/gem_make.out
Successfully installed bundler-1.15.4 Parsing documentation for
bundler-1.15.4 Done installing documentation for bundler after 73
seconds 2 gems installed
The system is missing ruby dev files. If you are using Debian
sudo apt-get install ruby-dev
should do the work.
Install ruby-dev using your package managers. (package name may differ across different linux distros)

ruby 2.4.1 ERROR: Failed to build gem native extension

I upgraded ruby from 2.1.. to 2.4.1 on windows, and installed the msys2 toolkit.
however each time install a gem calling Makefile I am getting a ERROR: Failed to build gem native extension
c:\>gem install oj
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing oj
ERROR: Failed to build gem native extension.
current directory: C:/tools/ruby24/lib/ruby/gems/2.4.0/gems/oj-3.1.3/ext/oj
C:/tools/ruby24/bin/ruby.exe -r ./siteconf20170616-1724-1fw22px.rb extconf.rb
Creating Makefile for ruby version 2.4.1 on x64-mingw32
creating Makefile
extconf.rb:68:in ``': No such file or directory - make clean
(Errno::ENOENT)
from extconf.rb:68:in `<main>'
extconf failed, exit code 1
I am also getting similar errors when installing some other gems like json

Can't install Jekyll on MacOS Sierra 10.12.1

I'm trying to install Jekyll using:
sudo gem install jekyll
but I get a error, I had found a solution on early mac version not for Sierra
this is the output:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.17/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170117-1518-aaehhb.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.17 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/ffi-1.9.17/gem_make.out
thanks for advance!
You have to install the Ruby DevKit. Depending on your installation of Ruby, you have to select the correct way to install it.

json doesn't install

I am having a problem getting my ruby system up and running. Specifically, I get the following error when trying
gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
c:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
generating parser-i386-mingw32.def
compiling parser.c
gcc.exe: CreateProcess: No such file or directory
make: *** [parser.o] Error 1
Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.
Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.6.3/ext/json/ext/pa
I know that my gcc works. I don't get the same error when installing
`gem install json_pure
However, when I try a
bundle install
I get the error. I am extremely new to ruby and rails, so any help would be appreciated.
install devkit with --force option

Resources