Skip to content

Conversation

@mpickering
Copy link
Collaborator

The new Cabal and cabal-install option tells GHC to build a bytecode library.

  • When GHC is invoked, bytecode objects are also produced.
  • A bytecode library is created during linking.
  • The bytecode library is installed when the package is installed.
  • The bytecode-library-dirs field can be populated to instruct GHC where to find the bytecode library for a package. (This can be useful if the bytecode libraries are distributed separately from the other libraries).

The bytecode object files are produced alongside an existing build way. They are prioritised in this order (-dyn-too, -dynamic, -static).

Bytecode libraries can't be produced standalone at the moment. You have to produce them alongside an existing build way. This is due to limitations in GHC.

At the moment, there is not support implemented for creating profiled bytecode libraries.

Implements haskell/cabal-proposals#2

Fixes #11188


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

StandaloneBytecodeNotSupportedYet ->
unlines $
[ "The ecosystem doesn't support building packages with just bytecode libraries yet."
, "If you have run into this error, please comment on issue #<TODO>"
Copy link
Collaborator

Choose a reason for hiding this comment

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

just a reminder: stub here

Copy link
Collaborator

@geekosaur geekosaur left a comment

Choose a reason for hiding this comment

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

I notice that no test actually exercises the new cabal file entries as yet (which I presume exist in addition to the options, since the cabal file rev was bumped to 3.17).

@mpickering mpickering force-pushed the wip/cabal-bytecode-library branch 4 times, most recently from 87f58a9 to 6545b0a Compare January 5, 2026 15:21
The new `Cabal` and `cabal-install` option tells GHC to build a
bytecode library.

* When GHC is invoked, bytecode objects are also produced.
* A bytecode library is created during linking.
* The bytecode library is installed when the package is installed.
* The `bytecode-library-dirs` field can be populated to instruct GHC
  where to find the bytecode library for a package. (This can be useful
  if the bytecode libraries are distributed separately from the other
  libraries).

The bytecode object files are produced alongside an existing build way.
They are prioritised in this order (`-dyn-too`, `-dynamic`, `-static`).

Bytecode libraries can't be produced standalone at the moment. You have
to produce them alongside an existing build way. This is due to
limitations in GHC.

At the moment, there is not support implemented for creating profiled
bytecode libraries.

Implements haskell/cabal-proposals#2

Fixes haskell#11188
@mpickering mpickering force-pushed the wip/cabal-bytecode-library branch from 6545b0a to 01c50b5 Compare January 5, 2026 15:43
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.

Add support for producing byte code objects and libraries

2 participants