Bisection found that r362047 (and its followup build fix r362065) cause the build to install the android PGO library into the following location: stage2/clang/lib/linux/libclang_rt.profile-arm-android.a rather than the expected: stage2/clang/lib64/clang/$VERSION/lib/linux/libclang_rt.profile-arm-android.a For lack of any progress in debugging this, revert those two patches. --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -60,12 +60,11 @@ project(Runtimes C CXX ASM) - find_package(LLVM PATHS "${LLVM_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - # Add the root project's CMake modules, and the LLVM build's modules to the # CMake module path. list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/../cmake" "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules" + "${LLVM_LIBRARY_DIR}/cmake/llvm" ) # Some of the runtimes will conditionally use the compiler-rt sanitizers @@ -80,6 +79,11 @@ endif() endif() + # LLVMConfig.cmake contains a bunch of CMake variables from the LLVM build. + # This file is installed as part of LLVM distributions, so this can be used + # either from a build directory or an installed LLVM. + include(LLVMConfig) + # Setting these variables will allow the sub-build to put their outputs into # the library and bin directories of the top-level build. set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR}) @@ -89,9 +93,6 @@ set(LLVM_MAIN_SRC_DIR ${LLVM_BUILD_MAIN_SRC_DIR}) set(LLVM_CMAKE_PATH ${LLVM_MAIN_SRC_DIR}/cmake/modules) - # This variable is used by individual runtimes to locate LLVM files. - set(LLVM_PATH ${LLVM_BUILD_MAIN_SRC_DIR}) - if(APPLE) set(LLVM_ENABLE_LIBCXX ON CACHE BOOL "") endif() @@ -380,6 +381,8 @@ # Builtins were built separately above CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR} + -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR} -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE} -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED} -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON @@ -470,6 +473,8 @@ # Builtins were built separately above CMAKE_ARGS -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} + -DLLVM_BINARY_DIR=${LLVM_BINARY_DIR} + -DLLVM_LIBRARY_DIR=${LLVM_LIBRARY_DIR} -DLLVM_DEFAULT_TARGET_TRIPLE=${target} -DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED} -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON