9

I'm trying to bundle intall unf_ext -v '0.0.6' but I keep getting this error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

checking for main() in -lstdc++... yes
checking for ruby/encoding.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling unf.cc
In file included from unf.cc:1:
In file included from ./unf/normalizer.hh:4:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__bit_reference:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:628:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/memory:604:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found
#include <__debug>
         ^
1 error generated.
make: *** [unf.o] Error 1

make failed, exit code 2

I've run gem update --system and i've brew install coreutils but I'm still getting the same error.

Update: Answer
Downloaded and installed commandlinetoolsosx10.10forxcode6.2.dmg from Apple Developer. No need to uninstall anything.

Corinne
  • 305
  • 3
  • 8
  • Corinne, I believe you are using Mac OSX. 'Failed to build gem native extension.' error is usually caused due to missing command line tools for Xcode. Do you have them installed? If not, install them from Xcode-> Preferences-> Downloads, or from the command line with xcode-select --install and retry your gem installation. – Sam Apr 10 '15 at 11:30

2 Answers2

8

It's a bug in the new xcode tools. It broke eventmachine in my case. See Missing C++ header <__debug> after updating OSX Command Line Tools 6.3 for answers with dummy files and reinstallation links. I downgraded to 6.2 and the problem went away.

Community
  • 1
  • 1
nruth
  • 1,068
  • 7
  • 22
8

Doing this worked for me:

echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null

Then run bundle again.

And, since this is only meant to be a temporary fix until Apple releases a patch, remove that newly created file with:

sudo rm /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug
DaniG2k
  • 4,772
  • 36
  • 77