Skip to content

tf-random's documentation fails to build with GHC 9.2.1's haddock on aarch64-linux

Summary

haddock shipped with GHC 9.2.1 fails to build tf-random's documentation due to haddock: internal error: dist/doc/html/tf-random/haddock-prologue1387-0.txt: hGetContents: invalid argument (invalid byte sequence).

This seems to be due to some decoding problem that is architecture-specific as I've only have been able to reproduce it on aarch64-linux. Additionally, the issue doesn't seem to be limited to haddock, since also Cabal reports while building: Warning: tf-random.cabal:0:0: UTF8 encoding problem at byte offset 1083.

With this hint taken into account, it seems the Problem is decoding the “ł” in “Michał Pałka”.

Full build log
setupCompilerEnvironmentPhase
Build with /nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1.
unpacking sources
unpacking source archive /nix/store/1nr84gxykdayb34wqhyhzapplwj6hj2x-tf-random-0.5.tar.gz
source root is tf-random-0.5
setting SOURCE_DATE_EPOCH to timestamp 1397051832 of file tf-random-0.5/tf-random.cabal
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/setup-package.conf.d -j4 +RTS -A64M -RTS -threaded -rtsopts
[1 of 1] Compiling Main             ( Setup.hs, /build/Main.o )
Linking Setup ...
updateAutotoolsGnuConfigScriptsPhase
configuring
configureFlags: --verbose --prefix=/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/pdia0inbjhx12hhyfpvavkmdnizxxbny-tf-random-0.5-doc/share/doc/tf-random-0.5 --with-gcc=gcc --package-db=/build/package.conf.d --ghc-options=-j4 +RTS -A64M -RTS --disable-split-objs --disable-library-profiling --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --extra-lib-dirs=/nix/store/iz9f5fjbk906c9j8zvr83skisy8mlbx7-ncurses-6.2/lib --extra-lib-dirs=/nix/store/wz31pppvk0ij3ykyafkw4xhp631b2i9m-libffi-3.4.2/lib --extra-lib-dirs=/nix/store/xwflzk66nkh7s45cqbjfmrc62qqncz3c-gmp-6.2.1/lib
Using Parsec parser
Warning: tf-random.cabal:0:0: UTF8 encoding problem at byte offset 1083
Configuring tf-random-0.5...
Dependency base >=4.2 && <5: using base-4.16.0.0
Dependency primitive >=0.3: using primitive-0.7.2.0
Dependency random: using random-1.2.1
Dependency time: using time-1.11.1.1
Source component graph: component lib
Configured component graph:
    component tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9
        include base-4.16.0.0
        include primitive-0.7.2.0-26FrVImOeSRFMFxEAgiBFt
        include random-1.2.1-4qyYj6P88hEL41FyrmzJfp
        include time-1.11.1.1
Linked component graph:
    unit tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9
        include base-4.16.0.0
        include primitive-0.7.2.0-26FrVImOeSRFMFxEAgiBFt
        include random-1.2.1-4qyYj6P88hEL41FyrmzJfp
        include time-1.11.1.1
        System.Random.TF=tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9:System.Random.TF,System.Random.TF.Gen=tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9:System.Random.TF.Gen,System.Random.TF.Init=tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9:System.Random.TF.Init,System.Random.TF.Instances=tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9:System.Random.TF.Instances
Ready component graph:
    definite tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9
        depends base-4.16.0.0
        depends primitive-0.7.2.0-26FrVImOeSRFMFxEAgiBFt
        depends random-1.2.1-4qyYj6P88hEL41FyrmzJfp
        depends time-1.11.1.1
Using Cabal-3.6.0.0 compiled by ghc-9.2
Using compiler: ghc-9.2.1
Using install prefix:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5
Executables installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/bin
Libraries installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/lib/ghc-9.2.1/aarch64-linux-ghc-9.2.1/tf-random-0.5-KP9k5IPcUYpGRNnHT8fvB9
Dynamic Libraries installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/lib/ghc-9.2.1/aarch64-linux-ghc-9.2.1
Private executables installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/libexec/aarch64-linux-ghc-9.2.1/tf-random-0.5
Data files installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/share/aarch64-linux-ghc-9.2.1/tf-random-0.5
Documentation installed in:
/nix/store/pdia0inbjhx12hhyfpvavkmdnizxxbny-tf-random-0.5-doc/share/doc/tf-random-0.5
Configuration files installed in:
/nix/store/m4c39knb9yw2c49xph4fdmm1xcggpp96-tf-random-0.5/etc
No alex found
Using ar found on system at:
/nix/store/10avvfvwvzj4y0z6zxij2qnz5pgqprg5-binutils-2.35.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 9.3.0 given by user at:
/nix/store/1q1mif7h3lgxdaxg6j39hli5azikrfla-gcc-wrapper-9.3.0/bin/gcc
Using ghc version 9.2.1 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/ghc
Using ghc-pkg version 9.2.1 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.26.0 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/hpc
Using hsc2hs version 0.68.8 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/cknsx4nddzjdm0g7vg9d9vpc9lvslscq-hscolour-1.24.4/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/579l1jpqmwjfghmlh9mnj6ykx06q2g38-binutils-wrapper-2.35.1/bin/ld.gold
No pkg-config found
Using runghc version 9.2.1 found on system at:
/nix/store/z4wznwpkzr5swfzkmyi14nnj5rqhxzwn-ghc-9.2.1/bin/runghc
Using strip version 2.35 found on system at:
/nix/store/10avvfvwvzj4y0z6zxij2qnz5pgqprg5-binutils-2.35.1/bin/strip
Using tar found on system at:
/nix/store/zfcd6sdfsfddhf5ybkarj4q241bsymn1-gnutar-1.34/bin/tar
No uhc found
building
Preprocessing library for tf-random-0.5..
Building library for tf-random-0.5..
[1 of 4] Compiling System.Random.TF.Gen ( src/System/Random/TF/Gen.hs, dist/build/System/Random/TF/Gen.o, dist/build/System/Random/TF/Gen.dyn_o )
[2 of 4] Compiling System.Random.TF.Init ( src/System/Random/TF/Init.hs, dist/build/System/Random/TF/Init.o, dist/build/System/Random/TF/Init.dyn_o )

src/System/Random/TF/Init.hs:94:5: warning: [-Wdeprecations]
    In the use of `bitSize'
    (imported from Data.Bits, but defined in GHC.Bits):
    Deprecated: "Use 'bitSizeMaybe' or 'finiteBitSize' instead"
   |
94 |   | bitSize n > 64 = error "mkTFGen: case where size of Int > 64 not implemented"
   |     ^^^^^^^
[3 of 4] Compiling System.Random.TF ( src/System/Random/TF.hs, dist/build/System/Random/TF.o, dist/build/System/Random/TF.dyn_o )
[4 of 4] Compiling System.Random.TF.Instances ( src/System/Random/TF/Instances.hs, dist/build/System/Random/TF/Instances.o, dist/build/System/Random/TF/Instances.dyn_o )
running tests
Package has no test suites.
haddockPhase
Preprocessing library for tf-random-0.5..
Running Haddock on library for tf-random-0.5..
Warning: --source-* options are ignored when --hyperlinked-source is enabled.
 100% (  4 /  4) in 'System.Random.TF.Gen'
  83% (  5 /  6) in 'System.Random.TF.Init'
  Missing documentation for:
    Module header

src/System/Random/TF/Init.hs:94:5: warning: [-Wdeprecations]
    In the use of `bitSize'
    (imported from Data.Bits, but defined in GHC.Bits):
    Deprecated: "Use 'bitSizeMaybe' or 'finiteBitSize' instead"
   |
94 |   | bitSize n > 64 = error "mkTFGen: case where size of Int > 64 not implemented"
   |     ^^^^^^^
 100% (  7 /  7) in 'System.Random.TF'
  33% (  1 /  3) in 'System.Random.TF.Instances'
  Missing documentation for:
    Random (src/System/Random/TF/Instances.hs:37)
    randomEnum (src/System/Random/TF/Instances.hs:205)
haddock: internal error: dist/doc/html/tf-random/haddock-prologue1387-0.txt: hGetContents: invalid argument (invalid byte sequence)
builder for '/nix/store/jcfgav90wdc628xmnwy468dn5p57nj57-tf-random-0.5.drv' failed with exit code 1

Steps to reproduce

Since this did not happen with GHC 9.2.1's release candidate, I've not investigated if this may have been caused by nixpkgs' build environment. To reproduce:

  • Checkout nixpkgs at a50888dc73b88ab344853c806ab63a3674728fc6
  • Run nix-build -A haskell.packages.ghc921.tf-random on aarch64-linux

Expected behavior

Build tf-random successfully including its documentation and display no warnings about incorrect enconding.

Environment

  • GHC version used: 9.2.1

Optional:

  • Operating System: NixOS
  • System Architecture: aarch64-linux
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information