System.Teminal.hsc fails to compile on a Solaris-family OS

オープン
#6,811 コメント 5 件 リアクション 0 件 担当者 2 名 GitHub で見る

@Bodigrim がすでに取り組んでいます。

2025年9月28日 から。

評価

この issue はまだ評価されていません。

説明

component: Oracle Solaris resolution: upstream issue resolution: wontfix type: question

This has been reported at https://www.reddit.com/r/haskell/comments/1nrt23b/comment/ngka3xp/ as a failure to a build Stack itself:

<command-line>: note: this is the location of the previous definition
In file included from /root/stack-3.7.1/dist-newstyle/build/x86_64-solaris/ghc-9.8.2/stack-3.7.1/build/System/Terminal_hsc_make.c:1:
Terminal.hsc: In function 'main':
Terminal.hsc:28:15: error: invalid application of 'sizeof' to incomplete type 'struct winsize'
/opt/local/lib/ghc-9.8.2/lib/template-hsc.h:96:39: note: in definition of macro 'hsc_size'
   96 |     hsc_printf("(%ld)", (long) sizeof(t));
      |                                       ^
/opt/local/lib/ghc-9.8.2/lib/template-hsc.h:102:9: error: field 'b' has incomplete type
  102 |       x b;                                                            \
      |         ^
Terminal.hsc:29:5: note: in expansion of macro 'hsc_alignment'
In file included from /opt/local/lib/ghc-9.8.2/lib/template-hsc.h:11:
/opt/local/lib/ghc-9.8.2/lib/template-hsc.h:82:24: error: invalid use of undefined type 'struct winsize'
   82 |                 (long) offsetof (t, f));
      |

This seemingly stems from
https://github.com/commercialhaskell/stack/blob/b2457a8f147c228bd2aba9c00cb16e3c28cd0a3a/src/unix/System/Terminal.hsc#L27-L32

I have no idea what's going on. Looking at a similar functionality in https://github.com/biegunka/terminal-size/blob/master/src/System/Console/Terminal/Posix.hsc, I notice a suspicious line

#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)

which might or might not have to do something with the latter error.

BTW is there a reason stack does not use terminal-size to get the terminal width and rolls out its own implementation?

主要言語
Haskell
スター
4.1k
フォーク
857
平均マージ
17時間 32分
マージ済み PR(30日)
5

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

commercialhaskell/stack のほかの issue

commercialhaskell/stack の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。