Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for plugins #7685

Open
coot opened this issue Sep 25, 2021 · 0 comments
Open

Better support for plugins #7685

coot opened this issue Sep 25, 2021 · 0 comments

Comments

@coot
Copy link
Collaborator

coot commented Sep 25, 2021

To configure a plugin one has to use ghc-options. This can be specified per component, e.g. see this example . The drawback of this is that cabal is passing these options not only when it compiles modules belonging to the package but it also runs:

/home/coot/.ghcup/bin/ghc \
  -hide-all-packages \
  -c /tmp/128418-0.c \
  -o /tmp/128418-1.o -hide-all-packages \
  '-plugin-package-id=ghc-tags-plugin-0.3.0.0-942a314601ea96d34f4332b9073d43cbdc47a8c68d4c8460bbac48721b5448d4' \
  '-fplugin=Plugin.GhcTags' \
  '-fplugin-opt=Plugin.GhcTags:../tags' \
  -fno-ignore-asserts

This command fails with an expected error:

<command line>: cannot satisfy -plugin-package-id ghc-tags-plugin-0.3.0.0-942a314601ea96d34f4332b9073d43cbdc47a8c68d4c8460bbac48721b5448d4
    (use -v for more information)
/home/coot/.ghcup/bin/ghc returned ExitFailure 1

The workaround is to also pass -package-db option. This option is not required when cabal actually compiles a package, and seems a bit strange at first, but makes sense when starts to analyse where it comes from.

cabal-install should either curate the options that it passes to ghc when it compiles the temporary .c file, or better it should have a proper way to configure plugins. Ideally, it would be a package level configuration as well as a global option, which would allow to configure a plugin globally and allow to set plugin options per package, or allow to configure different plugins for different packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants