sparklemotion/nokogiri.org-tutorials

Gem::Ext::BuildError: ERROR: Failed to build gem native extension on Mac

00ec454 opened this issue · 2 comments

When trying to bundle install on my project I face the following problem. I am on Mac OS X v10.9.5

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

    /Users/testuser/.rvm/rubies/ruby-1.9.3-p125-perf/bin/ruby -r ./siteconf20150601-54850-vzs0rk.rb extconf.rb --use-system-libraries
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... 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  clean

make
compiling html_document.c
compiling html_element_description.c
html_element_description.c: In function 'get_description':
html_element_description.c:249:10: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
compiling xml_attribute_decl.c
compiling xml_cdata.c
compiling xml_comment.c
compiling xml_document.c
xml_document.c: In function 'set_encoding':
xml_document.c:159:12: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
xml_document.c: In function 'canonicalize':
xml_document.c:505:15: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
compiling xml_document_fragment.c
compiling xml_dtd.c
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
compiling xml_io.c
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
compiling xml_node_set.c
xml_node_set.c: In function 'dealloc_namespace':
xml_node_set.c:9:13: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
xml_node_set.c:11:13: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
compiling xml_processing_instruction.c
compiling xml_reader.c
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
compiling xml_xpath_context.c
compiling xslt_stylesheet.c
linking shared-object nokogiri/nokogiri.bundle
ld: warning: directory not found for option '-L/opt/local/lib'
ld: warning: ignoring file /usr/local/lib/libz.dylib, file was built for i386 which is not the architecture being linked (x86_64): /usr/local/lib/libz.dylib
ld: in '/usr/local/lib/libz.1.dylib', file was built for i386 which is not the architecture being linked (x86_64): /usr/local/lib/libz.1.dylib for architecture x86_64
collect2: ld returned 1 exit status
make: *** [nokogiri.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/testuser/.rvm/gems/ruby-1.9.3-p125-perf/gems/nokogiri-1.5.5 for inspection.
Results logged to /Users/testuser/.rvm/gems/ruby-1.9.3-p125-perf/extensions/x86_64-darwin-13/1.9.1/nokogiri-1.5.5/gem_make.out
An error occurred while installing nokogiri (1.5.5), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.5'` succeeds before bundling.

It looks like your libz is not compatible with your architecture. I'm not sure exactly how you do this, but you need to download and link a different build of it that matches your architecture. You can probably do this with homebrew.

Hi, this repo is for documentation updates. Is there a documentation change you'd like to make to address this? If not, perhaps try the nokogiri mailing list or the nokogiri repo for help.