[cfe-dev] [RFC] Prefer libraries installed next to Clang over those from GCC

Hal Finkel via cfe-dev cfe-dev at lists.llvm.org
Mon Jan 30 08:57:33 PST 2017


On 01/30/2017 09:09 AM, Hahnfeld, Jonas via cfe-dev wrote:
> Hi,
>
> Background: I'm on CentOS 7 which has GCC 4.8 installed in /usr/bin and I'm
> installing Clang to, let's say, /opt/clang. (I'm doing so with
> CLANG_DEFAULT_CXX_STDLIB=libc++, just if you wonder why the following
> matters to me...)
> With the current behavior, -lunwind passed to Clang will pull in the system
> default non-GNU /usr/lib/libunwind.so.8. IMO it should take LLVM's version
> in /opt/clang/lib/libunwind.so.1
>
> That's why I would like to change the default order for searching libraries
> in Clang. Currently (and most probably due to historical reasons), the
> Driver adds paths next to GCC first.
> I propose to prefer paths next to the installed Clang. You can find the
> patch doing the change here: https://reviews.llvm.org/D26244
>
> However, this has a potential impact as Chandler pointed out in above patch
> if Clang is installed to /opt/software together with other software.
> With my proposed change, Clang will link against
> /opt/software/lib/libunrelated.so when passed -lunrelated whereas before it
> had preferred /usr/lib/libunrelated.so (assuming that the library exists in
> both places).
> Is that considered an important scenario or can we expect our users to
> install Clang separately?
>
> Any other feedback on that topic?

I think this is an important usage scenario, but because of the 
complication Chandler mentioned, I don't think we can enable it by 
default. I think it is very reasonable to have some CMake flag that 
enables this behavior.

  -Hal

> Jonas
>
> --
> Jonas Hahnfeld, MATSE-Auszubildender
>
> IT Center
> Group: High Performance Computing
> Division: Computational Science and Engineering
> RWTH Aachen University
> Seffenter Weg 23
> D 52074  Aachen (Germany)
> Hahnfeld at itc.rwth-aachen.de
> www.itc.rwth-aachen.de
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170130/1271692d/attachment.html>


More information about the cfe-dev mailing list