Skip to content

Failure to find included cbits blake2/blake2.h #11992

Closed

Description

@philderbeast

Describe the bug
As of 05e1f5c, building crypton fails.

To Reproduce

Install cabal locally with:

$ cabal install cabal-install:exe:cabal --overwrite-policy=always

Grab the source for crypton and try to build it:

$ cabal build all --enable-tests --enable-benchmarks -j
Warning: this is a debug build of cabal-install with assertions enabled.
Build profile: -w ghc-9.8.4 -O1
In order, the following will be built (use -v for more details):
 - crypton-1.1.4 (lib) (first run)
 - crypton-1.1.4 (test:test-crypton) (first run)
 - crypton-1.1.4 (bench:bench-crypton) (first run)
Preprocessing library for crypton-1.1.4...
Building library for crypton-1.1.4...
In file included from cbits/argon2/core.c:43,

                 from cbits/argon2/argon2.c:23:0: error: 

cbits/argon2/opt.c:25:10: error:
     fatal error: blake2/blake2.h: No such file or directory
       25 | #include "blake2/blake2.h"
          |          ^~~~~~~~~~~~~~~~~
   |
25 | #include "blake2/blake2.h"
   |          ^
compilation terminated.
`gcc' failed in phase `C Compiler'. (Exit code: 1)
Error: [Cabal-7125]
Failed to build crypton-1.1.4 (which is required by test:test-crypton from crypton-1.1.4 and bench:bench-crypton from crypton-1.1.4).

Expected behavior

That cabal can build crypton as it was able to do prior to 05e1f5c, a package that includes the sources that cannot be found when compiling.

$ tree -P 'blake2.h' --prune
.
└── cbits
    └── blake2
        ├── ref
        │   └── blake2.h
        └── sse
            └── blake2.h

5 directories, 2 files

When this C header file can't be found, I first tried installing libb2, as Google's AI suggests but then found the header was included in the package so tried cabal-install-3.16.1.0 and that was able to build crypton.

To fix this error, you need to install the development files for libb2, which provides the BLAKE2 hashing function headers. The exact package manager command depends entirely on your operating system.Quick Fix by Operating SystemFind your operating system below and run the designated command in your terminal:Ubuntu / Debian / Mint

sudo apt-get update
sudo apt-get install libb2-dev

System information
Ubuntu 25.10

Activity

  1. philderbeast commented on Jun 20, 2026

    @philderbeast
    CollaboratorAuthor

    Here's my bisect to find the commit that introduced the problem:

    040a97d087475db5deae48c829e4834d5d36ab55 good
    98668b285ed221bb385f5205b9ffd922acf3642d good
    aef473372cf9412866c1cd98100663e520b195c5 good
    339c812c75ac0960ef06323ec1d4763891d1cd3f bad
    937b961b95bc308f0347c4ae5f5e490268cea60f bad
    05e1f5c20834188a9d1357566dcb0884d9360db4 bad
    b7d97c3977705df7c5f8dfbbbdc841149e42fcba good
    c5dc2b08a39afda8f7b01498925a9f64d7ede4fe good
    d7bf01245085ca88182ab9487e629872e73dec4f good
    3a31161dacd0bf7d47b00eb0068c1f633cff7ff4 good
    6989d21d865625193b1b2cb46f4c8d00c7348f2c good
    
  2. added
    regression on master
    and removed on Jun 20, 2026
  3. self-assigned this
    on Jun 20, 2026
  4. ffaf1 commented on Jun 20, 2026

    @ffaf1
    Collaborator

    I am silly, I stumbled into this but tohught it was a crypton issue kazu-yamamoto/crypton/issues/75
    Nice find. This is obviously a problem for the release @ulysses4ever

  5. ulysses4ever commented on Jun 20, 2026

    @ulysses4ever
    Collaborator

    Right...

    I thought there was a whole-Hackage check for that patch.

    @zlonast could you investigate?

  6. reopened this on Jun 20, 2026
  7. zlonast commented on Jun 21, 2026

    @zlonast
    Collaborator

    I reran the clc-stackage and can say that it works on 9.12.4

    I think we need to make a minimal example and understand why, by transmitting more information, we somehow lose it.

  8. zlonast commented on Jun 21, 2026

    @zlonast
    Collaborator

    I think the error only exists in 9.8.4 and older

  9. ulysses4ever commented on Jun 21, 2026

    @ulysses4ever
    Collaborator

    Do you mean 9.8.4 and older (9.12 is "later" and you say it works, so that's a contradiction somewhere)? These are still in our story window. Unless we can come up with a quick fix, we'll have to revert...

  10. zlonast commented on Jun 21, 2026

    @zlonast
    Collaborator

    I found a one-line solution.

    The downside is that I'll have to look again to see what was changed in older versions of ghc.

  11. zlonast commented on Jun 22, 2026

    @zlonast
    Collaborator
    1. GHC ignores -optP for non-Haskell files and since 9.10. (-optP is a cpp-options)
    2. Cabal didn't send this flag to source files before.
    3. crypton is bug hell. #include "blake2/blake2.h" is a pure bug, with libb2-dev it can be #include <blake2.h>
      or #include "blake2/ref/blake2.h" or #include "blake2/sse/blake2.h"
    4. crypton have in .cabal:
        if (((((arch(i386) || arch(x86_64)) || arch(loongarch64)) || arch(ppc64le)) || arch(riscv64)) || arch(alpha))
            cpp-options: -DARCH_IS_LITTLE_ENDIAN
    
        if arch(i386)
            cpp-options: -DARCH_X86
    
        if arch(x86_64)
            cpp-options: -DARCH_X86_64
    
        if ((flag(support_rdrand) && (arch(i386) || arch(x86_64))) && !os(windows))
            cpp-options:   -DSUPPORT_RDRAND
            c-sources:     cbits/crypton_rdrand.c
            other-modules: Crypto.Random.Entropy.RDRand
    
        if (arch(x86_64) || flag(support_sse))
            cpp-options: -DSUPPORT_SSE
    
            if arch(i386)
                cc-options: -msse2
    

    but I really suspect that they want:

        if (((((arch(i386) || arch(x86_64)) || arch(loongarch64)) || arch(ppc64le)) || arch(riscv64)) || arch(alpha))
            cpp-options: -DARCH_IS_LITTLE_ENDIAN
            cc-options: -DARCH_IS_LITTLE_ENDIAN
    
        if arch(i386)
            cpp-options: -DARCH_X86
            cc-options: -DARCH_X86
    
        if arch(x86_64)
            cpp-options: -DARCH_X86_64
            cc-options: -DARCH_X86_64
    
        if ((flag(support_rdrand) && (arch(i386) || arch(x86_64))) && !os(windows))
            cpp-options:   -DSUPPORT_RDRAND
            cc-options: -DSUPPORT_RDRAND
            c-sources:     cbits/crypton_rdrand.c
            other-modules: Crypto.Random.Entropy.RDRand
    
        if (arch(x86_64) || flag(support_sse))
            cpp-options: -DSUPPORT_SSE
            cc-options: -DSUPPORT_SSE
    
            if arch(i386)
                cc-options: -msse2
    
  12. added this to the Considered for 3.18 milestone on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

re: ghc 9.10regression on mastertype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions