[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17747: Potential bug on Mac OS X 10.9 ignoring -rpath

From: Pekka Nikander
Subject: bug#17747: Potential bug on Mac OS X 10.9 ignoring -rpath
Date: Tue, 10 Jun 2014 14:01:33 +0300

I am trying to compile the TCE LLVM backend (http://tce.cs.tut.fi) under Mac OS 
X Maverics.  The hardest problem I've encountered so far is that in addition to 
the LLVM 3.4 installed as a part of Mac OS X, the TCE environment requires its 
own, slightly patched version of LLVM 3.4.  Both of these are needed, as the 
native Mac OS X LLVM is needed to compile the TCE source code in native MachO 
binaries, while the TCE-internal LLVM is needed to compile source code for the 
TCE targets, including newlib.

Now, since both of them are LLVM 3.4, they both have identically named shared 
libraries, with identical APIs.  Hence, the two versions need to be 
differentiated with an embedded rpath.  Using the DYLD_LIBRARY_PATH will not 
work, as independent of which of the two versions I place into the 
DYLD_LIBRARY_PATH, some of the binaries fail at the dynamic linking phase due 
to library incompatibilities.

Now, it appears that libtool 2.4.2 is ignoring the -rpath option for darwin, 
i.e. Mac OS X.  I have no information why.

I'm enclosing a minimal patch that seems to fix this problem, allowing -rpath 
to be used from the libtool command line and be preserved all the way down to 
calling the compiler.

Please note that I'm a complete newbie to libtool internals.  Hence, this patch 
may well break something else.

--Pekka Nikander

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 44e0ecf..6cee273 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -1084,6 +1084,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
@@ -1102,14 +1103,14 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   if test "$_lt_dar_can_shared" = "yes"; then
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o 
\$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname 
\$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o 
\$lib \$libobjs \$deplibs \$compiler_flags -install_name \$soname \$verstring 
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle 
\$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > 
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -instal
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > 
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -instal
     _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > 
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib 
-bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_
     m4_if([$1], [CXX],
 [   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o 
\${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\${lib}-master.o \$deplibs \$compiler_flags -install_nam
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > 
\$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs 
-nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$al
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o 
\${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\${lib}-master.o \$deplibs \$compiler_flags -install_nam
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > 
\$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs 
-nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$al

Attachment: smime.p7s
Description: S/MIME cryptographic signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]