This is an archive of the discontinued LLVM Phabricator instance.

[llvm-config] Report --bindir based on LLVM_TOOLS_INSTALL_DIR
ClosedPublic

Authored by loladiro on Jul 18 2016, 9:53 PM.

Details

Summary

LLVM_TOOLS_INSTALL_DIR was introduced in r272200 in order to override the directory
name into which to install LLVM's executable. However, llvm-config --bindir still reported
$PREFIX/bin independent of what LLVM_TOOLS_INSTALL_DIR was set to.

This fixes the out-of-tree clang standalone build for me.

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro updated this revision to Diff 64444.Jul 18 2016, 9:53 PM
loladiro retitled this revision from to [llvm-config] Report --bindir based on LLVM_TOOLS_INSTALL_DIR.
loladiro updated this object.
loladiro added a reviewer: beanz.
loladiro set the repository for this revision to rL LLVM.
loladiro added a subscriber: llvm-commits.
tstellar added inline comments.
tools/llvm-config/llvm-config.cpp
331 ↗(On Diff #64444)

LLVM_TOOLS_INSTALL_DIR can be a path relative to CMAKE_INSTALL_PREFIX or it can be an absolute path. So this won't work if it's an absolute path.

beanz edited edge metadata.May 31 2017, 11:39 AM

I'm confused. In what situation is llvm-config installed into a directory that isn't the LLVM_TOOLS_INSTALL_DIR? It seems to me that if llvm-config is installed in LLVM_TOOLS_INSTALL_DIR this should work.

Not sure what you're asking. llvm-config is certainly generally installed there, but --bindir is wrong without this patch, so people using that will be confused (at least that was the case when I wrote this patch - it's been a while).

tstellar edited edge metadata.May 31 2017, 12:40 PM

I'm confused. In what situation is llvm-config installed into a directory that isn't the LLVM_TOOLS_INSTALL_DIR? It seems to me that if llvm-config is installed in LLVM_TOOLS_INSTALL_DIR this should work.

If LLVM_TOOLS_INSTALL_DIIR = /usr/libexec/llvm, then --bindir will be wrong, also if LLVM_TOOLS_INSTALL_DIR is not CMAKE_INSTALL_PREFIX/bin, then --includedir and --libdir will be wrong.

beanz added a comment.May 31 2017, 1:47 PM

Ah! I see now. Probably the only thing that needs to be changed is handling LLVM_TOOLS_INSTALL_DIR being absolute. Otherwise the patch seems good to me.

loladiro updated this revision to Diff 100927.May 31 2017, 3:30 PM
loladiro edited the summary of this revision. (Show Details)

Handle absolute path case

I think this should work. Take a look.

beanz added a comment.May 31 2017, 3:45 PM

That looks like that should work to me. Seems good. @tstellar, does this resolve your issue?

tstellar accepted this revision.May 31 2017, 7:35 PM

Yes, this is fine with me. Thanks.

This revision is now accepted and ready to land.May 31 2017, 7:35 PM
This revision was automatically updated to reflect the committed changes.