Can't find header files for Ruby on SUSE? - ruby

I'm attempting to install compass on SUSE Enterprise 11 SP3. I get the following. Any ideas?
gem install compass
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
<b>mkmf.rb can't find header files for ruby at /usr/lib64/ruby/ruby.h</b>
extconf failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/ffi-1.9.3 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/extensions/x86_64-linux/1.8/ffi-1.9.3gem_make.out

zypper in ruby-devel
It works for me. And if you also miss gcc, then
zypper in gcc

For those with similar issues I got this working by.
Uninsalling ruby and rvm
Building zlib from source with the shared option
./configure --shared
make
make install
I did the same for Ruby and that worked.
I could not get any RPM, Zypper, RVM installers to install properly. In each case they all seemed to have issues with zlib ?

You are possibly missing gcc. Try installing it with zypper (or yum), and then try installing your gems:
zypper in gcc

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.

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 Jekyll in Cygwin

So I attempted to install Jekyll on Windows through Cygwin and I encountered an error when I tried to install Jekyll through Cygwin. Here is the output.
Michael#X556UAK: ~$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby.exe -r ./siteconf20171011-7692-lgoixq.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi- 1.9.18 for inspection.
Results logged to /c/Users/Michael/.gem/ruby/2.3.0/extensions/x86_64-cygwin/2.3.0/ffi-1.9.18/gem_make.out
I conducted some research online and I wasn't able to find a solution. I tried running Cygwin as an administrator and I still got that error message.
What can I do to fix this issue?
I had the same issue when installing Jekyll and Ruby in the Windows 10 Bash Linux Subsystem. It turned out, that the development package from Ruby was missing. I had to install it first:
sudo apt-get install ruby2.4-dev
In my case. Try to install the dev package in Cygwin package manager, in your case its version 2.3.
Andy
For the record, I encountered the same problem Michael did, and installing the ruby-devel package (using the Cygwin Setup installer) solved my problem. A missing *-devel Cygwin package is a common cause of errors about missing header files.

ERROR: Failed to build gem native extension. - can't install breakpoint and singularity

I installed compass and sass and everything worked correctly. But now I am trying to install singularity and breakpoint and I am getting this error over and over:
Sayras-iMac:~ sayralopez$ sudo gem install breakpoint
Building native extensions. This could take a while...
ERROR: Error installing breakpoint:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/ffi-1.9.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/extensions/universal-darwin-12/1.8/ffi-1.9.3/gem_make.out
I am still a newb at terminal commands, so I have no idea what is going on. I tried reinstalling and updating ruby and it still wont work. Any idea what could be going on and how to fix it?
MANY THANKS!
Install Ruby Version Manager first:
$ ruby install rvm
After installing rvm, I was able to install breakpoint and sigularity (and susy!)
Hope that helps!

"Error installing charlock_holmes" : "icu required"

I'm attempting to install charlock_holmes on my Mac (10.7.5, ruby-1.9.3-p392), and I'm encountering the following error:
$gem install charlock_holmes -v '0.6.9.4'
Building native extensions.
This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/Users/mthompson/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for main() in -licui18n... no
checking for main() in -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I've installed icu via macports, so my icu directories are /opt/local/lib/icu and /opt/local/share/icu. I've tried installing with the directories specified:
$ gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/usr/local/include/ --with-opt-lib=/usr/local/lib/
..but I hit the same error. Any ideas would be welcome.
I was able to install this gem using the version of ICU installed with macports and pointing --with-opt-include and --with-opt-lib to subdirectories of /opt.
The gem successfully installed by running:
gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/opt/local/include/ --with-opt-lib=/opt/local/lib/
I ran into this issue today. I realize that the original issue was resolved by switching to Homebrew. That wasn't an acceptable solution to me, so I kept digging. The solution was actually quite simple.
After installing icu via Macports, simply install charlock_holmes by running:
gem install charlock_holmes -- --with-icu-dir=/opt/local
Hopefully this helps others that encounter this issue and are not willing to abandon Macports in order to solve it.
I ended up switching from MacPorts to Homebrew and reinstalling my rubies and packages.

Resources