ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
384 stars 86 forks source link

CMake install step with DESTDIR does not work #1595

Closed lahwaacz closed 2 months ago

lahwaacz commented 2 months ago

Build procedure:

cmake -B build -S . -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D GINKGO_BUILD_EXAMPLES=OFF
cmake --build build/
DESTDIR=_dummy_install_prefix cmake --install build/

The last command results in this error:

-- Install configuration: "RelWithDebInfo"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_device.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_device.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_device.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_reference.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_reference.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_reference.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_hip.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_hip.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_hip.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_omp.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_omp.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_omp.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_cuda.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_cuda.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_cuda.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_dpcpp.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo_dpcpp.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo_dpcpp.so
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo.so.1.8.0
-- Set non-toolchain portion of runtime path of "_dummy_install_prefix/usr/local/lib/libginkgo.so.1.8.0" to "$ORIGIN"
-- Installing: _dummy_install_prefix/usr/local/lib/libginkgo.so
-- Installing: /usr/local/lib/pkgconfig/ginkgo_RelWithDebInfo.pc
CMake Error: Could not open file for write in copy operation /usr/local/lib/pkgconfig/ginkgo_RelWithDebInfo.pc.tmp
CMake Error: : System Error: No such file or directory
CMake Error at build/cmake/generate_pkg_RelWithDebInfo.cmake:28 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  build/cmake_install.cmake:101 (include)

Using DESTDIR is necessary for packaging.

MarcelKoch commented 2 months ago

While we are working on this, you could use

cmake --install build/ --prefix _dummy_install_prefix/usr/local
lahwaacz commented 2 months ago

@MarcelKoch DESTDIR and --prefix are not the same things. While I used _dummy_install_prefix in this minimal repro example, in practice I need to package the DESTDIR tree and later extract it at /, i.e. --prefix must be relative to DESTDIR.

MarcelKoch commented 2 months ago

I understand that they are not the same, but from the documentation you linked, you could just combine DESTDIR and the install prefix and put in into --prefix.

lahwaacz commented 2 months ago

--prefix does not work, it leaves the absolute path in files like lib/pkgconfig/ginkgo.pc so the install tree is not relocatable.

MarcelKoch commented 2 months ago

Hi @lahwaacz, I think this should be fixed with PR #1597. Can you maybe comment if it works for you?

lahwaacz commented 2 months ago

@MarcelKoch That seems to work, thanks!