Opened 14 years ago

Closed 14 years ago

#26337 closed defect (fixed)

ruby19-1.9.2-p0 build fails with wrong-arch libz.1.dylib in /usr/local/lib

Reported by: timpalpant@… Owned by: kimuraw (kimura wataru)
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: Cc:
Port: ruby19

Description

Ruby19 (1.9.2-p0) attempts to link against /usr/local/lib/libz.1.dylib instead of the MacPorts version /opt/local/lib/libz.1.dylib. This throws an error when attempting to link against the library (even though it is a fat binary and actually contains i386, x86_64, and ppc architectures).

Attempting to build ruby19 (1.9.2-p0) on Snow Leopard with Xcode 3.2.3 using a fresh install of MacPorts (1.9.1):

:info:build compiling digest/md5
:info:build /usr/bin/gcc-4.2 -dynamic -bundle -o ../../../.ext/x86_64-darwin10/digest/md5.bundle md5init.o md5ossl.o -L. -L../../.. -L. -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lruby.1.9.1 -lcrypto  -lpthread -ldl -lobjc 
:info:build ld: in /usr/local/lib/libz.1.dylib, file was built for i386 which is not the architecture being linked (x86_64)
:info:build collect2: ld returned 1 exit status
:info:build make[1]: *** [../../../.ext/x86_64-darwin10/digest/md5.bundle] Error 1
:info:build make: *** [mkmain.sh] Error 1
:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_ruby19/work/ruby-1.9.2-p0" && /usr/bin/make -j2 all " returned error 2
:error:build Target org.macports.build returned: shell command failed
:debug:build Backtrace: shell command failed
    while executing
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
:info:build Warning: the following items did not execute (for ruby19): org.macpolocalhost:_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_

Attachments (1)

main.log (13.1 KB) - added by timpalpant@… 14 years ago.
Build log

Download all attachments as: .zip

Change History (9)

Changed 14 years ago by timpalpant@…

Attachment: main.log added

Build log

comment:1 Changed 14 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to kimuraw@…
Port: ruby19 added

comment:2 in reply to:  description Changed 14 years ago by timpalpant@…

A few corrections:

I called lipo on:

  1. /opt/local/lib/libz.dylib -> x86_64 (the MacPorts version)
  2. /usr/lib/libz.dylib -> fat with i386, x86_64, and ppc (the Snow Leopard version)
  3. /usr/local/lib/libz.dylib -> i386 (?)

I'm not sure what the library in /usr/local/lib/ is from, why it is i386 only, and why this error only appeared now. But I fixed my problem by replacing it with the 10.6 version (as described here:

http://www.refresherate.com/2010/01/08/fixing-ld-warning-in-usrlocalliblibz-dylib-file-is-not-of-required-architecture/.

I think that the ruby19 MacPort should still build against /opt/local/lib/libz.dylib, but if not, than this was a problem with my computer only.

comment:3 Changed 14 years ago by jmroot (Joshua Root)

Summary: ruby19-1.9.2-p0 Incorrect architecture build error against libz.1.dylibruby19-1.9.2-p0 build fails with wrong-arch libz.1.dylib in /usr/local/lib

comment:4 Changed 14 years ago by kimuraw (kimura wataru)

Status: newassigned

I guess there is something wrong in your port:openssl. Please show me the results of the following commands.

% port installed openssl
The following ports are currently installed:
  openssl @0.9.8k_0+darwin
    :
  openssl @1.0.0a_0+universal (active)
% file /opt/local/lib/libcrypto.dylib
/opt/local/lib/libcrypto.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libcrypto.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/opt/local/lib/libcrypto.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
% otool -L /opt/local/lib/libcrypto.dylib
/opt/local/lib/libcrypto.dylib:
	/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
%

comment:5 in reply to:  4 Changed 14 years ago by timpalpant@…

If it's just a problem with my machine, there's no reason to worry about it. I just wanted to make sure it wasn't a problem in general. Here is the output you requested:

% port installed openssl
The following ports are currently installed:
  openssl @1.0.0a_0 (active)
% file /opt/local/lib/libcrypto.dylib 
/opt/local/lib/libcrypto.dylib: Mach-O 64-bit dynamically linked shared library x86_64
% otool -L /opt/local/lib/libcrypto.dylib 
/opt/local/lib/libcrypto.dylib:
	/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

comment:6 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

There is a general problem, which is that MacPorts software will generally use software from /usr/local if it's there. That's why we tell people not to have anything in /usr/local if they're going to be using MacPorts.

comment:7 Changed 14 years ago by kimuraw (kimura wataru)

I added a configure option to prefer macports' libraries in building ruby19 at r71867. I believe this change fixed your problem.

Please try the latest port:ruby19.

comment:8 Changed 14 years ago by kimuraw (kimura wataru)

Resolution: fixed
Status: assignedclosed

I close this ticket. If your problem is not solved, you can reopen this ticket.

Note: See TracTickets for help on using tickets.