[LLVMbugs] [Bug 20510] clang doesnt use library search path that it was built with

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 4 11:48:06 PDT 2014


Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #5 from Reid Kleckner <rnk at google.com> ---
(In reply to comment #3)
> Reid:
> Dont get me wrong -- I’m nuts about clang in general, and especially the
> static analysis, sanitizers and related bits that help people, including us,
> build software that is more reliable and correct.  And I’m very grateful to
> those, like you, who make that possible.


> With all due respect, however, what you suggest is a workaround, not a fix,
> and not a particularly good one either -- it requires manually adding the
> library search paths, not of the compiler, but of the compiler that the
> compiler was built with.  Manually adding library search paths would be
> borked to begin with, but having to add the libraries that the compiler was
> built with is completely ridiculous.

I don't think this is too bad, it's just one more linker flag on top of
installing and using a new version of GCC, which is already a tall order. 
Setting an rpath is the standard way of using any library that is not installed
into /usr/lib.  Clang is just a normal application that wants to use a newer
copy of libstdc++.

> Please reopen this so that this bug (and it *is* a bug) is visible to
> someone who wants to work on fixes for the compiler.

What action needs to be taken to make this easy?  This really has more to do
with what gcc does when you compile a C++ app with it.  It will add -L flags to
the link line, but it will not set an rpath.

> In the meantime, I’m rebuilding clang with the native compiler (gcc 4.4.7)
> and hope that will work.  I’ll post back here what I find out.
(In reply to comment #4)
> OK, clang wont build w/gcc 4.4.7 -- not surprising, as that's well
> documented.
> OTOH, that does make it more egregious that clang insists on using that
> compiler as its default search path.

Clang is trying to act in exactly the same way as the "system" compiler, which
it assumes is installed in /usr, and will search /usr/include, /usr/lib, and a
variety of paths off of there.  If you have a more modern gcc and libstdc++
toolchain that you want it to use, I believe you can set GCC_INSTALL_PREFIX at
configure time.  I don't know how to do that in autoconf, though.  My best
guess is --with-gcc-toolchain.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140804/311f257d/attachment.html>

More information about the llvm-bugs mailing list