编译GHC源代码时如何解决这些编译错误

how to solve these compile errors when compiling GHC source code

我试图在机器 运行 FreeBSD 10.3 上编译 GHC master 源代码,但遇到了一些编译错误。我按照以下步骤做了什么:

1. $ git clone --recursive git://git.haskell.org/ghc.git
2. $ ./boot
3. $ ./configure --prefix=$HOME
4. $ gmake -j2

编译错误:

Common.hsc: In function 'main':
Common.hsc:225:16: error: 'OFDEL' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:225:16: note: each undeclared identifier is reported only once for each function it appears in
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:226:16: error: 'OFILL' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:227:16: error: 'NL0' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:228:16: error: 'NL1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:229:16: error: 'CR0' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:230:16: error: 'CR1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:231:16: error: 'CR2' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:232:16: error: 'CR3' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:234:16: error: 'TAB1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:235:16: error: 'TAB2' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:237:16: error: 'BS0' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:238:16: error: 'BS1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:239:16: error: 'VT0' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:240:16: error: 'VT1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:241:16: error: 'FF0' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \
          ^
Common.hsc:242:16: error: 'FF1' undeclared (first use in this function)
/root/test/ghc/inplace/lib/template-hsc.h:38:10: note: in definition of macro 'hsc_const'
     if ((x) < 0)                                      \

我首先使用 gcc 作为我的 CC 环境值,然后切换到 clang 但也失败了。我已经安装了所有先决条件,如 ghc8.0、alex、happy 等,并安装了最新的 gcc。

像这样面向快速开发和研究的系统通常需要大量非常仔细的阅读和工作才能建立。

例如您是否按照说明设置系统 here?这些说明意味着您缺少 configuregmake 命令。

错误消息说通常在标准终端控制包的 header termios.h 中定义的常量不存在。有许多可能的原因。但是 configuregmake 命令是主要嫌疑人。

另请注意该页面说 gcc 4.6 是新的。这意味着它已经有一段时间没有更新了。您的工作可能已经完成。