Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haddock crashes with SIGILL when building under DragonFly BSD #538

Open
tuxillo opened this issue Sep 10, 2023 · 7 comments
Open

haddock crashes with SIGILL when building under DragonFly BSD #538

tuxillo opened this issue Sep 10, 2023 · 7 comments

Comments

@tuxillo
Copy link

tuxillo commented Sep 10, 2023

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?

@Bodigrim
Copy link
Contributor

As witnessed by CI, other BSD systems (FreeBSD, OpenBSD, NetBSD) do not seem to have this issue. Do you know what makes DragonFly BSD peculiar in this aspect? Is it possible to add a CI job?

@tuxillo
Copy link
Author

tuxillo commented Sep 10, 2023

We just don't support AVX512. It's still to be implemented.

@Bodigrim
Copy link
Contributor

PR is welcome, ideally accompanied by a CI job for DragonFly BSD, otherwise it can easily regress back in future.

@tuxillo
Copy link
Author

tuxillo commented Sep 10, 2023

Sure, I'll send one when I have some time. Can you point me to the other BSD CI jobs?

@Bodigrim
Copy link
Contributor

@tuxillo
Copy link
Author

tuxillo commented Sep 10, 2023

Thanks. Looks like I'd have to send a PR to pg-vm-images first.

@chreekat
Copy link
Contributor

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?

Would it be better to say the definition of COMPILER_SUPPORTS_AVX512 needs to be extended to account for Dragonfly? It's already mixing checks of compiler version and operating system version, anyway, which makes the variable's name look misleading to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants