[llvm] 887828d - [CMake][AIX] Fixing AIX rpath

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 21 08:43:00 PDT 2023


Author: Qiongsi Wu
Date: 2023-04-21T11:41:27-04:00
New Revision: 887828d502b49a09e56551e370cc6c1555ae3ff4

URL: https://github.com/llvm/llvm-project/commit/887828d502b49a09e56551e370cc6c1555ae3ff4
DIFF: https://github.com/llvm/llvm-project/commit/887828d502b49a09e56551e370cc6c1555ae3ff4.diff

LOG: [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

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index d40563273a978..5357e543f09d4 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}")


        


More information about the llvm-commits mailing list