[PATCH] D146918: [CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_rpath()

Finagolfin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 05:23:13 PDT 2023


finagolfin added a comment.

> if e.g. clang is broken when you install it because it's pointing at an LLVM build directory (which no longer exists), why wouldn't you also install LLVM?

Not sure what you mean. It is broken because clang has a non-existent build directory in its install runpath, like `/home/build-user/build/buildbot_linux/` in the example above. Installing LLVM in a separate install directory like `/usr/bin/` changes nothing about that.

> And therefore, why wouldn't you point LLVM_LIBRARY_DIR at the LLVM install rather than the build directory?

Simple, you may not want to install the freshly-built LLVM on the build host and then build against it, as you may not even have root on there. There are many scenarios where you simply want to build against the LLVM build directory, many more than building against the LLVM install directory, which is why the build directory is the default.

> It seems to me that if you're pointing LLVM_LIBRARY_DIR at a build directory which differs from the installed one, that is another risky case for something breaking, since the configurations of the build and install may not match.

Not risky at all, it is much more common than your Nixpkgs scenario.

> I'm not seeing that as evidence that it's set to the build directory as a more common use case

Generally, the default is the most common usecase, I suspect you will find very few build recipes <https://repology.org/project/llvm/versions> that override that default `LLVM_LIBRARY_DIR` to set their own.

> what I see there is that those values are meant to match up with llvm-config, which I think of as an install artifact which can be used to determine paths for out of tree projects to build and linking against LLVM, which I would expect to contain install paths and not build paths

You have the prominent counter-examples of the official LLVM and Swift toolchains using the default of the LLVM build directories instead, as evidence by this commit message, and I suspect most of the distro LLVM build recipes I linked above simply use that default of the LLVM build directory too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146918/new/

https://reviews.llvm.org/D146918



More information about the llvm-commits mailing list