3

i want to install restclient in ruby. I get these message:

Building native extensions.  This could take a while...
ERROR:  Error installing rest-client:
ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/unf_ext-0.0.7.4/ext/unf_ext
/usr/bin/ruby2.3 -r ./siteconf20170427-2260-1nc7gtz.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.3.0/gems/unf_ext-0.0.7.4 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.4/gem_make.out

My terminal command was: sudo gem install rest-client

Can anybody help me?

r.az91
  • 41
  • 1
  • 4

3 Answers3

1

development header files are missing on your system, Run :

sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
aqfaridi
  • 719
  • 7
  • 11
1

If you have this in your stack trace:

Makefile:207: recipe for target 'unf.o' failed

You're missing build-essential g++. On Ubuntu you can install this with:

sudo apt-get install build-essential g++

Then rerun:

sudo gem install rest-client
0

You need first to make sure that you have the header files for compiling extension modules for Ruby. If you are using Ubuntu (Ubuntu 16.04.3 LTS), check it like this:

apt list --installed | grep ruby-all-dev

If nothing is found, then install it:

sudo apt-get install ruby-all-dev

Now you can go ahead and install rest-client:

sudo gem install rest-client
Yuci
  • 27,235
  • 10
  • 114
  • 113