- Benohead’s Software Blog
- Mac: Failed to build gem native extension
- Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #3372
- Comments
- JonathanMatthey commented Feb 1, 2015
- supertopher commented Feb 4, 2015
- TimMoore commented Feb 11, 2015
- willbowling commented Apr 20, 2015
- edwinxico commented Jun 22, 2015
- chargio commented Sep 26, 2015
- jclaret commented Sep 29, 2015
- Viktorminator commented Nov 28, 2015
- kmcmcurtis7 commented Jan 1, 2016
- Abdull commented Feb 19, 2016
- zoomwebstudio commented Mar 8, 2016
- shrinivas91 commented Mar 29, 2016
- dailsoncampos commented Apr 23, 2016 •
- willbowling commented Apr 23, 2016
- dailsoncampos commented Apr 23, 2016
- Failed to build gem native extension #133
- Comments
- eduOSS commented Apr 18, 2015
- parkr commented Apr 18, 2015
- eduOSS commented Apr 18, 2015
- parkr commented Apr 19, 2015
- envygeeks commented Apr 19, 2015
- eduOSS commented Apr 20, 2015
- envygeeks commented Apr 20, 2015
- martinbean commented Sep 28, 2015
- parkr commented Sep 28, 2015
- martinbean commented Sep 28, 2015
- parkr commented Sep 28, 2015
- parkr commented Jan 25, 2016
- Darshnik commented Apr 5, 2016
- donli1210 commented Nov 15, 2016
- midacts commented Jan 17, 2017
- parkr commented Jan 17, 2017
- inscrutabledude commented Feb 20, 2017
- BruceChen5683 commented Nov 13, 2017
- salmanfarisvp commented Dec 4, 2017 •
- envygeeks commented Dec 4, 2017
- vrubiolo commented Apr 26, 2018
- stevokk commented Aug 9, 2018
- AlasdairGray commented Sep 24, 2018
Benohead’s Software Blog
Mac: Failed to build gem native extension
When installing ruby on rails, vagrant, rmagick, sqlite3-ruby, mysql or any other software using ruby native extensions, you might get the following error message:
I got this error because I was on a new Mac and didn’t have XCode installed on this machine (using another one for Mac development). And since it’s over 1 GB of disk space I’d need for Xcode, I wanted to avoid having to install it just to get this other stuff installed. The alternative are the “command line tools”. So I went to http://developer.apple.com/downloads/, logged in with my Apple ID, downloaded the latest version of the “Command Line Tools (OS X Mountain Lion) for Xcode” and installed them.
But even with the command line tools install, I was still getting the following error message (which was also there before installing the tools):
Then I had a look at config.log, located there (you might have a different path, when using a newer version):
And foung the following error:
The solution is to use xcode-select but it took me a few tries to find out what I was supposed to use as path without Xcode installed:
This error was gone but I got a few error messages like this:
Looking at the man pages:
xcrun provides a means to locate or invoke coexistence- and platform-aware developer tools from the command-line, without requiring users to modify makefiles or otherwise take inconvenient measures to support multiple Xcode tool chains.
Well, it didn’t really help me much…
The command causing looked like this:
So xcrun just gets a command line as parameters. So first I checked that cc was working:
Then since just calling cc was working, I was wondering why I’d need xcrun… Maybe the solution is just to create my own xcrun just executing the command line provided as parameters.
First I made a back up of xcrun, then created a shell script there:
Now in vi, I’ve put the following contents in xcrun:
It just execute the same command line but without the first xcrun. Of course, you need to give it execute rights:
And then executing gem install finally worked ! I guess there is probably a cleaner way to do it but at least I got it working even though it was late at night and I was almost sleeping on the keyboard !
Update: The trick with xcrun might cause problems installing some other software e.g. osxfuse. So you might have to remove it afterwards:
If you need it again, you can restore it like this:
Источник
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #3372
Comments
JonathanMatthey commented Feb 1, 2015
The text was updated successfully, but these errors were encountered:
supertopher commented Feb 4, 2015
- i do not believe this is an issue with bundler
this looks like a permissions error. Bundler expects that you have permission to write to the directory the error:
Permission denied @ dir_s_mkdir — ./.gem.20150131-61502-djrp3
as well as an error that came from mkdir both suggest incorrect permissions. If you are on OSX user this is probably due to the inappropriate use of sudo. OSX by convention doesn’t use sudo for much of any CLI installation unless you are using Macports
if you are using brew try brew doctor for help. or uninstall and reinstall rbenv (including it’s dependencies from
/.rbenv ) the try reinstalling this.
also rbenv doesn’t install bundler by default it is plausible that you are using system bundler to try and install nokogiri even though you are using rbenv’s ruby.
if you run which bundler and the return value is not rbenv something something try this:
gem install bundler && rbenv rehash
TimMoore commented Feb 11, 2015
I agree, this looks like filesystem permissions are set up incorrectly. Check permissions on your project directory and on /Users/ratciti/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 (I believe it changes to the gem directory before building) to make sure you can write files as the user that you’re running Bundler with.
willbowling commented Apr 20, 2015
What resolved my issue was to install bundler without sudo. «gem install bundler».
edwinxico commented Jun 22, 2015
Installing bundle «gem install bundler» also solved my similar issue
chargio commented Sep 26, 2015
I was using rbenv in Fedora and got the same message. I couldn’t understand why.
At the end, it was a lack of underneath packages, it was solved installing them:
sudo dnf install ruby-devel cmake mariadb-devel rubygems-devel
bundler update
bundler install
jclaret commented Sep 29, 2015
it works for fedora 22 too.
Viktorminator commented Nov 28, 2015
solved the problem
kmcmcurtis7 commented Jan 1, 2016
Thanks for the info! I ran into this and this resolved the problem quickly.
Abdull commented Feb 19, 2016
sudo apt-get install ruby2.2-dev
zoomwebstudio commented Mar 8, 2016
This solution works perfectly for me. thanks to @Abdull
sudo apt-get install ruby2.2-dev
and after I ran
bundle install
shrinivas91 commented Mar 29, 2016
I used sudo apt-get install ruby2.2-dev
But I’m getting the following error:
Reading package lists. Done
Building dependency tree
Reading state information. Done
E: Unable to locate package ruby2.2-dev
E: Couldn’t find any package by regex ‘ruby2.2-dev’
dailsoncampos commented Apr 23, 2016 •
My problem is this «Make sure that gem install debugger -v ‘1.6.8’ succeeds before bundling». I’ve tried install it, but the problem continues.
willbowling commented Apr 23, 2016
Should probably run gem bundler install? If that is what you intend to use.
Ie «bundle exec» etc.
I also personally use rvm for my ruby versions. It seems more maintainable.
On Apr 22, 2016 10:50 PM, «Dailson Campos» notifications@github.com wrote:
My problem is this «Make sure that gem install debugger -v ‘1.6.8’
succeeds before bundling error». What can I do?
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#3372 (comment)
dailsoncampos commented Apr 23, 2016
I run «bundle install».
➜ dailsoncampos git:(Production) ✗ bundle install
Fetching gem metadata from https://rubygems.org/.
Fetching version metadata from https://rubygems.org/.
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types 2.99
Using arel 6.0.3
Using debug_inspector 0.0.2
Using bundler 1.11.2
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using columnize 0.9.0
Using concurrent-ruby 1.0.1
Using debugger-linecache 1.2.0
Using debugger-ruby_core_source 1.3.8
Using multi_json 1.11.2
Using sass 3.4.22
Using tilt 2.0.2
Using spring 1.6.4
Using sqlite3 1.3.11
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mail 2.6.3
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 2.7.2
Using sprockets 3.5.2
Installing debugger 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Источник
Failed to build gem native extension #133
Comments
eduOSS commented Apr 18, 2015
I met a snag as the following:
The version of Ruby installed is ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux-gnu]
Could anyone please tell me why and how to tackle it? Thanks very much.
The text was updated successfully, but these errors were encountered:
parkr commented Apr 18, 2015
Did you also install the development headers? They don’t seem to be present:
eduOSS commented Apr 18, 2015
Do you mean installing ruby-dev? But the error remains the same after that step.
apt-get install ruby-dev
parkr commented Apr 19, 2015
You need the Ruby 2.1 dev headers. Maybe @envygeeks would know more on how to get them.
envygeeks commented Apr 19, 2015
sudo apt-get install ruby2.1-dev for 2.1.
eduOSS commented Apr 20, 2015
envygeeks commented Apr 20, 2015
There is something wrong with your apt source, Brightbox Ruby does have ruby2.1-dev but you can’t even reach it, which leads me to believe you need to remove the source and readd it.
martinbean commented Sep 28, 2015
I get this error when running sudo gem update github-pages . Is this related?
Updating installed gems
Updating github-pages
Building native extensions. This could take a while.
ERROR: Error installing github-pages:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
creating Makefile
make «DESTDIR=»
make: *** No rule to make target /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14/ruby/config.h’, needed by autolink.o’. Stop.
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/redcarpet-3.3.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/redcarpet-3.3.2/ext/redcarpet/gem_make.out
Nothing to update
My Ruby version when running ruby -v is reported as:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
parkr commented Sep 28, 2015
@martinbean Related, yes, but on a different platform.
martinbean commented Sep 28, 2015
@parkr Strange. I’m not running El Capitan (still on Mavericks).
parkr commented Sep 28, 2015
Check out the SDK version in that stack trace.
parkr commented Jan 25, 2016
Closing as stale.
Darshnik commented Apr 5, 2016
if using ruby version 2.2 or greater you need to have ruby2.2-dev
sudo apt-get install ruby2.2-dev
donli1210 commented Nov 15, 2016
You might take a look
midacts commented Jan 17, 2017
I am having a similar error on RHEL 7. I have also installed ruby-devel and am receving this error:
gem install tiny_tds —source http://rubygems.org
Building native extensions. This could take a while.
ERROR: Error installing tiny_tds:
ERROR: Failed to build gem native extension.
mkmf.rb can’t find header files for ruby at /opt/rh/rh-ruby22/root/usr/share/include/ruby.h
extconf failed, exit code 1
parkr commented Jan 17, 2017
@midacts It looks like you’re using a custom version of Ruby installed to /opt/rh/rh-ruby22/root/usr . Installing ruby-devel won’t install the headers into this location, but into /usr/share/include/ruby.h instead. You will need to install the headers for the binary located at /opt/rh/rh-ruby22/root/usr/bin/ruby .
inscrutabledude commented Feb 20, 2017
Hi @parkr Could you elaborate on how to do that? I’m a complete ruby noob, I’m just trying to get the knife-azure gem installed for chef, and am getting this message: current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.7.0.1/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170220-10621-ejv836.rb extconf.rb
mkmf.rb can’t find header files for ruby at /usr/lib/ruby/include/ruby.h
I tried this command: sudo apt-get install ruby2.3-dev
Then tried to install gem again, got: E: Unable to locate package ruby2.3.0-dev
Any advice appreciated!
BruceChen5683 commented Nov 13, 2017
I’ve installed git for windows,JRuby,rjgit and gollum serval days ago,and they work well. But gollum doesn’t recognize the form of table.When i install github-markdown by the command of gem install github-markdown,the error comes.
salmanfarisvp commented Dec 4, 2017 •
I got error while installing gem install github-pages
windows 10 machine
envygeeks commented Dec 4, 2017
I don’t know why I’m being pinged here, but switch to Linux on Windows, it’s better.
vrubiolo commented Apr 26, 2018
Hi there, sorry for respawning the thread but I preferred to do so as I think it applies to my issue.
I am trying to install Jekyll locally as per the official instructions. It fails when trying to build/install commonmarker:
Installing commonmarker 0.17.9 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/vincent/.gem/ruby/gems/commonmarker-0.17.9/ext/commonmarker
/usr/bin/ruby -r ./siteconf20180425-8716-wb76yr.rb extconf.rb
Ignoring ffi-1.9.18 because its extensions are not built. Try: gem pristine ffi —version 1.9.18
Ignoring json-1.8.6 because its extensions are not built. Try: gem pristine json —version 1.8.6
Ignoring nokogiri-1.7.1 because its extensions are not built. Try: gem pristine nokogiri —version 1.7.1
mkmf.rb can’t find header files for ruby at /usr/share/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/vincent/.gem/ruby/gems/commonmarker-0.17.9 for inspection.
Results logged to /home/vincent/.gem/ruby/extensions/x86_64-linux/2.4.0/commonmarker-0.17.9/gem_make.out
An error occurred while installing commonmarker (0.17.9), and Bundler cannot continue.
Make sure that gem install commonmarker -v ‘0.17.9’ succeeds before bundling.
In Gemfile:
github-pages was resolved to 182, which depends on
jekyll-commonmark-ghpages was resolved to 0.1.5, which depends on
jekyll-commonmark was resolved to 1.2.0, which depends on
commonmarker
The issue is that ruby.h is present on my machine (this is Fedora 26), albeit in a different location: /usr/include/ruby.h
I have a workaround in that I just symlink /usr/share/include/ruby.h to that location but I am not sure what is the status of Jekyll support via Github on the various distros. Is that an expected error (I am a newbie for Ruby-related things)?
stevokk commented Aug 9, 2018
I had the same above issue but it turned out I did need to install the ruby headers
sudo apt-get install ruby-all-dev
Link to solutions for other distros: StackOverflow Answer
Mine also needed zlib, so:
sudo apt-get install zlib1g-dev
AlasdairGray commented Sep 24, 2018
On a Mac, make sure that you have the commandline tools installed
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник