Llvm-config --libdir wrong?

Not sure what category, so decided with beginners since it doesn’t quite fit elsewhere?

I’m having some bother with llvm-config when running it from an install dir - the path is being reported wrong:

neil@MacBook-Air-2 build % ./bin/llvm-config --libdir        
/Users/neil/Code/llvm-project/build/lib
neil@MacBook-Air-2 build % ./install/bin/llvm-config --libdir
/Users/neil/Code/llvm-project/build/RELEASE/lib

The build dir is reporting the right --libdir, but the install dir is completely wrong. Am I doing something stupid?

This could be a bug with llvm-config. There are a couple of heuristics to make it do the right thing from inside the build tree, including this bit around llvm-config.cpp:318:

  } else if (sys::fs::equivalent(sys::path::parent_path(CurrentExecPrefix),
                                 LLVM_OBJ_ROOT)) {
    IsInDevelopmentTree = true;
    DevelopmentTreeLayout = CMakeBuildModeStyle;
    ActiveObjRoot = LLVM_OBJ_ROOT;

So if the parent directory of the exec prefix is the build root, we assume we’re doing a multiconfig build (like MSVC) and need to add the build mode to the path, hence the “RELEASE” subdirectory.

I guess the easiest way to avoid this (at least short term) is “don’t install inside the build tree”. The correct fix is probably to update that heuristic to see if the subdirectory is named as build_mode.