Skip to content

Second stack build fails, if *.hsig file is changed #6941

Description

@mpilgrem

See:

By reference to the integration test backpack-x-pkg-transitive:

The first stack build works, as expected, but if the Logger.hsig file is then changed to be:

signature Logger where

logMessage :: String -> String
logName :: String

the second stack build fails, with:

❯ stack build

Warning: Found Backpack signature file for Cabal entry Str, but that module is not listed in the
         component's signatures field:
         * Str.hsig

         If this file is meant to be a Backpack signature, add Str to the signatures field in
         the package description.

Warning: Backpack: no dependency exposes module Str needed to instantiate str-sig. Ensure the
         implementing package is listed in build-depends.
consumer-pkg-0.0.0: unregistering (missing dependencies: logger-sig)
logger-sig-0.0.0: unregistering (local file changes: src\Logger.hsig)
logger-sig-0.0.0: unregistering (local file changes: src\Logger.hsig)
str-sig-0.0.0: unregistering
str-sig-0.0.0: unregistering
logger-sig  > build (lib) with ghc-9.10.3
logger-sig  > Preprocessing library for logger-sig-0.0.0...
logger-sig  > Building library instantiated with
logger-sig  >   Logger = <Logger>
logger-sig  >   Str = <Str>
logger-sig  > for logger-sig-0.0.0...
logger-sig  > <command line>: cannot satisfy -package-id str-sig-0.0.0-HPF0111dNK1KIRtIq2ktMM[Str=<Str>]
logger-sig  >     (use -v for more information)
str-sig     > configure (lib)
str-sig     > Configuring str-sig-0.0.0...
str-sig     > Error: [Cabal-5000]
str-sig     > The following package dependencies were requested
str-sig     >     --dependency='str-sig=str-sig-0.0.0-HPF0111dNK1KIRtIq2ktMM'
str-sig     > however the given installed package instance does not exist.
str-sig     >

A third stack build then fails with (where the GHC error message makes sense):

> stack build

Warning: Backpack: no dependency exposes module Str needed to instantiate str-sig. Ensure the
         implementing package is listed in build-depends.
str-sig     > configure (lib)
str-sig     > Configuring str-sig-0.0.0...
str-sig     > build (lib) with ghc-9.10.3
str-sig     > Preprocessing library for str-sig-0.0.0...
str-sig     > Building library instantiated with Str = <Str>
str-sig     > for str-sig-0.0.0...
str-sig     > copy/register
str-sig     > Installing library in D:\Users\mike\Code\GitHub\commercialhaskell\stack\tests\integration\tests\backpack-x-pkg-transitive\files\.stack-work\install\6e44f233\lib\x86_64-windows-ghc-9.10.3-b42a\str-sig-0.0.0-HPF0111dNK1KIRtIq2ktMM
str-sig     > Registering library instantiated with Str = <Str>
str-sig     > for str-sig-0.0.0...

Warning: Found Backpack signature file for Cabal entry Str, but that module is not listed in the
         component's signatures field:
         * Str.hsig

         If this file is meant to be a Backpack signature, add Str to the signatures field in
         the package description.
logger-sig  > build (lib) with ghc-9.10.3
logger-sig  > Preprocessing library for logger-sig-0.0.0...
logger-sig  > Building library instantiated with
logger-sig  >   Logger = <Logger>
logger-sig  >   Str = <Str>
logger-sig  > for logger-sig-0.0.0...
str-sig     > configure (inst:941095d7: Str = impl-pkg)
str-sig     > Configuring str-sig-0.0.0...
logger-sig  > [1 of 4] Compiling Logger[sig] [Source file changed]
logger-sig  > [3 of 4] Compiling LogHelper
logger-sig  > [4 of 4] Instantiating str-sig-0.0.0-HPF0111dNK1KIRtIq2ktMM

Warning: Found Backpack signature file for Cabal entry Str, but that module is not listed in the
         component's signatures field:
         * Str.hsig

         If this file is meant to be a Backpack signature, add Str to the signatures field in
         the package description.
logger-sig  > copy/register
logger-sig  > Installing library in D:\Users\mike\Code\GitHub\commercialhaskell\stack\tests\integration\tests\backpack-x-pkg-transitive\files\.stack-work\install\6e44f233\lib\x86_64-windows-ghc-9.10.3-b42a\logger-sig-0.0.0-AppGdG7zxXQHPWXcWi5NBK
logger-sig  > Registering library instantiated with
logger-sig  >   Logger = <Logger>
logger-sig  >   Str = <Str>
logger-sig  > for logger-sig-0.0.0...
logger-sig  > configure (inst:02196650: Logger = impl-pkg, Str = impl-pkg)
logger-sig  > Configuring logger-sig-0.0.0...
str-sig     > build (inst:941095d7: Str = impl-pkg) with ghc-9.10.3
str-sig     > Preprocessing library for str-sig-0.0.0...
str-sig     > Building library instantiated with
str-sig     >   Str = impl-pkg-0.0.0-DylYxJcYzyOJu3Byf54CHg:Str
str-sig     > for str-sig-0.0.0...
str-sig     > [1 of 1] Compiling Str[sig] [Prelude package changed]
str-sig     > copy/register
logger-sig  > build (inst:02196650: Logger = impl-pkg, Str = impl-pkg) with ghc-9.10.3
str-sig     > Installing library in D:\Users\mike\Code\GitHub\commercialhaskell\stack\tests\integration\tests\backpack-x-pkg-transitive\files\.stack-work\install\6e44f233\lib\x86_64-windows-ghc-9.10.3-b42a\str-sig-0.0.0-HPF0111dNK1KIRtIq2ktMM+EKckw5G39D2FdCBwLgXJOE
logger-sig  > Preprocessing library for logger-sig-0.0.0...
logger-sig  > Building library instantiated with
logger-sig  >   Logger = impl-pkg-0.0.0-DylYxJcYzyOJu3Byf54CHg:Logger
logger-sig  >   Str = impl-pkg-0.0.0-DylYxJcYzyOJu3Byf54CHg:Str
logger-sig  > for logger-sig-0.0.0...
str-sig     > Registering library instantiated with
str-sig     >   Str = impl-pkg-0.0.0-DylYxJcYzyOJu3Byf54CHg:Str
str-sig     > for str-sig-0.0.0...
logger-sig  > [1 of 3] Compiling Logger[sig] [Source file changed]
logger-sig  > src\Logger.hsig:1:1: error: [GHC-93011]
logger-sig  >     • ‘logName’ is exported by the hsig file, but not exported by the implementing module ‘impl-pkg-0.0.0:Logger’
logger-sig  >     • While checking that ‘impl-pkg-0.0.0:Logger’ implements signature ‘Logger’ in ‘logger-sig-0.0.0[Logger=impl-pkg-0.0.0:Logger,Str=impl-pkg-0.0.0:Str]’.
logger-sig  >   |
logger-sig  > 1 | signature Logger where
logger-sig  >   | ^
logger-sig  >
logger-sig  > [2 of 3] Compiling Str[sig] [impl-pkg-0.0.0 removed]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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