Skip to content

Dynamic GHC #257

@berberman

Description

@berberman

This is an archlinux related issue, since the entire haskell ecosystem distributed to archlinux is in dynamic linking. Currently, tests of hie-bios, ghcide, HLS , or maybe new projects depending hie-bios will fail immediately in archlinux, because ghc sessions created by hie-bios are not in dynamic for some cases. Personally, I use three kinds of cradle: stack, cabal, and directly ghc on standalone .hs file. For stack, the environment is isolated if we don't tell stack to use system ghc, so it works well; and for cabal, we can add:

program-default-options
  ghc-options:
    -dynamic

in ~/.caban/config, to let cabal call ghc in dynamic globally; and for directly ghc, I think there is no way except passing dynflags in hie.yaml.

Haskell developers using archlinux can write hie.yaml, or use project-local cabal file to make sure that hie-bios works as expect and thier projects work fine, despite it would be tedious to write hie.yaml everywhere. However, for tests I mentioned at first, providing hie.yaml files for every test case is less reasonable, and even in distribution packaging, this is a disaster. Similar issue occurred in doctest, our workaround is to patch source code, @felixonmars :

https://github.com/archlinux/svntogit-community/blob/39a3b66baee8c233ca227a5d969b41cac112630b/trunk/PKGBUILD#L21

to let doctest work with system ghc, not only in tests, but also in runtime. This is hacky, so my opnion is that hie-bios should give a flag to control whether passing -dynamic to cabal, or dynamicTooMkDynamicDynFlags directly to ghc. Alternatively, without a flag, hie-bios just need to guarantee that if it was compiled dynamically, sessions created should be dynamic as well in default (for cabal and direct ghc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions