Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Cannot install gosu gem on Mac OS X
- - By rayning Date 2013-04-12 02:26
Help! I cannot install the gosu Ruby gem on my Mac OS X (10.8.3).  I use Ruby 1.9.3p194. When I do "gem install gosu", I get all these compile errors.
It's true that I don't see the folders/files for OpenAL, CoreFoundation, ApplicationServices, Foundation, and AudioToolbox in my Ruby gem directory. Why not?

ERROR:  Error installing gosu:
  ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p194/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

creating Makefile

make
compiling analysis.c
compiling bitrate.c
compiling bitwise.c
compiling block.c
compiling codebook.c
compiling envelope.c
compiling floor0.c
compiling floor1.c
compiling framing.c
compiling info.c
compiling lookup.c
compiling lpc.c
compiling lsp.c
compiling mapping0.c
compiling mdct.c
compiling psy.c
compiling registry.c
compiling res0.c
compiling sharedbook.c
compiling smallft.c
compiling synthesis.c
compiling vorbisfile.c
compiling window.c
compiling RubyGosu_wrap.cxx
In file included from ../Gosu/Gosu.hpp:13,
                 from RubyGosu_wrap.cxx:2227:
../Gosu/Fwd.hpp:10: warning: attribute ignored in declaration of ‘struct Gosu::Audio’
../Gosu/Fwd.hpp:10: warning: attribute for ‘struct Gosu::Audio’ must follow the ‘struct’ keyword
RubyGosu_wrap.cxx: In function ‘VALUE _wrap_Font_draw_rot(int, VALUE*, VALUE)’:
RubyGosu_wrap.cxx:5780: warning: ‘drawRot’ is deprecated (declared at ../Gosu/Font.hpp:79)
compiling AudioOpenAL.cpp
In file included from ../GosuImpl/Audio/AudioOpenAL.cpp:1,
                 from AudioOpenAL.cpp:1:
../GosuImpl/Audio/ALChannelManagement.hpp:3:23: error: OpenAL/al.h: No such file or directory
../GosuImpl/Audio/ALChannelManagement.hpp:4:24: error: OpenAL/alc.h: No such file or directory
In file included from ../GosuImpl/Audio/ALChannelManagement.hpp:5,
                 from ../GosuImpl/Audio/AudioOpenAL.cpp:1,
                 from AudioOpenAL.cpp:1:
../GosuImpl/MacUtility.hpp:6:42: error: CoreFoundation/CoreFoundation.h: No such file or directory
../GosuImpl/MacUtility.hpp:9:52: error: ApplicationServices/ApplicationServices.h: No such file or directory
In file included from AudioOpenAL.cpp:1:
../GosuImpl/Audio/AudioOpenAL.cpp:20:34: error: Foundation/Foundation.h: No such file or directory
In file included from ../GosuImpl/Audio/AudioOpenAL.cpp:21,
                 from AudioOpenAL.cpp:1:
../GosuImpl/Audio/AudioToolboxFile.hpp:5:39: error: AudioToolbox/AudioToolbox.h: No such file or directory
../GosuImpl/Audio/AudioToolboxFile.hpp:6:41: error: AudioToolbox/AudioConverter.h: No such file or directory
../GosuImpl/Audio/AudioToolboxFile.hpp:7:44: error: AudioToolbox/ExtendedAudioFile.h: No such file or directory

etc....
Parent - - By jlnr (dev) Date 2013-04-12 04:50
All these frameworks are in /System/Library/Frameworks unless you have massively broken your installation of OS X :)

I don't know why a compiler wouldn't find them by default. Are you using Xcode or another compiler package?

In any case, it reminds me of why I used to have a pre-compiled binary gem... :)
Parent - By rayning Date 2013-04-12 05:40 Edited 2013-04-12 05:49
Yes, I have all these frameworks in /System/Library/Frameworks on my Mac:

AudioToolbox.framework
OpenAL.framework
CoreFoundation.framework
ApplicationServices.framework

I still get this error message. Yes, I tried downloading your Gosu gem directly from http://rubygems.org/gems/gosu and installing that directly. This also did not work. Same error message.

Why is it not finding these frameworks? Where does it specify what path to look for them?

Here's my $PATH variable:

/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin

Also, I'm not using a special compiler package. I just typed "gem install gosu"
Parent - By rayning Date 2013-04-12 05:57
So weird! I just closed/reopened my Terminal and tried "gem install gosu" again.

IT WORKED! It installed gosu with no errors. In the last few hours I changed the $PATH, putting /usr/local/bin before /usr/bin.

I also installed the gem "rubygame", Homebrew, and SDL:
https://github.com/rubygame/rubygame/wiki/Mac-Install-Guide

One of these things must have changed the environment somehow. Which was it?
- - By dlang_fla Date 2013-07-12 02:59
I am having this same problem installing gosu on OS X 10.8.4. No problems installing gosu on my old Windows box.

I setup my Ruby environment with RailsInstaller, which installs the command line tools. So I am currently not using Xcode. Is Xcode required for gosu?

Thanks in advance!
Parent - By jlnr (dev) Date 2013-07-12 05:39
I am really only using system framework paths… :| Not sure why this would break with RailsInstaller. But yes, I guess it would be solved by switching to Xcode's command line tools.
- - By Darkfyi Date 2015-08-08 19:04
I am trying to install gosu, and use it with ruby, on Mac OS X.
I used the command:
sudo gem install gosu
and then after I enter my password I get this:
Building native extensions.  This could take a while...
Then 30 seconds later this error pops up.
ERROR:  Error installing gosu:
  ERROR: Failed to build gem native extension.
Then a whole bunch of really non-important stuff afterwards. Why is it failing to build gem native extension?
Parent - By jlnr (dev) Date 2015-08-09 08:07
Can you please post the rest of the output? Most of it is indeed unimportant but there's usually one line in there that isn't :)

The two most common pitfalls are: 1. since Gosu 0.8 you'll need to brew install sdl2 libogg libvorbis, and 2. you might be using RVM, which often breaks Gosu's compilation.
- - By mxld Date 2016-09-22 00:23
I'm having the same problem.
I'm running ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] on OSX 10.10.5 Yosemite.
I ran brew install sdl2 libogg libvorbis.
I have homebrew and xcode installed. I tried using sudo gem install gosu and gem install gosu. And I keep getting the following error:
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/2.0/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/gosu/gosu/wiki/Getting-Started-on-OS-X
creating Makefile

make "DESTDIR="
compiling stb_vorbis.c
error: -fobjc-arc is not supported on platforms using the legacy runtime
make: *** [stb_vorbis.o] Error 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/gosu-0.10.8/ext/gosu/gem_make.out


I'd really appreciate the help. I've been stuck here for a while. Thanks
Parent - - By mxld Date 2016-09-22 03:37
After reading a bunch of closed issues on GitHub, I found https://github.com/gosu/gosu/issues/286 and tried this:
sudo gem install gosu -v 0.10.5.pre0

Now I have gosu (0.10.5.pre0) installed.

It response was this:

Fetching: gosu-0.10.5.pre0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed gosu-0.10.5.pre0
Parsing documentation for gosu-0.10.5.pre0
Installing ri documentation for gosu-0.10.5.pre0
1 gem installed

Is this ok? Is this the latest version?
Parent - By shawn42 Date 2016-09-22 13:39
Have you tried the brew install command listed above? Did you follow the exact instructions for installing on OS X?
Parent - By jlnr (dev) Date 2016-09-23 20:39 Edited 2016-09-24 09:04
Edit: See post below!

Oh man, Apple's Ruby is terrible. It's trying to compile Gosu for both 32-bit and 64-bit, even though OS X doesn't even run on 32-bit systems anymore, and the 32-bit build fails. It works on my 10.11 machine though, which doesn't make debugging any easier.

As a workaround, you can install Ruby from homebrew (brew install ruby), or use rbenv/ruby-install (also in homebrew) to install a specific version of Ruby. Gosu should build without issues then (you won't need the sudo before gem install anymore, though).
That way, you'll have be running the most recent version of Gosu (0.10.8 is the latest) AND Ruby! :)

Also, you don't need to brew install libogg libvorbis anymore. sdl2 is the only dependency.
Parent - - By jlnr (dev) Date 2016-09-24 09:05
I am not sure if it was you who provided a fix for this via GitHub, or if it was just fortunate timing :)

Anyway, I've released a pre-release gem that you should be able to install on Yosemite without installing another Ruby version (so disregard what I wrote above):

sudo gem install --pre

Let me know if this fixes the issue.
Parent - By mxld Date 2016-10-30 20:10
Thanks for all this. Somehow I got it to work before reading this.
Up Topic Gosu / Gosu Exchange / Cannot install gosu gem on Mac OS X

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill