R.J. Robinson R.J. Robinson - 5 months ago 15x
Ruby Question

OSX gcc not working

I updated xcode, and my RVM, to use 2.2.2, and I am getting a build error for nokogori.

I have homebrew installed, but the gcc seems to be failing.

Not sure how to fix this. I cant uninstall it via homebrew.

help is needed.


Installing nokogiri with native extensions

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

/Users/rrobin008c/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20160229-32117-193tc6c.rb extconf.rb --use-system-libraries
checking if the C compiler accepts -O2 -arch x86_64... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling html_document.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [html_document.o] Error 1

make failed, exit code 2


The error ended up being the default version of ruby that came with my installation.

Steps I took to solve this.

  1. Removed any gcc installed. This would include the casks that home brew also had placed in there.

  2. removed any and all ruby versions, rvm (chruby, etc.. ), their respective gemsets.

  3. Clean up .profile( .bashrc, .zshrc, etc...) to remove any calls to ruby

  4. Install homebrew, then install gcc. There may be a syslink that needs to be created, or there should be a prompt to run brew link gcc

  5. install your ruby version manager, I use RVM.

  6. Install ruby version x.x.x , and follow directions.