Skip to content

C-only cabal libraries fail to build with haddock = True #2200

@avdv

Description

@avdv

Describe the bug

There are a few libraries that depend on internal C libraries packaged in another cabal package (depending on the OS / flags passed to cabal).

For instance, when using a recent stack snapshot that includes zlib 0.7.1.0, this version depends on the internal zlib-clib library either if explicitly requested using the bundled-c-zlib flag, or when disabling the pkg-config flag and the platform is Windows.

See haskell/zlib#70

To Reproduce

stack_snapshot(
    name = "stackage",
    extra_deps = {"zlib": ["@zlib.dev//:zlib"]},
    packages = ["zlib"],

    # disable calling pkg-config
    flags = {"zlib": ["-pkg-config"]},

    snapshot = "nightly-2024-05-24",
)

Trying to build @stackage//:zlib results in:

ERROR: C:/users/runneradmin/_bazel_runneradmin/z5des2pa/external/stackage/BUILD.bazel:29:22: output 'external/stackage/zlib-clib-1.3.1/_install/zlib-clib-1.3.1_haddock/zlib-clib.haddock' was not created
ERROR: C:/users/runneradmin/_bazel_runneradmin/z5des2pa/external/stackage/BUILD.bazel:29:22: HaskellCabalLibrary @stackage//:zlib-clib failed: not all outputs were created or valid

The reason for this error is that the zlib-clib library is a C only library which does not produce any haddock.

Expected behavior

Environment

  • OS name + version: Windows
  • Bazel version: 6.5.0
  • Version of the rules: 1cd404c

Additional context

The only possible workaround is to disable haddock generation altogether:

stack_snapshot(
   name = "stackage",
   ...
   haddock = False,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions