Error installing RedCloth - ruby

I'm getting this erron when trying to install RedCloth on openSuse:
sudo gem install RedCloth
Building native extensions. This could take a while...
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
creating Makefile
make
sh: make: nie znaleziono polecenia
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.3 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/RedCloth-4.2.3/ext/redcloth_scan/gem_make.out
I tried to google this out and triend everything. So I need help with that.

I just had this same a similar problem and fixed it by installing the ruby dev package. For me, the command was:
sudo apt-get install ruby1.9.1-dev
I found the answer (and a better description of the problem) on this blog.
It's not the answer to this question exactly, but hopefully it'll be of use to someone else who stumbles upon this page.

If Google's Polish translation is correct, then you don't have make installed on your machine.
Try entering which make. If you see nothing, then you need to handle that first. I'm not sure the name of the package you need in OpenSuse. You should be able to search in Yum (Yast? whatever OpenSuse's package manager is called...) for something like Debian's 'build-essential' package.
Edit: In OpenSuse, the package you need seems to be called "C/C++ Development" (or "C/C++ Compiler and Tools"). See this thread for some pointers: http://forums.opensuse.org/applications/413553-build-essential.html
I don't know OpenSuse, but if it's anything like Debian, you can probably also install Ruby gems (and Perl and Python modules) directly from your package manager. This can be good and bad. Good because the package manager takes better care of dependencies and uninstalling (on average) than you would on your own. Bad because the distro will often have older versions than you might be able to get yourself. Still, it's an option to consider.

If using Windows and RubyInstaller.org, I believe you need to install the devkit they provide.

If you have make after checking with which make and you are sure you have ruby installed by checking which ruby it could be that you had installed something similar to sudo apt-get install ruby1.9.1-dev and then changed your mind and removed that because now you use rbenv or rvm or just installed from source. The problem is that the reference to /var/lib/ruby/1.9.1/ will still be associated with ruby gem and will try to install the gems there. Solution could be to remove that directory sudo rm -rf /var/lib/ruby/1.9.1/ and that could fix the issue.

Related

How to make my ruby gem install native apt packages automatically during its installation?

I'm building my own ruby gem, let's call it my-gem, which depends on some system package, for example gpsbabel. It expects to be able to call gpsbabel command using the shell.
On Ubuntu, before running my-gem, I have to make sure that gpsbabel is installed via apt install gpsbabel.
Is there a feature in rubygems, or maybe supplied by some other gems, that automates that? So that when I run gem install my-gem, it's ensured that gpsbabel is installed, and if not, it's installed automatically?
I'm not 100% certain that what you're asking for is impossible, but I wouldn't recommend it anyway: apt would only be appropriate for Debian/Ubuntu systems, and ideally a gem would be cross-platform-friendly and thus not do anything platform-specific.
Granted, if you're making a gem for your own use only, then maybe it's viable? But I'd instead be looking at having a set-up script for the the relevant applications that installs the required packages before bundle install.

Error when using overcommit and Github Desktop

I am using overcommit gem (https://github.com/brigade/overcommit) in my project, when I use Github Desktop for osx I get these errors:
This repository contains hooks installed by Overcommit, but the
overcommit gem is not installed. Install it with gem install
overcommit. (1)
The gem is installed, it works in terminal. I guess it's because I use rvm and Github Desktop doesn't know about rvm. Anybody knows how to fix this?
Ok finally got it to work!
Combined the answer from #michelegera with comment from #rewritten
Step 1:
sudo su -
gem install bundler
gem install overcommit
gem install rubocop
Step 2: added command: ['bundle', 'exec', 'rubocop'] to .overcommit.yml
Thanks for the help!
Most likely it's this line where the error occurs. As you can see the main issue is that it's not able to require 'overcommit'. I don't know the GitHub desktop client so well (maybe there is a way to configure it inside of it), but one thing you could do is adding the absolute path where rvm stores your gems to the "require path" in the hook file. This could look like:
$: << "/home/user/.rvm/path/to/gems/dir"
The disadvantage of this is that you would have your absolute path in the hook file and it most likely won't work for others. You might also want to consider installing the gem globally for the the ruby interpreter that executes the script (see Shebang line in the hook file).
You are right, Github Desktop (or any other GUI) isn’t running in your terminal environment, so it knows nothing about your specific RVM installation.
A simple solution is to install overcommit and any other gems required by your hooks into your system Ruby:
sudo su -
gem install bundler
gem install overcommit
gem install rubocop
...
If you installed Git via Homebrew or other means, you might have to change the Git binary used by your GUI.
For example, in Tower, I selected Homebrew’s version rather than the System’s.

Ruby error on OS X Yosemite and chef

Getting this error when trying to install chef on OS X Yosemite, other gems have installed fine. Not seeing a requirement. Just wondering if anyone has and idea of what the issue is or has come across this.
$sudo gem install chef
Building native extensions. This could take a while...
ERROR: Error installing chef:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141023-4708-6api21.rb extconf.rb
creating Makefile
/Library/Ruby/Gems/2.0.0/gems/libyajl2-1.1.0/ext/libyajl2
extconf.rb:104:in `makemakefiles': unhandled exception
from extconf.rb:138:in `<main>'
extconf failed, exit code 1
EDIT: Although my answer below will help you install it on the system version of Ruby. I would probably suggest using RVM instead as the comment below mentions. I do not use Ruby very often and it would probably be fine, but I decided to take the 10 mins to change it to installing to RVM since that way I leave the system ruby untouched.
As I was searching across the web, I could actually resolve this issue (which also appeared on docker/ubuntu) as suggested in this thread:
https://stackoverflow.com/a/32191707/1948319
Long story short: The gmp library is missing. You can install it on ubuntu with
sudo apt-get install libgmp3-dev
I had this problem with this gem specifically, and another gem with c extensions as well.
Turns out I needed to accept new terms & conditions after updating XCode :-)
sudo xcodebuild -license
So I actually answered my own question very shortly after I posted and I hope it helps someone else in the future.
I used this instead:
$ sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install chef
The Apple LLVM compiler in Xcode treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Came across this issue which was similar enough:
https://github.com/FontCustom/fontcustom/issues/194

Error installing debug_inspector 0.0.2 Native Extensions?

Getting this error when trying to do a bundle install. Following the instructions to do a direct gem install fails as well. I have since wiped all ruby (and project code) from my machine including any ruby configuration and reinstalled ruby, devkit, and my project code. Still getting this. Not sure where to look next. Most searches turn up gem-specific solutions that don't seem to apply here. Let me know if I can provide more info. Thanks!
An error occurred while installing debug_inspector (0.0.2), and Bundler cannot
continue.
Make sure that `gem install debug_inspector -v '0.0.2'` succeeds before
bundling.
C:\TFS\Grange Commercial SEQ\White\Specifications>gem install debug_inspector -v
'0.0.2'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
The system cannot find the path specified.
The system cannot find the path specified.
ERROR: Error installing debug_inspector:
ERROR: Failed to build gem native extension.
C:/devl/Ruby/Ruby192/bin/ruby.exe extconf.rb
Gem files will remain installed in C:/devl/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems
/debug_inspector-0.0.2 for inspection.
Results logged to C:/devl/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/debug_inspector-
0.0.2/ext/debug_inspector/gem_make.out
I know this question is very old. However, I see two problems with this right off.
Windows doesn't have the tools (by default, or using the ruby installer) to compile c dependencies for ruby. If you want to do it yourself, you might check out: http://rubylearning.com/blog/how-do-i-install-a-ruby-gem-with-native-extensions-on-windows/
The other problem is that this particular gem doesn't work with ruby < 2.0: https://github.com/banister/debug_inspector and your ruby version appears to be 1.9.1
I would check your Gemfile.lock to see which gems are requiring debug-inspector. If you can do without them, take them out, and your bundle will succeed. If you must have them, try running a linux VM and using it for your development. My personal suggestion would be Ubuntu: http://www.ubuntu.com/download/desktop and VirtualBox or VMWare Player. Virtual Box is FOSS, so if this is company work, you'll have to use it: https://www.virtualbox.org/ . VMWare Player is free for personal use, and I like how it works a little better: http://www.vmware.com/products/player
I got the same error, using Ruby 2.2.4 64bit, on windows 10 64.
In my case what caused the error was installing several ruby versions, one after the other- (to try and solve that error)
Eventually I solved it by running ruby dk.rb install --force (At first I did that without the force flag), as stated by this answer- Just make sure to use the correct ruby version- version that worked for me was ruby 2.1.7 32bit.

Gosu/Ruby fails to install

Gosu fails to install on my Mountain Lion (10.8.3).
Here's the error I get:
Building native extensions. This could take a while...
ERROR: Error installing gosu:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
The Gosu gem requires some libraries to be installed system-wide.
See the following site for a list:
https://github.com/jlnr/gosu/wiki/Getting-Started-on-Linux
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:338:in `symlink': File exists - ../linux/gosu.bundle or ../lib/gosu.bundle (Errno::EEXIST)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:338:in `ln_s'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1418:in `fu_each_src_dest0'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:336:in `ln_s'
from extconf.rb:99
What I tried so far:
Checked that I've got Command line tools installed in My XCode. This guy had same problem. But we evidently have different source(s) of problem(s).
Tried installing dependencies from the rubygame website, appearently helped this guy. Installed the libraries like this guy.
Changed the path to put /usr/local/bin in front of /usr/bin/. That didn't help either.
Tried to install Rubygame gem : And same problem!
Tried to install SDL gem : Same problem!
So I decided to try to install something different: the Cake gem. It worked!
I decided to give up and ask the question in stackoverflow.
I typed my problem in stackoverflow.
So what could the problem be?
I had a similar issue. After tinkering in my Path forever, I downloaded and ran Jewelrybox. Afterwards, I had it reinstall ruby-1.9.3 -p448, during which it ran diagnostics. Thankfully was able to install gosu after that.
Try that out, hopefully it works for you too.

Resources