OpenEmbedded based SDKs stage toolchains outsides the target rootfs and
libomp.so is part of the target rootfs and not part of compiler
toolchain install or relative to it. It finds the libraries via
--sysroot during compile. This ensures that -rpath is not added for such
systems, since it is adding cross-compile paths to rpath which is not
correct when the binaries are run on real targets.
Details
- Reviewers
jhuber6 JonChesterfield jdoerfert
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Cross compilers are a hazard here. I'd expect there to be a fairly long list of magic flags you need to pass to clang to get it to find the right libraries. Can you add fno-openmp-implicit-rpath to that list instead?
A better solution might be a cmake flag to specify where to use for the implicit rpath directory instead of deriving it from sys::path::parent_path. That would let your target set up a cross compiling toolchain that creates binaries that are able to find libomp et al in whatever directory they're located, without assuming a whole llvm toolchain installed onto the target.
hmmm, I would say the original patch made assumption about native compile is the only option, clang claims to be inherently cross compiler. Anyway adding -fno-openmp-implicit-rpath would mean that all SDKs generated by OpenEmbedded/Yocto project will have to somehow specify this option by default as well. it might work for system builds by specifying in global CFLAGS or adding to CC var itself.
A better solution might be a cmake flag to specify where to use for the implicit rpath directory instead of deriving it from sys::path::parent_path. That would let your target set up a cross compiling toolchain that creates binaries that are able to find libomp et al in whatever directory they're located, without assuming a whole llvm toolchain installed onto the target.
right. Cmake flag route seems a good one. I will explore it.