From 887828d502b49a09e56551e370cc6c1555ae3ff4 Mon Sep 17 00:00:00 2001 From: Qiongsi Wu Date: Fri, 21 Apr 2023 11:31:46 -0400 Subject: [PATCH] [CMake][AIX] Fixing AIX rpath Recent commit https://github.com/llvm/llvm-project/commit/8f833f88ab78265a8e0ebb0d1522771d67c708a9 modified the installation rpath and did not set `BUILD_WITH_INSTALL_RPATH` correctly on AIX, which led to installation failures on AIX. This patch sets `BUILD_WITH_INSTALL_RPATH` on AIX to fix the installation failures. Reviewed By: buttaface, daltenty Differential Revision: https://reviews.llvm.org/D148866 --- llvm/cmake/modules/AddLLVM.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index d405632..5357e54 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -2336,8 +2336,7 @@ function(llvm_setup_rpath name) # Since BUILD_SHARED_LIBS is only recommended for use by developers, # hardcode the rpath to build/install lib dir first in this mode. # FIXME: update this when there is better solution. - set(_build_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" ${extra_libdir}) - set(_install_rpath "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}") + set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) elseif(UNIX) set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir}) set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}") @@ -2355,9 +2354,11 @@ function(llvm_setup_rpath name) endif() # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not - # building for macOS or Windows, as those two platforms seemingly require it. + # building for macOS or AIX, as those platforms seemingly require it. + # On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF + # on install at the moment, so BUILD_WITH_INSTALL_RPATH is required. if("${CMAKE_BUILD_RPATH}" STREQUAL "") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|Windows") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX") set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON) else() set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}") -- 2.7.4