Skip to content

Add relative RUNPATH entries in haskell_cabal_* targets#1267

Merged
mergify[bot] merged 5 commits intomasterfrom
cabal-runpath
Mar 6, 2020
Merged

Add relative RUNPATH entries in haskell_cabal_* targets#1267
mergify[bot] merged 5 commits intomasterfrom
cabal-runpath

Conversation

@aherrmann
Copy link
Copy Markdown
Contributor

haskell_cabal_binary|library targets that depended on Bazel managed dynamic C libraries (e.g. the nixpkgs provided libz for @stackage//:zlib) were missing relative RUNPATH entries. Instead, Cabal only generated absolute RUNPATH entries pointing to the sandbox's execroot, which are invalid outside that sandbox, see #1130. This can cause build failures with Cabal packages that depend transitively on dynamic C libraries, e.g. hie-bios failed to build in #1262.

This PR adds relative RUNPATH entries in the same fashion as is done for regular Haskell targets.

This PR also adds a regression test that checks for the presence of a relative RUNPATH entry.

@aherrmann aherrmann force-pushed the cabal-runpath branch 2 times, most recently from 134cd1e to 68c3cc4 Compare March 5, 2020 16:57
Copy link
Copy Markdown
Contributor

@Profpatsch Profpatsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello darkness, my old friend

Comment thread haskell/cabal.bzl Outdated
Comment thread haskell/cabal.bzl Outdated
Comment thread tests/stackage_zlib_runpath/BUILD.bazel Outdated
py_inline_test(
name = "stackage_zlib_runpath",
args = [
"$(rootpath :libz_soname)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are solib_names exported as targets?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an output attribute that means that it becomes accessible as a label.

Comment thread tests/stackage_zlib_runpath/dynamic_libraries.bzl
By default Cabal generates `RUNPATH` entries pointing to the sandbox
directory. These no longer work outside of that particular sandbox.
Adds a regression test to check that haskell_cabal_library will generate
a relative `RUNPATH` entry for the nixpkgs provided zlib.
@aherrmann aherrmann added the merge-queue merge on green CI label Mar 6, 2020
@mergify mergify bot merged commit b9db31a into master Mar 6, 2020
@mergify mergify bot deleted the cabal-runpath branch March 6, 2020 09:59
@mergify mergify bot removed the merge-queue merge on green CI label Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants