Gosu/Ruby fails to install - ruby

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.

Related

Trying to put bundle in PATH

I'm working on a Ruby project that requires the use of a few gems. I'm a bit confused, since I thought I already had bundler installed on my Mac. I tried installing it just now and got the following error:
Leias-MacBook-Pro:spec leia$ gem install bundler
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
I then tried using --user-install, a trick I picked up from browsing Stack Overflow.
Leias-MacBook-Pro:spec leia$ gem install bundler --user-install
WARNING: You don't have /Users/leia/.gem/ruby/2.3.0/bin in your PATH, gem executables will not run.
Successfully installed bundler-2.0.2
Parsing documentation for bundler-2.0.2
Done installing documentation for bundler after 5 seconds
1 gem installed
Now, I kind of need the gem executables to run, so I opened my .bash_profile and dropped the following code in:
export PATH=/Users/leia/.gem/ruby/2.3.0/bin:$PATH
But no matter how I try to fix it, bundle still won't run. The gem I'm installing is rspec, and I definitely need to be able to run those executables. Am I doing something wrong here? I've tried to follow tutorials and Google similar issues, but I can't figure out what the problem is. Any pointers or suggestions?

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.

Compiling Ruby 1.9.2 under Linux (Ubuntu) and Rubygems

I already installed Ruby 1.9.2 with Rubygems successfully on my main machine.
Now on my server I'm again in this job.
Last time I had a problem, which came up right now as well:
gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
I knew how to fix this, but forgot it.
I found an article here on stackoverflow (which I cannot find again) that tells me to compile some native ruby extension first. In the source code you have to go into a dir, where you find dirs for zlib, linecache and so on. Those you have to compile and you're done: everything then works.
Can somebody tell me again how to do this?
Sorry, Google and the Stackoverflow search didn't help this time.
Thanks.
Yours,
Joern
use RVM to install a ruby - its really incredible stuff
you didnt used flags on the ruby compilation (--with-zlib-dir=/...zlib_path...)
I found the thread again!
Has anyone tried installing ruby & rubygems from source on ubuntu
In the 3rd answer of Evgeny you find exactly what I was searching for!

Error installing RedCloth

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.

Resources