Open dbaston opened 1 month ago
When running
cmake --install
, the libraries that do not have the RUNPATH set are installed underGDAL_PYTHON_INSTALL_PREFIX
That's on purpose. CMake default behaviour is to have artifacts in the build directory to have the RPATH set, for convenience of developers. But this is seen as undesirable when installing artifacts, hence CMake removes the rpath on installation. We replicate that behavior for the Python bindings.
I'm talking not about the default behavior, but the behavior when CMAKE_INSTALL_RPATH
is set. This sets RUNPATH
for the installed executables but not the installed Python bindings. #6371 makes a fix for the issue when setuptools does the install, but the issue remains with cmake --install
.
oh, I see. Your issue might actually be that comment of https://github.com/OSGeo/gdal/pull/6382/files#diff-551e48cf6490157c9880dfacac6e870873440f0de93dc9fb85c65a5994cb6f60R215 (Python bindings building is really dark magic. swig/python/CMakeLists.txt is certainly the most challenging CMake scripts of the whole GDAL tree)
I think the problem may be that the python .so
files are installed via the SCRIPT
form of install()
, rather than the TARGET
form. cmake never knows it's installing them, so it can't apply CMAKE_INSTALL_RPATH
.
What is the bug?
I am trying to build and install the GDAL Python bindings on a Linux system where I have neither write access to system directories nor the ability to set
LD_LIBRARY_PATH
. I have created a Python virtual environment and am trying to build GDAL by settingCMAKE_INSTALL_PREFIX
,CMAKE_INSTALL_RPATH
, andGDAL_PYTHON_INSTALL_PREFIX
to point to this environment. When doing this, the build creates two copies of the Python shared libraries: one inswig/python/osgeo
that does not set the RUNPATH, and a second inswig/python/for_install/osgeo
that does set the RUNPATH. When runningcmake --install
, the libraries that do not have the RUNPATH set are installed underGDAL_PYTHON_INSTALL_PREFIX
.I am able to install the version with the RUNPATH set by copying
setup.py
intoswig/python/for_install
and then runningpython3 setup.py install
. However, I would have expected this to be done bycmake --install
. Am I misunderstanding something about how this should function?Related: #6273, #6371
Steps to reproduce the issue
Versions and provenance
master
Additional context
No response