Building the shared library on Mac OS X


I'm new to LLVM and have been trying to build the shared library with
mixed success.

Using ./configure --enable-shared compiles cleanly but as soon as I
try to load the library--for example, in Ruby using FFI--I get the
following error:

dyld: loaded: /Users/<user>/llvm/2.8/lib/libLLVM-2.8.dylib
dyld: lazy symbol binding failed: Symbol not
  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

So I applied the following change (after a conversation with a fellow
developer facing the same problems):

diff --git a/Makefile.rules b/Makefile.rules
index 9cff105..44d5b2d 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -497,7 +497,7 @@ ifeq ($(HOST_OS),Darwin)
   # Get "4" out of 10.4 for later pieces in the makefile.
   DARWIN_MAJVERS := $(shell echo $(DARWIN_VERSION)| sed -E

- SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined,suppress \
+ SharedLinkOptions=-Wl,-undefined,dynamic_lookup \
   ifneq ($(ARCH),ARM)
     SharedLinkOptions += -mmacosx-version-min=$(DARWIN_VERSION)

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

Using those options doesn't seem to have any ill effect but I'm
wondering if there's a reason why the previous options were used,
especially since many dynamic libraries for Mac OS X are compiled with
the latter--the former actually seems to be a legacy from pre-10.3

Any thoughts?

Best regards,