[llvm-dev] Link statically against libc++ on Cray XC 40
Schlottke-Lakemper, Michael via llvm-dev
llvm-dev at lists.llvm.org
Wed Sep 30 03:09:07 PDT 2015
I don't recommend to use shared libs, but if you add CC -shared it
will do shared linking.
No, you are right, I would prefer not to do that, since that means I also have to change other things in the compilation (like adding -fPIC everywhere).
Also if you add -v to compilation you can see
the collect2 line (which is basically the linker line). That info
would give you enough to manually figure out your -L and -rpath. From
there you can do a simple clang wrapper script to work-around modules.
My goal is not to use clang to compile & link our program, but rather just to link against libLLVMSupport, so I already know all paths I need. Using clang as the main compiler on the XC 40 is probably a little more challenging, so unless someone from the computer center where the XC40 is located, or someone from Cray directly, is willing to help us with that, we are not trying to go there alone (we have asked but no reply yet).
The problem isn't going to be resolving static compilation, but making
mpiCC work. The modified mpich which Cray uses links *everything*
against GNU C++ STL and runtime. That will out-of-the-box conflict
with libc++. So you can get clang to work using the gnu
stl/runtime/libunwind, but libc++ is no-go.
Hm, maybe I don’t understand. We already do that (successfully) on our institute cluster, where we compile with GCC as usual and just link against libLLVMSupport, libdl, libtinfo, libpthread, libc++, and libc++abi, all in addition to the normal libraries (including libstdc++). But I am not an expert on such things, maybe I just did not grasp your intent.
side note: Why are you trying to pull in libLLVMSupport.a (I suspect
this may not be correct unless you're trying to build clang itself)
We use its "llvm::sys::PrintStackTrace(llvm::errs())" functionality as a portable and easy-to-use (at least on hosts where clang is preinstalled) way to print stacktraces in case of self-detected runtime errors. Before we used a hack using GCC extensions and calls to “addr2line”, but that works only with GCC (and not reliably).
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150930/5063e497/attachment.html>
More information about the llvm-dev
mailing list