text icon indicating copy to clipboard operation
text copied to clipboard

haddock crashes with SIGILL when building under DragonFly BSD

Open tuxillo opened this issue 10 months ago • 7 comments

While building ghc-9.4.6 under DragonFly BSD we got a strange haddock crash:

/----------------------------------------------------------\
| Successfully built program 'ghc-bin' (Stage1).           |
| Executable: _build/stage1/bin/ghc                        |
| Program synopsis: The Glorious Glasgow Haskell Compiler. |
\----------------------------------------------------------/
| Create directory _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly
| Create directory _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin
| Create directory _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/lib
| Copy file: _build/stage1/bin/ghc => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-9.4.5
| Copy file: _build/stage1/bin/ghc-pkg => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-pkg-9.4.5
| Copy file: _build/stage1/bin/hp2ps => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/hp2ps-ghc-9.4.5
| Copy file: _build/stage1/bin/hsc2hs => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/hsc2hs-ghc-9.4.5
| Copy file: _build/stage1/lib/bin/unlit => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/unlit-ghc-9.4.5
| Copy file: _build/stage1/bin/haddock => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/haddock-ghc-9.4.5
| Copy file: _build/stage1/bin/hpc => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/hpc-ghc-9.4.5
| Copy file: _build/stage1/lib/bin/ghc-iserv-dyn => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-iserv-dyn-ghc-9.4.5
| Copy file: _build/stage1/bin/runghc => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/runghc-9.4.5
| Copy file: _build/stage1/lib/bin/ghc-iserv => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-iserv-ghc-9.4.5
| Copy file: _build/stage1/lib/bin/ghc-iserv-prof => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-iserv-prof-ghc-9.4.5
| Copy file: _build/stage1/lib/bin/ghc-iserv-dyn => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/bin/ghc-iserv-dyn-ghc-9.4.5
| Copy directory: _build/stage1/lib => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly
| Copy directory: _build/stage1/lib/x86_64-dragonfly-ghc-9.4.5/rts-1.0.2/include => _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly
# ghc-pkg (for binary-dist-dir)
| Remove file _build/bindist/ghc-9.4.5-x86_64-portbld-dragonfly/lib/settings
| Run Sphinx ManMode: docs/users_guide => /tmp/extra-dir-6060607777810
| Run Sphinx LatexMode: utils/haddock/doc => /tmp/extra-dir-6060607777808
| Run Sphinx HtmlMode: utils/haddock/doc => _build/doc/html/Haddock
| Create directory _build/stage1/haddock-timing-files
| Run Haddock BuildPackage: libraries/ghc-prim/GHC/CString.hs (and 12 more) => _build/doc/html/libraries/ghc-prim-0.9.0/ghc-prim.haddock
| Run Sphinx LatexMode: docs/users_guide => /tmp/extra-dir-6060607777809
| Run Sphinx HtmlMode: docs/users_guide => _build/doc/html/users_guide
Command line: _build/stage1/bin/haddock --verbosity=0 -B_build/stage1/lib --lib=_build/stage1/lib --odir=_build/doc/html/libraries/ghc-prim-0.9.0 --dump-interface=_build/doc/html/libraries/ghc-prim-0.9.0/ghc-prim.haddock --html --hyperlinked-source --hoogle --quickjump '--title=ghc-prim-0.9.0: GHC primitives' --prologue=_build/doc/html/libraries/ghc-prim-0.9.0/haddock-prologue.txt --optghc=-D__HADDOCK_VERSION__=2270 --optghc=-hisuf --optghc=dyn_hi --optghc=-osuf --optghc=dyn_o --optghc=-hcsuf --optghc=dyn_hc --optghc=-fPIC --optghc=-dynamic --optghc=-hide-all-packages --optghc=-no-user-package-db '--optghc=-package-env -' '--optghc=-this-unit-id ghc-prim-0.9.0' '--optghc=-package-id rts-1.0.2' --optghc=-i --optghc=-i/construction/lang/ghc/ghc-9.4.5/_build/stage1/libraries/ghc-prim/build --optghc=-i/construction/lang/ghc/ghc-9.4.5/_build/stage1/libraries/ghc-prim/build/autogen --optghc=-i/construction/lang/ghc/ghc-9.4.5/libraries/ghc-prim --optghc=-Irts/include --optghc=-I_build/stage1/libraries/ghc-prim/build --optghc=-I/usr/local/include --optghc=-I/construction/lang/ghc/ghc-9.4.5/_build/stage1/lib/x86_64-dragonfly-ghc-9.4.5/rts-1.0.2/include --optghc=-optP-include --optghc=-optP_build/stage1/libraries/ghc-prim/build/autogen/cabal_macros.h --optghc=-outputdir --optghc=_build/stage1/libraries/ghc-prim/build --optghc=-this-unit-id --optghc=ghc-prim --optghc=-XHaskell2010 --optghc=-no-global-package-db --optghc=-package-db=/construction/lang/ghc/ghc-9.4.5/_build/stage1/lib/package.conf.d --optghc=-ghcversion-file=rts/include/ghcversion.h --optghc=-ghcversion-file=rts/include/ghcversion.h --optghc=-Wno-deprecated-flags --optghc=-Wno-trustworthy-safe libraries/ghc-prim/GHC/CString.hs libraries/ghc-prim/GHC/Classes.hs libraries/ghc-prim/GHC/Debug.hs libraries/ghc-prim/GHC/Magic.hs libraries/ghc-prim/GHC/Magic/Dict.hs libraries/ghc-prim/GHC/Prim/Exception.hs libraries/ghc-prim/GHC/Prim/Ext.hs libraries/ghc-prim/GHC/Prim/Panic.hs libraries/ghc-prim/GHC/Prim/PtrEq.hs _build/stage1/libraries/ghc-prim/build/GHC/PrimopWrappers.hs libraries/ghc-prim/GHC/Tuple.hs libraries/ghc-prim/GHC/Types.hs _build/stage1/libraries/ghc-prim/build/GHC/Prim.hs +RTS -t_build/stage1/haddock-timing-files/ghc-prim.t --machine-readable -RTS
===> Command failed with error code: -4
Command failed
Build failed.

After some investigation, it seems the issue is that DragonFly BSD does not support AVX512. So changing the ifdef here:

https://github.com/haskell/text/blob/master/cbits/measure_off.c#L214

To avoid going through the avx512 path solved the issue and the build finished ok.

I am not sure whether other OSes will be affected by this issue but it seems the declaration of COMPILER_SUPPORTS_AVX512 alone might not be enough?

tuxillo avatar Sep 10 '23 20:09 tuxillo