Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

having this problem on installing several things on my mac, i think this problem is coming from upgrading my leopard to snow leopard. Also this problem also is linked with macports i think.

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

Any ideas?

Update

To be more specific this happens on installing nokogiri gem

and the log looks like:

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
like image 224
dombesz Avatar asked Sep 13 '10 10:09

dombesz


1 Answers

This is not about MacPorts: zlib is installed as i386, so you have to build it for x86-64. Here's how to do it:

  1. Update: As Nick says in his comment, you first have to remove old zlib files: sudo rm /opt/local/lib/libz*
  2. Download zlib source code from its webpage
  3. Extract the source, and open a terminal in source location
  4. ./configure, make and sudo make install
  5. If it still doesn't work, remove ruby and install it again (you can do it with RVM)

Hope it helped you.

like image 136
Carlos Precioso Avatar answered Sep 24 '22 10:09

Carlos Precioso