I'm new to clang. Over the weekend I was trying to build all of llvm/clang/libc++ on FreeBSD 11. After finding out the hard way that the default debug build generates executables with a text segment size too big to load [and I don't know how to increase it with limit/ulimit, but that's another story], I managed to get a release build.
However, the executables (or more precisely the dependent libraries) in the install directory don't have functional rpath/runpath set.
I see that the executables have rpath and runpath set to '$ORIGIN/../lib' [good!].
However, libc++.so.1 has a dependency on libc++abi.so.1 and it doesn't have rpath or runpath set. My understanding is that runpath is not transitive and this is stopping libc++.so.1 from dynamically linking to libc++abi.so.1. I also noticed that libc++.so.1 in the build directory does have rpath/runpath set (to the system lib dir and the build lib dir, both absolute paths). Does this mean that 'gmake install' relinks the libraries rather than simply copying them?
I did try setting LD_RUN_PATH and CMAKE_SHARED_LINKER_FLAGS but they had no effect.
I can run the executables if I set LD_LIBRARY_PATH, but is there a cleaner way to get the right rpath/runpath in the dependent libs?