6

OSX Lion, Xcode 4.2, GCC 4.2

I get the following error installing bson_ext 1.4.1

Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
ERROR: Failed to build gem native extension.

/Users/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for asprintf()... *** 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.
chourobin
  • 4,004
  • 4
  • 35
  • 48
  • Do you have developer tools installed? – wrdevos Oct 20 '11 at 11:57
  • Same issue here. 1.4.0 worked without any problems. – Matt Oct 21 '11 at 08:27
  • Yup I have Xcode 4.2 installed recently. Is there a separate package for developer tools? – chourobin Oct 21 '11 at 12:11
  • 1
    FWIW I ran into this on my iMac where I had an older version of Xcode. When I switched to my MacBook Air with the latest Xcode (4.2) my bundle install went off without a hitch. Interesting. – Mason Stewart Oct 21 '11 at 15:18
  • 2
    Kind of makes sense. I had Xcode 4.1 installed at first, but I wanted to install Xcode 4.2 so I uninstalled it via command line. My xcode 4.2 is working properly and it appears nothing is wrong with GCC. Is there a check I can run to ensure my developer tools are working? – chourobin Oct 23 '11 at 07:12

4 Answers4

2

I just ran into this. You should look in the mkmf.log file. Chances are, it's looking for GCC in the wrong place. I had to:

cd /usr/bin
sudo ln -s i686-apple-darwin11-llvm-gcc-4.2 i686-apple-darwin11-gcc-4.2.1

And all was well.

Justin Ramos
  • 116
  • 10
  • Where the heck do I find mkmf.log? Anyway, this worked for me: `sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2` via http://stackoverflow.com/questions/9353444/how-to-use-install-gcc-on-mac-os-x-10-8-xcode-4-4 – Peter Ehrlich Oct 14 '12 at 05:38
  • 1
    In the output you get "Results logged to ${GEM_HOME}/gems/bson_ext-1.8.0/ext/cbson/gem_make.out" - the mkmf.log resides in the same dir as gem_make.out. – Thomas Lundström Dec 14 '12 at 10:10
  • This solution did not work for me. OS X 10.8.2, Xcode 4.6 (with command-line tools), bson_ext 1.8.2. Still getting same error. – Michael Feb 12 '13 at 22:24
1

The accepted answer did not work for me. But this did.

I am using:

  • OS X 10.8.2
  • Xcode 4.6 (with command line tools)
  • bson_ext 1.8.2

cd /usr/bin && sudo ln -s ./gcc gcc-4.2

$ gem install bson_ext -v 1.8.2
Building native extensions.  This could take a while...
Successfully installed bson_ext-1.8.2
1 gem installed
Installing ri documentation for bson_ext-1.8.2...
Installing RDoc documentation for bson_ext-1.8.2...
Michael
  • 3,568
  • 3
  • 37
  • 50
0

So re-installing OSX lion fixed the problem. I guess uninstalling xcode 4.1 in the first place messed up my developer tools installation.

Thanks for the help.

chourobin
  • 4,004
  • 4
  • 35
  • 48
0

I don't use XCode for anything but the developer tool binaries so I just uninstalled XCode:

sudo /Developer/Library/uninstall-devtools –mode=all

And then installed this:

https://github.com/kennethreitz/osx-gcc-installer

Fixed the problem right up and I saved some HD space to boot.

Spencer
  • 671
  • 1
  • 8
  • 13