/usr/local/lib/libz.1.dylib,文件是为i386构建的,它不是被链接的体系结构(x86_64)

在我的Mac上安装好几件事时遇到这个问题,我认为这个问题来自于将我的豹升级到雪豹。 此外,这个问题也与我认为的macports有关。

/usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64) 

有任何想法吗?

更新

更具体地说,这是在安装nokogiri gem时发生的

并且日志看起来像:

 xslt_stylesheet.c:127: warning: passing argument 1 of 'Nokogiri_wrap_xml_document' with different width due to prototype cc -dynamic -bundle -undefined suppress -flat_namespace -o nokogiri.bundle html_document.o html_element_description.o html_entity_lookup.o html_sax_parser_context.o nokogiri.o xml_attr.o xml_attribute_decl.o xml_cdata.o xml_comment.o xml_document.o xml_document_fragment.o xml_dtd.o xml_element_content.o xml_element_decl.o xml_encoding_handler.o xml_entity_decl.o xml_entity_reference.o xml_io.o xml_libxml2_hacks.o xml_namespace.o xml_node.o xml_node_set.o xml_processing_instruction.o xml_reader.o xml_relax_ng.o xml_sax_parser.o xml_sax_parser_context.o xml_sax_push_parser.o xml_schema.o xml_syntax_error.o xml_text.o xml_xpath_context.o xslt_stylesheet.o -L. -L/usr/local/lib -L/opt/local/lib -L/usr/local/lib -L/usr/lib -L. -lruby -lexslt -lxslt -lxml2 -lpthread -ldl -lobjc ld: in /usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64) collect2: ld returned 1 exit status make: *** [nokogiri.bundle] Error 1 

这是一个macport迁移到雪豹问题,遗憾的是你必须重新安装macports和所有端口才能拥有正确的架构。 在这里阅读维基: https : //trac.macports.org/wiki/Migration

这不是关于MacPorts:zlib是作为i386安装的,所以你必须为x86-64构建它。 这是怎么做的:

  1. 更新 :正如Nick在评论中所说,首先必须删除旧的zlib文件: sudo rm /opt/local/lib/libz*
  2. 从其网页下载zlib源代码
  3. 提取源,并在源位置打开终端
  4. ./configuresudo make install
  5. 如果它仍然无效,请删除ruby并重新安装(您可以使用RVM执行此操作)

希望它能帮助你。

  • 您可能在/usr/local/opt/zlib/安装了x86_64编译的zlib,或者执行brew install zlib这将在/usr/local/Cellar/安装zlib。
  • 临时将libz.*/usr/local/lib/删除到备份文件夹中。
  • gem install nokogiri -v '' --with-zlib-dir=

Nokogiri现在必须安装。 再次恢复备份libz。