Skip to content

cmake: remove custom CMAKE_INSTALL_RPATH#46685

Merged
haampie merged 2 commits intodevelopfrom
hs/fix/cmake-rpath-lost-commits
Oct 14, 2024
Merged

cmake: remove custom CMAKE_INSTALL_RPATH#46685
haampie merged 2 commits intodevelopfrom
hs/fix/cmake-rpath-lost-commits

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Oct 1, 2024

The CMake builder in Spack actually adds incorrect rpaths. They are
unfiltered and incorrectly ordered compared to what the compiler wrapper
adds.

There is no need to specify paths to dependencies in CMAKE_INSTALL_RPATH
because of two reasons:

  1. CMake preserves "toolchain" rpaths, which includes the rpaths injected
    by our compiler wrapper.
  2. We use CMAKE_INSTALL_RPATH_USE_LINK_PATH=ON, so libraries we link
    to are rpath'ed automatically.

However, CMake does not create install rpaths to directories in the package's
own install prefix, so we set CMAKE_INSTALL_RPATH to the educated guess
<prefix>/{lib,lib64}, but omit dependencies.


This bit got lost after rebase of #44686 😢

Also breaks yet another circular dependency (cmake <-> build_environment)

@spackbot-app spackbot-app bot requested review from alalazo and johnwparent October 1, 2024 10:05
@spackbot-app spackbot-app bot added tests General test capability(ies) utilities labels Oct 1, 2024
@haampie haampie force-pushed the hs/fix/cmake-rpath-lost-commits branch 3 times, most recently from a5c26a1 to c725ba2 Compare October 1, 2024 10:53
@bernhardkaindl

This comment was marked as outdated.

@haampie haampie closed this Oct 3, 2024
@haampie haampie reopened this Oct 3, 2024
@spack spack deleted a comment from spackbot-app bot Oct 5, 2024
@spack spack deleted a comment from spackbot-app bot Oct 5, 2024
@spack spack deleted a comment from spackbot-app bot Oct 5, 2024
@spack spack deleted a comment from spackbot-app bot Oct 5, 2024
The CMake builder in Spack actually adds incorrect rpaths. They are
unfiltered and incorrectly ordered compared to what the compiler wrapper
adds.

There is no need to paths to dependencies in `CMAKE_INSTALL_RPATH`
because of two reasons:

1. CMake preserves "toolchain" rpaths, which are rpaths injected
   automatically, and the compiler wrapper is from CMake's perspective
   part of the toolchain.
2. We use `CMAKE_INSTALL_RPATH_USE_LINK_PATH=ON`, so libraries we link
   to are rpath'ed automatically.

CMake does not create install rpaths to new directories in
CMAKE_INSTALL_PREFIX, so we continue to set our educated guess of
install rpaths `<prefix>/{lib,lib64}`.
and break circular deps between cmake & build_environment
@haampie haampie force-pushed the hs/fix/cmake-rpath-lost-commits branch from 1476cae to d3c1061 Compare October 12, 2024 06:26
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Oct 14, 2024

@bernhardkaindl it looks like you're pushing unrelated changes to this branch?

@haampie haampie force-pushed the hs/fix/cmake-rpath-lost-commits branch from 1238525 to d3c1061 Compare October 14, 2024 05:38
@alalazo alalazo self-assigned this Oct 14, 2024
@alalazo alalazo enabled auto-merge (squash) October 14, 2024 08:53
@haampie haampie disabled auto-merge October 14, 2024 10:35
@haampie haampie merged commit 8b3d3ac into develop Oct 14, 2024
@haampie haampie deleted the hs/fix/cmake-rpath-lost-commits branch October 14, 2024 10:35
arezaii pushed a commit to arezaii/spack that referenced this pull request Oct 22, 2024
The CMake builder in Spack actually adds incorrect rpaths. They are
unfiltered and incorrectly ordered compared to what the compiler wrapper
adds.

There is no need to specify paths to dependencies in `CMAKE_INSTALL_RPATH`
because of two reasons:

1. CMake preserves "toolchain" rpaths, which includes the rpaths injected
   by our compiler wrapper.
2. We use `CMAKE_INSTALL_RPATH_USE_LINK_PATH=ON`, so libraries we link
   to are rpath'ed automatically.

However, CMake does not create install rpaths to directories in the package's
own install prefix, so we set `CMAKE_INSTALL_RPATH` to the educated guess
`<prefix>/{lib,lib64}`, but omit dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-environment build-systems core PR affects Spack core functionality tests General test capability(ies) update-package utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants