scalapack
scalapack copied to clipboard
Instaled library maintains RUNPATH
I am building the ScaLAPACK library using the provided CMake script. After installation, the installed library DSO maintains the RUNPATH
present in the output of the build process. However, the default behavior of CMake is to remove the RUNPATH
during the installation of the library according to the community wiki. I couldn't find in the CMake files any obvious command setting the RUNPATH
of the installed binary (e.g. CMAKE_INSTALL_RPATH_USE_LINK_PATH
). Is this behavior a bug, or a deliberate design choice?
As a work around, the build can be configured with
-D CMAKE_INSTALL_REMOVE_ENVIRONMENT_RPATH:BOOL=true
and the installed library binary will have no RUNPATH
entry. However, it would be nice to know the cause of the issue.
To reproduce the issue, configure the commit 7e4e07070a489686287c36ab473d21cf29a54bdd
with settings from the CMakeUserPresets.json
file (cmake -S . --preset default-config
):
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "default-config",
"binaryDir": "${sourceDir}/build/Release",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_Fortran_FLAGS": "-fallow-argument-mismatch",
"BUILD_SHARED_LIBS": true,
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_PREFIX_PATH" : "$env{HOME}/opt/openblas",
"CMAKE_INSTALL_PREFIX": "$env{HOME}/opt/scalapack"
}
}
],
"buildPresets": [
{
"name": "default-build",
"configurePreset": "default-config"
}
]
}
The OpenBLAS library is used, and the path to the installation directory with OpenBLAS is contained in the CMAKE_PREFIX_PATH
entry of the settings files. The output of the build command contains in the RUNPATH entry the paths for the MPI and OpenBLAS libraries. After installation, the paths to the OpenBLAS library is removed but not the path to the MPI library.
- Before installation:
$ readelf -d <path to build output> | grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [/opt/apps/resif/aion/2020b/epyc/software/UCX/1.9.0-GCCcore-10.2.0/lib64:/usr/lib64:/opt/apps/resif/aion/2020b/epyc/software/OpenMPI/4.0.5-GCC-10.2.0/lib:/home/users/gkafanas/opt/openblas/lib64:]
- After installation:
$ readelf -d <path to installed output> | grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [/opt/apps/resif/aion/2020b/epyc/software/UCX/1.9.0-GCCcore-10.2.0/lib64:/usr/lib64:/opt/apps/resif/aion/2020b/epyc/software/OpenMPI/4.0.5-GCC-10.2.0/lib]
I would expect the installed ScaLAPACK DSO to have no RUNPATH
entry.
I would understand it if it was a design choice to maintain the RUNPATH. However, none of the CMake variables required to install the DSO with the RUNPATH is set, so there may be some unintended side effect.