haddock crashes with SIGILL when building under DragonFly BSD

未关闭
#538 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
43/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
c, haskell

调研方向

从 issue 中引用的 COMPILER_SUPPORTS_AVX512 条件附近的 cbits/measure_off.c 开始,然后在 DragonFly BSD 上重现 ghc-9.4.6 构建。比较 AVX512 路径和回退路径,并验证在 AVX512 不可用时 Haddock 能够在不发生 SIGILL 的情况下完成。

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
Haskell
星标
424
派生
167
平均合并
1 天 21 小时
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

haskell/text 的其他 Issue

查看 haskell/text 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。