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

时间:2017-10-28 01:21:14

标签: compiler-errors ghc freebsd

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

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。

1 个答案:

答案 0 :(得分:1)

这样以快速开发和研究为导向的系统通常需要大量非常仔细的阅读和工作才能进行设置。

E.g。您是否按照设置系统here的说明进行操作?这些说明暗示您缺少configuregmake命令。

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

另请注意,该页面显示gcc 4.6是新的。这意味着它在相当长的一段时间内没有更新。你可能会为你裁掉工作。