[lldb-dev] Heads-up: FreeBSD LLDB CMake build broken by relative rpath change

Ed Maste emaste at freebsd.org
Thu Feb 27 06:18:09 PST 2014


> LLVM r201936 restores the use of a relative rpath but this breaks LLDB
> on FreeBSD.  For now I've disabled CMAKE_BUILD_WITH_INSTALL_RPATH
> locally until the fix can be found, in the top-level LLVM
> CMakeLists.txt:

I found out what the problem is -- the -zorigin flag isn't being
passed to the linker, so the ORIGIN flag isn't set.  I guess either
the GNU runtime linker doesn't check, or a later version of GNU ld
sets the flag automatically; either way, FreeBSD needs -zorigin.  I
applied this patch:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ce214a..86bb4c5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -445,6 +445,7 @@ if (APPLE)
 else(UNIX)
   if(NOT DEFINED CMAKE_INSTALL_RPATH)
     set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
+    set(CMAKE_EXE_LINKER_FLAGS "-Wl,-zorigin")
   endif(NOT DEFINED CMAKE_INSTALL_RPATH)
 endif()

and LLDB works as the binary has the flag set:

%feynman% readelf -d bin/lldb | egrep 'PATH|FLAGS'
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
 0x000000000000001e (FLAGS)              ORIGIN
 0x000000006ffffffb (FLAGS_1)            Flags: ORIGIN



More information about the lldb-dev mailing list