3

I have cloned an existing repository and am now running bundle install - for some reason it fails at the ruby-audio gem.

Installing ruby-audio (1.6.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/thisuser/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for sndfile.h in /opt/local/include,/usr/local/include,C:/Program Files (x86)/Mega-Nerd/libsndfile/include,C:/Program Files/Mega-Nerd/libsndfile/include... no
checking for sf_open() in -lsndfile-1... no
checking for sf_open() in -lsndfile... no
*** 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.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/thisuser/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-sndfile-dir
--without-sndfile-dir
--with-sndfile-include
--without-sndfile-include=${sndfile-dir}/include
--with-sndfile-lib
--without-sndfile-lib=${sndfile-dir}/lib
--with-sndfile-1lib
--without-sndfile-1lib
--with-sndfilelib
--without-sndfilelib
extconf.rb:26:in `<main>':   Can't find libsndfile (http://www.mega-nerd.com/libsndfile/) (RuntimeError)

  Try passing --with-sndfile-dir or --with-sndfile-lib and --with-sndfile-include
  options to extconf. If there are spaces in the path on windows, it may not work.

Gem files will remain installed in /Users/thisuser/.bundler/tmp/5253/gems/ruby-audio-1.6.1 for inspection.
Results logged to /Users/thisuser/.bundler/tmp/5253/gems/ruby-audio-1.6.1/ext/rubyaudio_ext/gem_make.out
An error occured while installing ruby-audio (1.6.1), and Bundler cannot continue.
Make sure that `gem install ruby-audio -v '1.6.1'` succeeds before bundling.

Honestly, I have no idea whatsoever what to do with this. Googling showed the same error with the mysql gem, and the solutions were mysql specific.

Has anyone ever stumbled upon this? If not, is there a way to tell rails explicitly to ignore that gem? Removing it from the gem file and running bundle install again did not do the trick.

Thanks for any help!

Edit

After running brew install libsndfile I got the following output:

Warning: Your Xcode (4.5.2) is outdated
Please install Xcode 4.6.
==> Downloading http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.25.tar.gz
Already downloaded: /Library/Caches/Homebrew/libsndfile-1.0.25.tar.gz
==> Patching
patching file programs/sndfile-play.c
==> ./configure --prefix=/usr/local/Cellar/libsndfile/1.0.25
==> make install
make[1]: *** [sndfile-play.o] Error 1
make[1]: *** Waiting for unfinished jobs....
brew: superenv removed: -g -O2 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -Wundef
brew: superenv removed: -g -O2 -Wall -Wextra -Wdeclaration-after-statement -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wcast-align -Wcast-qual -Wnested-externs -Wbad-function-cast -Wwrite-strings -Wundef
make: *** [install-recursive] Error 1
Your Xcode and or CLT are mis-configured. Try some or all of the following:
    xcrun --kill-cache
    xcodebuild -license
    sudo xcode-select -switch /path/to/Xcode.app

I tried all of the suggested commands - to no avail. What else can I do to solve this?

weltschmerz
  • 12,936
  • 10
  • 60
  • 110
  • It says it can't find `libsndfile`. There's a **[formula](https://github.com/mxcl/homebrew/blob/master/Library/Formula/libsndfile.rb)** for this through Homebrew. – deefour Jan 30 '13 at 23:16
  • Thank you - not sure what to do with it, though? Can you please elaborate? – weltschmerz Jan 30 '13 at 23:18
  • Install [Homebrew](http://mxcl.github.com/homebrew/). Run `brew install libsndfile`. Run `bundle`. – deefour Jan 30 '13 at 23:19
  • Please see my question edit. It is giving me new errors. – weltschmerz Jan 30 '13 at 23:29
  • Did you try the three commands that it suggested you run at the end? – Nevir Jan 30 '13 at 23:33
  • If those don't work, chances are that `libsndfile` isn't compatible with LLVM. You can switch the default to compiler to GCC: http://stackoverflow.com/questions/1165361/setting-gcc-4-2-as-the-default-compiler-on-mac-os-x-leopard – Nevir Jan 30 '13 at 23:34
  • also update xcode and try with that as well. – Jim Deville Jan 30 '13 at 23:35
  • @Nevir tried your link, to no avail... Updating Xcode now and trying again... – weltschmerz Jan 30 '13 at 23:38
  • @JimDeville I have updated Xcode, updated homebrew, run all suggested three commands above... Running out of ideas here... It still gives me what I added as edit above. What can I do? – weltschmerz Jan 31 '13 at 00:07
  • I also had to install the latest Xcode command line tools. Jesus. Thanks for all the help! Problem solved. – weltschmerz Jan 31 '13 at 00:27
  • Guys, I added an answer to summarize this. Thanks a lot for your help, I really appreciate it! – weltschmerz Jan 31 '13 at 00:47

1 Answers1

5

So, we got it working together, and I thought I'd share the steps I had to take to make this work. Thanks to everyone who commented!

  1. The problem was that while installing the gem, it couldn't find the libsndfile
  2. To install it, I had to run brew install libsndfile (install homebrew first if you don't have it already), which didn't work, so I had to...
  3. ... update Xcode to the latest version and install Xcodes command line tool (don't ask me why, but I had to.)
  4. Then I ran brew install libsndfile, which worked
  5. And last but not least I ran bundle install again, which finally installed the desired gem.
Ricky
  • 3,053
  • 1
  • 23
  • 32
weltschmerz
  • 12,936
  • 10
  • 60
  • 110