Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

ERROR: Failed to build gem native extension. #106

Closed
loretoparisi opened this issue Jan 22, 2014 · 13 comments
Closed

ERROR: Failed to build gem native extension. #106

loretoparisi opened this issue Jan 22, 2014 · 13 comments

Comments

@loretoparisi
Copy link

MacBook-Pro-di-Loreto:appledoc admin$ sudo gem install cupertino
Building native extensions. This could take a while...
ERROR: Error installing cupertino:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

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

@pcholberg
Copy link

http://stackoverflow.com/questions/19580685/installing-rails-on-mavericks
The same issue, installing command line tools:
xcode-select --install
must fix this.

@mattt
Copy link
Contributor

mattt commented Jan 30, 2014

Thanks, @pcholberg. 783a43f adds a note about this in the README.

@mattt mattt closed this as completed Jan 30, 2014
@billyto
Copy link

billyto commented Apr 4, 2014

If you're running Xcode 5.1, the command line tools don't work for nokogiri. You'll need to download the Late october 2013 tools from Apple. Once you do that run

sudo xcode-select -s /Library/Developer/CommandLineTools/

to set up your machine to use the Xcode 5.0.X command line tools, then run

gem install cupertino
If you want to reset your command line tools to the Xcode.app version afterward run

sudo xcode-select -r

More info on stackoverflow

@bteschke
Copy link

bteschke commented Apr 4, 2014

I was getting an unused argument error for nokogiri with Xcode 5.1 but it was fixed by adding this to the beginning of the gem install command.

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

@billyto
Copy link

billyto commented Apr 4, 2014

Way better solution!

Thanks.

@apolishch
Copy link

neither one of these solutions worked for me

@biddster
Copy link

Just for future reference, here's how I got cupertino running on mavericks:

$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
$ sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install nokogiri -v 1.5.11
$ sudo gem install cupertino

I had to explicitly install nokogiri 1.5.11 as that's the version that cupertino appears to depend on.

Note that I already had the latest command line tools installed.

@gnustep
Copy link

gnustep commented Aug 19, 2014

Still having this issue:

glados:cupertino heron$ sudo xcode-select -s /Library/Developer/CommandLineTools/
Password:
glados:cupertino heron$ sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install nokogiri -v 1.5.11
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.11
Parsing documentation for nokogiri-1.5.11
Installing ri documentation for nokogiri-1.5.11
Done installing documentation for nokogiri after 10 seconds
1 gem installed
glados:cupertino heron$ sudo gem install cupertino
Building native extensions. This could take a while...
ERROR: Error installing cupertino:
ERROR: Failed to build gem native extension.

/usr/local/Cellar/ruby/2.1.2/bin/ruby extconf.rb

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:
./unf/normalizer.hh:4:10: fatal error: 'vector' file not found
#include
^
1 error generated.
make: *** [unf.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/unf_ext-0.0.6 for inspection.
Results logged to /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0/unf_ext-0.0.6/gem_make.out
glados:cupertino heron$

@cp3hnu
Copy link

cp3hnu commented Sep 27, 2014

Thanks, @biddster.It works for me.

@crrobinson14
Copy link

The workaround listed by @biddster works for me, too.

@csmobile
Copy link

Thank you @biddster. This worked for me as well.

@adison
Copy link

adison commented Nov 4, 2014

@biddster is right, nokogiri 1.5.11 works

@cezheng
Copy link

cezheng commented Jun 28, 2016

@gnustep How did you resolve that problem? I'm installing another Gem that uses unf_ext, and I'm having exactly the same problem as yours with Xcode 7.3.1

compiling unf.cc
In file included from unf.cc:1:
./unf/normalizer.hh:4:10: fatal error: 'vector' file not found
#include <vector>
         ^
1 error generated.
make: *** [unf.o] Error 1

make failed, exit code 2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests