Skip to content

Way --enable-library-bytecode is not honoured by repl #11981

Description

@fendor

Describe the bug

On cabal HEAD (4f927a1), the way modifier --enable-library-bytecode has no impact when run with repl

To Reproduce

$ cabal init --lib -n --no-comments
$ cabal repl -w ghc-10.1 --enable-library-bytecode
Warning: Parsing the index cache failed (Data.Binary.Get.runGet at position
Build profile: -w ghc-10.1.20260530 -O1
In order, the following will be built (use -v for more details):
 - bytecode-repo-0.1.0.0 (interactive) (lib) (first run)
Configuring library for bytecode-repo-0.1.0.0...
Preprocessing library for bytecode-repo-0.1.0.0...
GHCi, version 10.1.20260530: https://www.haskell.org/ghc/  :? for help
Using language edition: Haskell2010
[1 of 1] Compiling MyLib            ( src/MyLib.hs, interpreted )[bytecode-repo-0.1.0.0-inplace]
Ok, one module loaded.
ghci> :q
Leaving GHCi.

Calling it twice in a row doesn't work either.

To produce the .gbc files, you first need to build the project:

$ cabal build -w ghc-10.1 --enable-library-bytecode
Build profile: -w ghc-10.1.20260530 -O1
In order, the following will be built (use -v for more details):
 - bytecode-repo-0.1.0.0 (lib) (configuration changed)
Configuring library for bytecode-repo-0.1.0.0...
Preprocessing library for bytecode-repo-0.1.0.0...
Building library for bytecode-repo-0.1.0.0...
[1 of 1] Compiling MyLib            ( src/MyLib.hs, dist-newstyle/build/x86_64-linux/ghc-10.1.20260530/bytecode-repo-0.1.0.0/build/MyLib.o, dist-newstyle/build/x86_64-linux/ghc-10.1.20260530/bytecode-repo-0.1.0.0/build/MyLib.dyn_o, dist-newstyle/build/x86_64-linux/ghc-10.1.20260530/bytecode-repo-0.1.0.0/build/MyLib.gbc )

Expected behavior

Calling cabal repl --enable-library-bytecode should, in my opinion, generate .gbc files. Calling cabal repl --enable-library-bytecode twice in a row, the second call should be much faster.

System information

  • Operating system
  • cabal, ghc versions

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions