Skip to content

haskell_cabal_binary: Link data dirs of Cabal library dependencies - #2504

Draft
illia-bobyr wants to merge 1 commit into
tweag:masterfrom
illia-bobyr:pr/cabal-binary-library-data-dirs
Draft

illia-bobyr wants to merge 1 commit into
tweag:masterfrom
illia-bobyr:pr/cabal-binary-library-data-dirs

Conversation

@illia-bobyr

Copy link
Copy Markdown
Contributor

A library's Paths_* module, generated by Cabal in relocatable mode, looks for the library's data files relative to the running executable. As every package is installed into its own _install directory, an executable from another package could not find them. For example, happy fails to find HappyTemplate.hs from happy-lib, which breaks any package that uses happy as a tool, such as ghc-lib-parser.

haskell_cabal_library now returns HaskellCabalDataInfo with the data directories of itself and its Cabal library dependencies. haskell_cabal_binary symlinks them into its own _install directory, where the Paths_* modules look for them. See
_link_library_data_dirs() for details.

Fixes #2274

Assisted-by: Claude

@illia-bobyr
illia-bobyr requested a review from avdv as a code owner November 22, 2026 12:01
@illia-bobyr
illia-bobyr marked this pull request as draft November 22, 2026 12:01
A library's `Paths_*` module, generated by Cabal in relocatable mode,
looks for the library's data files relative to the running executable.
As every package is installed into its own `_install` directory, an
executable from another package could not find them.  For example,
`happy` fails to find `HappyTemplate.hs` from `happy-lib`, which breaks
any package that uses `happy` as a tool, such as `ghc-lib-parser`.

`haskell_cabal_library` now returns `HaskellCabalDataInfo` with the data
directories of itself and its Cabal library dependencies.
`haskell_cabal_binary` symlinks them into its own `_install` directory,
where the `Paths_*` modules look for them.  See
`_link_library_data_dirs()` for details.

Fixes tweag#2274

Assisted-by: Claude
@illia-bobyr
illia-bobyr force-pushed the pr/cabal-binary-library-data-dirs branch from 166150d to 03b9377 Compare November 23, 2026 09:07

This branch has not been deployed

No deployments
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.

Cannot build happy 2.x from hackage

1 participant