Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 478348

Summary: sys-devel/llvm: LD_LIBRARY_PATH hack breaks building with clang
Product: Gentoo Linux Reporter: Michał Górny <mgorny>
Component: Current packagesAssignee: Michał Górny <mgorny>
Status: RESOLVED FIXED    
Severity: normal CC: galtgendo, qa, ryao, voyageur
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-27 10:50:26 UTC
It seems that my smart LD_LIBRARY_HACK outsmarted me.

I added LD_LIBRARY_PATH to built libraries to the ebuild to not have to use $ORIGIN or anything like that in RPATH. This way, we could build all the executables with final rpaths while keeping them working in the build directory.

However, now it got to me that it means that also system executables are going to use just-built libraries. The effect is that if clang is used to build llvm, it starts to use just-built llvm library that can be incompatible with it.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-27 19:50:11 UTC
QA, could you lend a hand?

LLVM has a bunch of custom Makefiles on top of autoconf. AFAICS rpath is set only during build-time and files are not re-linked during install.

The default RPATH is:

  $ORIGIN/../lib

which is fine for build tree structure but incorrect/not meaningful for install (since we install in $(get_libdir)/llvm).

I first replaced that path with the actual install path and used LD_LIBRARY_PATH but it causes issues described above. Just-compiled executables are used throughout the build and tests.

What do you suggest? Should I just link with both RPATHs, or use some other hack during compile/test? I'd rather not get too dep hacking the build system. Do we have any kind of tool to strip RPATH off installed files?
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2013-07-27 21:48:48 UTC
chrpath
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-07-30 14:05:16 UTC
/var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-3.3-r1.ebuild,v  <--  llvm-3.3-r1.ebuild
new revision: 1.3; previous revision: 1.2
/var/cvsroot/gentoo-x86/sys-devel/llvm/llvm-9999-r1.ebuild,v  <--  llvm-9999-r1.ebuild
new revision: 1.4; previous revision: 1.3

Done with chrpath as suggested.
Comment 4 Rafał Mużyło 2013-11-06 08:17:26 UTC
Just out of curiosity: if I adjust the still in tree llvm-3.3-insecure-rpath.patch to apply on top of llvm-3.3-gentoo-install.patch and drop chrpath, llvm-3.3-r1 seems to build fine.
How can I tell if whatever is supposed to be broken in such case, really is ?