<div dir="ltr"><div>Hi Jonas,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Replies are inline.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 2, 2018 at 1:00 PM, Jonas Hahnfeld <span dir="ltr"><<a href="mailto:hahnjo@hahnjo.de" target="_blank">hahnjo@hahnjo.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Joel,<br>
<br>
I started a discussion about this on cfe-dev a while ago: <a href="http://lists.llvm.org/pipermail/cfe-dev/2017-January/052499.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermai<wbr>l/cfe-dev/2017-January/052499.<wbr>html</a></blockquote><div><br></div><div><div>Thanks for the link.  I had missed that.<br></div><div><br></div><div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
The short answer is that there are / might be more libraries than just the OpenMP runtime (or libunwind in my case), so changing the default might break on some systems.<br></blockquote><div><br></div>That's a good point.  However, there was a suggestion in that thread to create a dedicated directory:<div><br></div><div><a href="http://lists.llvm.org/pipermail/cfe-dev/2017-January/052510.html">http://lists.llvm.org/pipermail/cfe-dev/2017-January/052510.html</a><br></div><div><br></div><div>That seems like the cleanest solution.  Was some problem found with that proposal?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I had a patch in <a href="https://reviews.llvm.org/D26244" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2624<wbr>4</a> that added a CMake flag to change the behaviour, but I lost interest after some time. Feel free to revive it if it's important for you.<br></blockquote><div><br></div><div>I'd rather it just work without a special config.  I think a dedicated directory would achieve that.</div><div><br></div><div>Thanks.</div><div><br></div><div>Joel<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Cheers,<br>
Jonas<div><div class="gmail-h5"><br>
<br>
On 2018-08-02 18:10, Joel E. Denny via cfe-dev wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
Hi,<br>
<br>
I'm trying to understand clang's ordering of -L flags, which, on my<br>
system, leads to linking against a system libomp rather than the<br>
clang/LLVM libomp.<br>
<br>
Specifically, on my system, running with -v shows that it specifies<br>
-L/usr/lib/x86_64-linux-gnu before the -L for my llvm/clang<br>
build/install directory.  The effect is that it finds the system<br>
libomp.so.5 as libomp.  When the executable loads, it then looks for<br>
libomp.so.5 instead of the libomp.so built for llvm, so even<br>
LD_LIBRARY_PATH doesn't help it find the latter.<br>
<br>
Is this intended behavior for some reason?  Shouldn't clang prefer its<br>
own libraries before system libraries?<br>
A fix for my use case is to, in lib/Driver/ToolChains/Linux.cp<wbr>p, move<br>
the following lines from near the end of the Linux constructor to<br>
earlier, right after the declaration of the Paths variable:<br>
<br>
if (StringRef(D.Dir).startswith(S<wbr>ysRoot))<br>
  addPathIfExists(D, D.Dir + "/../lib", Paths);<br>
<br>
By the way, in case it helps, the ToolChain constructor also tries to<br>
insert the following subdirectories of the build/install directory,<br>
but they don't exist on my system:<br>
<br>
lib/clang/7.0.0/x86_64-unknown<wbr>-linux-gnu/lib<br>
lib/clang/7.0.0/lib/linux/x86_<wbr>64<br>
<br>
Thanks.<br>
<br>
Joel<br></div></div>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote>
</blockquote></div><br></div></div>