Question about filename output with building compiler-rt

I was trying to build LLVM 15.0.7 on my Ubuntu 20.04 (x86_64) and added compiler-rt in list of projects to enable. After the build I see the files like the asan library are generated in
lib/clang/15.0.7/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a

But when I do a apt-get install clang-15 on my Ubuntu 22.04, it has different filename and file path:
lib/clang/15.0.7/lib/linux/libclang_rt.asan-x86_64.a

I wondering why is there a different in filename and path and if I setup the build wrong?

compiler-rt can be built to either output files in a target triple directory, which is the default or what you’re seeing, or with the file name containing the platform instead (which is what your apt package is doing). LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is the CMake flag that controls that. Both setups are valid; the triple directory is sensitive to the exact spelling of the triple, but that shouldn’t really matter unless you’re planning to cross-compile.

Thanks. It works.

1 Like