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



我试图在运行 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。

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

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

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

另请注意,该页面显示gcc 4.6是新的。这意味着它已经有一段时间没有更新了。你可能会有你的工作为你削减。

最新更新