[libcxx-commits] [PATCH] D107799: [CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux

Mike Hommey via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 15 21:07:36 PDT 2022

glandium added a comment.

I don't know how this works for you. CMake gets a list of implicit link dirs from parsing the ld command that `clang -v` outputs when linking. When `$clang/lib/x86_64-unknown-linux-gnu` exists, that's part of that output. Then, CMake determines the arch it later uses when finding libraries by matching architectures <https://github.com/Kitware/CMake/blob/master/Modules/CMakeParseLibraryArchitecture.cmake#L17> in each of the implicit link dirs, and `$clang/lib/x86_64-unknown-linux-gnu` is the first match. From there [it uses `x86_64-unknown-linux-gnu`](https://github.com/Kitware/CMake/blob/master/Source/cmSearchPath.cxx#L180), and of course it doesn't find libraries in `/usr/lib/x86_64-linux-gnu` because it never looks there in `find_library`. That can even affect pkg-config, because it uses that same derived architecture to find pkgconfig directories <https://github.com/Kitware/CMake/blob/master/Modules/FindPkgConfig.cmake#L412>. When `$clang/lib/x86_64-unknown-linux-gnu` doesn't exist, `/lib/x86_64-linux-gnu` is the first match, and it uses `x86_64-linux-gnu` as arch, and that works.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list