Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Shared library builds but doesn't work on Mac OS X 10.6 #9349

Open Quuxplusone opened 13 years ago

Quuxplusone commented 13 years ago
Bugzilla Link PR8985
Status NEW
Importance P normal
Reported by Ronaldo Ferraz (ronaldoferraz@gmail.com)
Reported on 2011-01-16 13:37:45 -0800
Last modified on 2012-02-28 18:24:01 -0800
Version 2.8
Hardware Macintosh MacOS X
CC fang@csl.cornell.edu, llvm-bugs@lists.llvm.org, ronaldoferraz@gmail.com
Fixed by commit(s)
Attachments Makefile.rules.patch (545 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 6007
Makefile.rules patch for Mac OS X 10.6

Using ./configure  --enable-shared compiles cleanly but as soon as one tries to
load the library--for example, in Ruby using FFI--the following error is
generated.

dyld: loaded: /Users/<user>/llvm/2.8/lib/libLLVM-2.8.dylib
dyld: lazy symbol binding failed: Symbol not
found:__ZN4llvm2cl6Option11addArgumentEv
  Referenced from: /Users/<user>/llvm/2.8/lib/libLLVM-2.8.dylib
  Expected in: flat namespace

dyld: Symbol not found: __ZN4llvm2cl6Option11addArgumentEv
  Referenced from: /Users/<user>/llvm/2.8/lib/libLLVM-2.8.dylib
  Expected in: flat namespace

Trace/BPT trap

Applying the attached patch fixes the problem.

The modified options use the default two-level namespace on OS X and change
name resolution to run time lookup. The library compiles cleanly and loads
properly with those options.

Using those options doesn't seem to have any ill effect but maybe there's a
reason why the former options were used, although many dynamic libraries for
Mac OS X are compiled with the latter--the former actually seems to be a legacy
from pre-10.3 days.
Quuxplusone commented 13 years ago

Attached Makefile.rules.patch (545 bytes, application/octet-stream): Makefile.rules patch for Mac OS X 10.6

Quuxplusone commented 12 years ago

I don't know what's happened since then, but I've been able to build the shared libraries using the cmake build on 10.6 and 10.4 with release 3.0. I haven't bothered with the configure-build, since it doesn't use libtool (and ran into issues that libtool normall takes care of).