ERROR: Error installing jekyll: ERROR: Failed to build gem native extension - ruby

My system has:
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
gem -version 2.2.2
devKit : DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
When I try to run gem install jekyll, I get this error:
D:\devKit>gem install jekyll
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
"D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe" extconf.rb
D:/Program Files (x86)/Ruby200-x64/bin/ruby.exe: invalid switch in RUBYOPT: -F (
RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in D:/Program Files (x86)/Ruby200-x64/lib/ruby/g
ems/2.0.0/gems/fast-stemmer-1.0.2 for inspection.
Results logged to D:/Program Files (x86)/Ruby200-x64/lib/ruby/gems/2.0.0/extensi
ons/x64-mingw32/2.0.0/fast-stemmer-1.0.2/gem_make.out

I got this error while installing Jekyll on Linux (Mint 17, which is based on Ubuntu 14.04).
I eventually found the solution here. I needed both the ruby-dev package and nodejs (the latter due to a bug in Jekyll).
sudo apt-get install ruby ruby-dev make
sudo gem install jekyll --no-rdoc --no-ri
sudo apt-get install nodejs

I ran into this problem too. Running the following installed Jekyll for me:
$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
$ sudo gem install jekyll
This installs RVM, updates Rails and installs Jekyll.
BTW - Most of the posts I've found indicate it's a problem with Xcode not having the developer tools installed. I have a newer MacBook Pro on which this stuff was installed by default, so attempting to install the Xcode dev tools did nothing for me (unlike the above, which did everything I needed).

try
gem update
then
gem install jekyll
And you may want to try with Ruby 1.9.3 and compatible DevKit.

Related

Failed While Installing Nokogiri on Ubuntu

I am trying to install nokogiri on Ubuntu Linux. I am running Ruby-2.1.1. I have installed.
Output:
sudo gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20181205-6502-3n3u4g.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/nokogiri-1.8.5 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/gem_make.out
Can anyone explain what I am missing?
Try installing Ruby 2.1.1 with rbenv and set it as default version in ubuntu:
rbenv install 2.1.1
rbenv global 2.1.1
After installing ruby, install the following packages:
sudo apt-get install libxslt-dev libxml2-dev zlib1g-dev
And then install nokogiri:
sudo gem install nokogiri
This should do the trick...

Sass installation error

I use Linux Mint and I want to install sass. I have installed ruby by "sudo apt install ruby" , version 2.3 and then , when I wan to install sass by "sudo gem install sass --no-user-install" , I have the following error:
Building native extensions. This could take a while...
ERROR: Error installing sass:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20171114-19329-157auxp.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/ffi-1.9.18 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.18/gem_make.out
Install this package:
sudo apt install ruby-dev
The ruby-dev package contains the missing headers. You can see that the installer is looking for the headers:
/usr/lib/ruby/include/ruby.h
Installing this package will install those headers. This is a common issue that comes up for new Ruby users when installing gems with native extensions. You may find that you have to install several packages to get the installation to complete. If you see similar errors when installing this gem or other gems, try searching for "gemname native extension prerequisites", like "sass gem native extension prerequisites", to learn which packages should be installed before installing the gem.
Try this:
sudo apt install ruby-full rubygems autogen autoconf libtool make
sudo gem install sass
I had the same issue on Ubuntu 18.04, ruby-dev itself didn't help, installing g++ and make, as stated here solved my issue.

Error installing compass in OSX Yosemite (or Sierra)

Good day
I have a Mac with OSX Yosemite
I'm trying to install the compass with the command:
sudo gem install compass
but I am getting the following error:
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20151001-1122-1jqcu8r.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.10 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/ffi-1.9.10/gem_make.out
before attempting to install the package I updated the gem with the command
sudo gem update --system
and the update occurred without errors
You probably need to install the command line developer tools first.
xcode-select --install
Then try sudo gem install compass again

Unable to install bcrypt-ruby, blocks upgrade of devise, "Failed to build native gem extension"

I'm on Mac OSX 10.10.2. In attempting to upgrade devise from 2.1.2 to 2.2.8 (by updating the version in the Gemfile), bundle install attempts to install bcrypt 3.1.10 and crashes with this output:
/Users/username/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb
creating Makefile
make clean
make
compiling bcrypt_ext.c
make: *** [bcrypt_ext.o] Segmentation fault: 11
make failed, exit code 2
I have attempted some fixes found in searching, such as:
`gem install bcrypt -v '3.1.10'ยด
(same error)
Download gem source from github (https://github.com/codahale/bcrypt-ruby) and attempt to install from the local gemfile (same error).
Uninstall bcrypt-ruby with gem uni bcrypt, reinstalling with gem i bcrypt-ruby --platform=ruby (same error)
If I set user to root with sudo su -, I am able to run the install with the following output:
root# gem install bcrypt -v '3.1.10'
Building native extensions. This could take a while...
Successfully installed bcrypt-3.1.10
Parsing documentation for bcrypt-3.1.10
unable to convert "\xCA" from ASCII-8BIT to UTF-8 for lib/bcrypt_ext.bundle, skipping
1 gem installed
However, if I exit out of root, bundle install still fails.
Running rvm 1.25.3, ruby 1.9.3, gem 2.2.2, Bundler version 1.9.4, Xcode 6.3, Command Line Tools 6.3
Any ideas?
Finally, this worked:
Updating RVM to head with rvm get head
Uninstall rvm 1.9.3 with rvm uninstall 1.9.3
Re-install rvm 1.9.3. Tried running rvm install 1.9.3, which advised to run rvm install ruby-1.9.3-p551 instead. Did that.
rvm use 1.9.3
Reinstalled bundler with gem install bundler
Now, finally bundle install works.
It seems likely that previous steps (particularly running updates on Xcode & Command Line Tools) have contributed to success.

error while installing fastthread from ruby gem . How to remove the error?

gem install fastthread -v1.0.7
Building native extensions. This could take a while...
ERROR: Error installing fastthread:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:8:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:8
Gem files will remain installed in /var/lib/gems/1.8/gems/fastthread-1.0.7 for inspection.
Results logged to /var/lib/gems/1.8/gems/fastthread-1.0.7/ext/fastthread/gem_make.out
This is what I got when I tried installing from fastthread to set up SUP mail client on my system . How to get rid of this error?
Install these and then try re-installing:
sudo apt-get install ruby1.8-dev
Try this link http://kenno.wordpress.com/2009/07/25/fixed-extconf-rb8in-require-no-such-file-to-load-mkmf-loaderror/
I was getting this same error in OS X Lion. Having Xcode 4.3 installed doesn't cut it. You have to go to preferences in Xcode and install the command line tools, which installs the necessary compiler tools for doing native builds on the system. After I did this, then gem install fastthread worked for me.
Just to add to this, on debian and ubuntu the "complete" ruby package is this:
ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
libopenssl-ruby1.8 libreadline-ruby1.8
So something like
sudo aptitude install ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8 libopenssl-ruby1.8 libreadline-ruby1.8
Will save you a lot of time when doing bundle install on a large project.

Resources