Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,320
    • Issues 4,320
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 359
    • Merge Requests 359
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13818

Closed
Open
Opened Jun 12, 2017 by Douglas Wilson@duog

ANN pragmas can cause compilation to fail if .dyn_o unavailable

An annotation pragma is similar to template haskell in that type-checking it necessitates loading code into ghci. This means that if any package dependency does not have a ghci library available, or if the annotation payload's type is defined in a module that does not have a .dyn_o available, then type-checking will fail.

This problem manifests when compiling with -fno-code as .dyn_o files are not usually generated. -fno-code does enable object file generation for modules needed by template haskell(in --make mode), however this same approach cannot be easily extended to annotations because there is no annotations language extension.

Here is a reproduction of the missing dynamic library issue:

$ echo "module Bug where {-# ANN module \"just a string\" #-}" > Bug.hs
$ cabal sandbox init
$ cabal install transformers-compat --disable-shared
$ ghc -static -package db ./.cabal-sandbox/x86_64-linux-ghc-8.2.0.20170522-packages.conf.d  -package transformers-compat -c Bug.hs
<command line>: can't load .so/.DLL for: libHStransformers-compat-0.5.1.4-DQiwI4tzfvoKHf8rERr8Q2.so (libHStransformers-compat-0.5.1.4-DQiwI4tzfvoKHf8rERr8Q2.so: cannot open shared object file: No such file or directory)
$ cabal install transformers-compat --enable-shared --reinstall
$ ghc -static -package db ./.cabal-sandbox/x86_64-linux-ghc-8.2.0.20170522-packages.conf.d  -package transformers-compat -c Bug.hs -fforce-recomp

Note that this fails even though no module of the dependency is imported. This is especially vexing since, to my knowledge, most annotations in libraries are simple strings for HLint, which could easily be typechecked if ghci didn't try to load libraries it didn't need..

I suggest the following fixes:

  • Do not fail typechecking if an annotation fails in ghci, instead issue a warning. Possibly suppress this warning by default in -fno-code
  • Load libraries in ghci more lazily, or don't bail out in ghci until a missing library is needed,.
Edited Mar 10, 2019 by Douglas Wilson
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#13818