Cabal: `cabal haddock` fails when using the new GHC `-Wmissing-home-modules` flag

Created on 10 May 2017  路  3Comments  路  Source: haskell/cabal

Running cabal install on bug.tgz.txt works but cabal haddock generates the following error:

$ cabal haddock
Running Haddock for Foo-0.1.0.0...
Preprocessing library Foo-0.1.0.0...

<no location info>: warning: [-Wmissing-home-modules]
    Modules are not listed in command line: Foo

<no location info>: error: 
Failing due to -Werror.

Tested with:

$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.2.0.20170507
$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
$ haddock --version
Haddock version 2.18.0, (c) Simon Marlow 2006
Ported to use the GHC API by David Waern 2006-2008
cmhaddock 23Skidoo bug

Most helpful comment

I have encountered this error in the presence of .hs-boot files:

  • bug.cabal:

```
name: bug
version: 0.1
cabal-version: >= 1.9.2
build-type: Simple

library
exposed-modules:
Bug.A,
Bug.B

  build-depends: base

```

  • Bug/A.hs:

    module Bug.A where
    
  • Bug/A.hs-boot:

    module Bug.A where
    
  • Bug/B.hs:

    module Bug.B where
    
    import {-# SOURCE #-} Bug.A
    
  • The result of running cabal haddock:

    Resolving dependencies...
    Configuring bug-0.1...
    Preprocessing library for bug-0.1..
    Running Haddock on library for bug-0.1..
    
    <no location info>: warning: [-Wmissing-home-modules]
      These modules are needed for compilation but not listed in your .cabal file's other-modules: Bug.A
    Haddock coverage:
     0% (  0 /  1) in 'Bug.A'
    Missing documentation for:
      Module header
     0% (  0 /  1) in 'Bug.B'
    Missing documentation for:
      Module header
    Documentation created: dist/doc/html/bug/index.html
    
  • Versions used:

    $ ghc --version
    The Glorious Glasgow Haskell Compilation System, version 8.2.1
    $ cabal --version
    cabal-install version 2.0.0.0
    compiled using version 2.0.0.2 of the Cabal library 
    $ haddock --version
    Haddock version 2.18.1, (c) Simon Marlow 2006
    Ported to use the GHC API by David Waern 2006-2008
    

All 3 comments

I can't repro with

ezyang@sabre:~/Downloads/bug$ ghc-8.2.1 --version
The Glorious Glasgow Haskell Compilation System, version 8.2.0.20170522

and I believe this was fixed upstream by

commit 72eade6d7cf47f0738a58f560085acc952248d2c
Author: Herbert Valerio Riedel <[email protected]>
Date:   Mon May 22 11:59:56 2017 -0400

    Handle file targets in missing home modules warning

    When main module is listed on command line as a file, we should not
    issue a warning about it. See Trac #13727

    Reviewers: austin, bgamari, Yuras

    Reviewed By: bgamari, Yuras

    Subscribers: 23Skidoo, rwbarton, thomie

    GHC Trac Issues: #13727

    Differential Revision: https://phabricator.haskell.org/D3598

    (cherry picked from commit dac49bdc79387ca9f91c7c5c9220699efb6239fb)

because we feed Haddock file paths.

I have encountered this error in the presence of .hs-boot files:

  • bug.cabal:

```
name: bug
version: 0.1
cabal-version: >= 1.9.2
build-type: Simple

library
exposed-modules:
Bug.A,
Bug.B

  build-depends: base

```

  • Bug/A.hs:

    module Bug.A where
    
  • Bug/A.hs-boot:

    module Bug.A where
    
  • Bug/B.hs:

    module Bug.B where
    
    import {-# SOURCE #-} Bug.A
    
  • The result of running cabal haddock:

    Resolving dependencies...
    Configuring bug-0.1...
    Preprocessing library for bug-0.1..
    Running Haddock on library for bug-0.1..
    
    <no location info>: warning: [-Wmissing-home-modules]
      These modules are needed for compilation but not listed in your .cabal file's other-modules: Bug.A
    Haddock coverage:
     0% (  0 /  1) in 'Bug.A'
    Missing documentation for:
      Module header
     0% (  0 /  1) in 'Bug.B'
    Missing documentation for:
      Module header
    Documentation created: dist/doc/html/bug/index.html
    
  • Versions used:

    $ ghc --version
    The Glorious Glasgow Haskell Compilation System, version 8.2.1
    $ cabal --version
    cabal-install version 2.0.0.0
    compiled using version 2.0.0.2 of the Cabal library 
    $ haddock --version
    Haddock version 2.18.1, (c) Simon Marlow 2006
    Ported to use the GHC API by David Waern 2006-2008
    

We can probably work around this by not invoking Haddock with -Wmissing-home-modules.

Was this page helpful?
0 / 5 - 0 ratings