Skip to content

llvm-config --ldflags incorrect when llvm is installed inside build directory #152976

@DavidSpickett

Description

@DavidSpickett

Originally reported in https://discourse.llvm.org/t/compiled-llm-config-executable-programs-do-not-correctly-point-to-the-installation-directory/87766.

Build llvm as follows:

$ mkdir build-llvm-config && cd llvm-config
$ make ../llvm-project/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/david.spickett/build-llvm-config/llvm.install -G Ninja -DLLVM_CCACHE_BUILD=ON && ninja && ninja install

Note that the install directory is inside the build directory.

This causes the llvm-config in the installed directory to report an incorrect library path:

~/build-llvm-config$ ./llvm.install/bin/llvm-config --ldflags
-L/home/david.spickett/build-llvm-config/Release/lib

The one in the build directory's bin points to the build's library dir as expected:

~/build-llvm-config$ ./bin/llvm-config --ldflags
-L/home/david.spickett/build-llvm-config/lib 

I think llvm-config has autodetected as InDevelopmentTree true (which it is, sort of) and DevelopmentTreeLayout of CMakeBuildModeStyle. This causes it to put build_mode in the path which is read from LLVM_BUILDMODE which would be Release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm-toolsAll llvm tools that do not have corresponding tag

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions