Question

So I'm trying to install the audite gem, but having issues with rbenv:

$ bundle install
Fetching gem metadata from https://rubygems.org/...
Installing audite (0.3.0)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
checking for mpg123.h... 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
    --without-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=/opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby
please install mpg123 headers


Gem files will remain installed in /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0     for inspection.
Results logged to /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/audite-0.3.0/ext/mpg123/gem_make.    out

An error occurred while installing audite (0.3.0), and Bundler cannot continue.
Make sure that `gem install audite -v '0.3.0'` succeeds before bundling.

I know that these gems require c extensions, and I have them installed with homebrew. And if I go into the cellar for homebrew I can see the file it's looking for (mpg123.h)

/opt/boxen/homebrew/Cellar/mpg123/1.15.4/include/mpg123.h

So, is there a way to add this into the rbenv environment without just sim-linking or copying it directly into /opt/boxen/rbenv/versions/1.9.3-p448/

Was it helpful?

Solution 4

So in the end one of the following things fixed it for me, I'm not sure which because I'd rebuild and changed my machine few times since I had this issue:

  • Switched to Ruby 2.0.0
  • Upgraded to Mavericks (which does change some stuff with xcode stuff I believe)
  • Updated my Boxen/Brew to latest version

OTHER TIPS

xcode-select --install

resolved it for me.

I ran into the same issues trying to install audite. Turns out that mkmf writes a file call mkmf.log to tell you more specifically what it does to find out if the headers are availbale or not:

 >>> cat mkmf.log
have_header: checking for mpg123.h... -------------------- no

"xcrun cc -E -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I.  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE     -g -Os -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common    conftest.c -o conftest.i"
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.
checked program was:
/* begin */
1: #include <mpg123.h>
/* end */

--------------------

Turns out that I hadn't had xcode installed yet; after installing it and running

xcode-select --print-path

I saw that the path was now set. Then I still had to run xcrun once to agree to Apple's licence agreements, but then the installed installed just fine!

Add the homebrew include directory to your path, rubygems will find it. This isn't really a problem with rbenv.

In a default install, homebrew symlinks all the include folders of the packages to /usr/local/include, in your case, those should be in /opt/boxen/homebrew/include. Just have a look around, there should a be a folder somewhere containing all includes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top