haskell / haskell/cabal

`extra-bundled-libraries` shouldn't use `hsLibraries`

Open
#8,701 1 comment 1 reaction 0 assignees View on GitHub
attention: pr-welcome re: installed-package-info type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
In [GHC#22564](https://gitlab.haskell.org/ghc/ghc/-/issues/22564#note_468545) we noted that users of Cabal's `extra-bundled-libraries` field are saddled with the unfortunate requirement of naming their native libraries with a rather ad-hoc `libC` prefix (specified in the Cabal [reference documentation](https://cabal.readthedocs.io/en/stable/cabal-package.html#pkg-field-extra-bundled-libraries)).

This requirement is due to the strange implementation of `extra-bundled-libraries`: "bundled" libraries are added to the `hsLibraries` field of `InstalledPackageInfo`, leaving GHC's runtime linker with an ambiguity regarding whether the library is a Haskell object (in which case it may need a "way" suffix in its name) or native object. The required `libHS`/`libC` prefix exists merely to allow the linker to resolve this ambiguity.

IMHO it would be much better if `extra-bundled-libraries` were instead implemented in terms of a new `InstalledPackageInfo` field, eliminating the ambiguity by construction.

(this was originally filed as [GHC#22732](https://gitlab.haskell.org/ghc/ghc/-/issues/22732)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.