Skip to content

Commit e32cbe9

Browse files
Qiongsi Wutstellar
authored andcommitted
[CMake][AIX] Fixing AIX rpath
Recent commit 8f833f8 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 (cherry picked from commit 887828d)
1 parent b98da4c commit e32cbe9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,8 +2318,7 @@ function(llvm_setup_rpath name)
23182318
# Since BUILD_SHARED_LIBS is only recommended for use by developers,
23192319
# hardcode the rpath to build/install lib dir first in this mode.
23202320
# FIXME: update this when there is better solution.
2321-
set(_build_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" ${extra_libdir})
2322-
set(_install_rpath "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
2321+
set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
23232322
elseif(UNIX)
23242323
set(_build_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
23252324
set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")
@@ -2337,9 +2336,11 @@ function(llvm_setup_rpath name)
23372336
endif()
23382337

23392338
# Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set and not
2340-
# building for macOS or Windows, as those two platforms seemingly require it.
2339+
# building for macOS or AIX, as those platforms seemingly require it.
2340+
# On AIX, the tool chain doesn't support modifying rpaths/libpaths for XCOFF
2341+
# on install at the moment, so BUILD_WITH_INSTALL_RPATH is required.
23412342
if("${CMAKE_BUILD_RPATH}" STREQUAL "")
2342-
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|Windows")
2343+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin|AIX")
23432344
set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
23442345
else()
23452346
set_property(TARGET ${name} APPEND PROPERTY BUILD_RPATH "${_build_rpath}")

0 commit comments

Comments
 (0)