【问题标题】:Problems installing srilm 1.6.0 with llvm-gcc 4.x使用 llvm-gcc 4.x 安装 srilm 1.6.0 时出现问题
【发布时间】:2012-05-15 18:49:08
【问题描述】:

问题

我正在尝试在我的 Mac 上构建 SRI's Language Modeling toolsrilm 版本 1.6.0,并且遇到了一些相当奇怪的编译问题(“奇怪”在几个小时的 Google-fu 中没有帮助),所以我正在向你求助,看看是否有人知道我该如何解决这个问题。

我已经checked that I have the required dependencies and followed the install instructions,也经历过the build troubleshooting section of the FAQ

系统规格

我有一个非常普通的 OS X 安装,其中一些软件包是通过自制软件安装的。 XCode 4.3.2(最新版本)已安装。以下是其他相关系统详细信息。

操作系统版本

Mac OS X 10.7.4

gcc -v打印输出

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin11.0.0/4.6.1/lto-wrapper
Target: x86_64-apple-darwin11.0.0
Configured with: ../gcc-4.6.1/configure --enable-languages=fortran,c++
Thread model: posix
gcc version 4.6.1 (GCC)

g++ -v打印输出

$ gcc -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin11.0.0/4.6.1/lto-wrapper
Target: x86_64-apple-darwin11.0.0
Configured with: ../gcc-4.6.1/configure --enable-languages=fortran,c++
Thread model: posix
gcc version 4.6.1 (GCC) 

uname -a打印输出

$ uname -a
Darwin MacBook-Air.local 11.4.0 Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64

错误本身

以下是从 srlim 顶级目录运行 make World 产生的输出的结尾。到目前为止,在以下任何情况下都可以正常编译:

  • 我自己运行make World
  • 我跑make World MACHINE_TYPE=macosx
  • 我运行 make World MACHINE_TYPE=macosx-m64(64 位处理器的特定 makefile)
  • 我运行 make World MACHINE_TYPE=macosx-m32(针对 32 位处理器的特定 makefile)

而且弹出的错误总是一样的(如下图)。

stderr打印输出

$ make World

(...) # a bunch of stuff compiles with no errors or warnings

c++ -Wreturn-type -Wimplicit -DINSTANTIATE_TEMPLATES -DHAVE_ZOPEN  -I/usr/include -I. -I../../include -DHAVE_ZOPEN   -c -g -O2 -fno-common -o ../obj/macosx/LatticeIndex.o LatticeIndex.cc
LatticeIndex.cc:78:6: error: variable length array of non-POD element type
      'NBestWordInfo'
            makeArray(NBestWordInfo, roundedNgram, len + 1);
            ^
../../include/Array.h:93:33: note: expanded from macro 'makeArray'
# define makeArray(T, A, n)             T A[n]
                                           ^
LatticeIndex.cc:126:4: warning: data argument not used by format string
      [-Wformat-extra-args]
                        (float)ngram[0].start);
                        ^
LatticeIndex.cc:128:4: warning: data argument not used by format string
      [-Wformat-extra-args]
                        (float)(ngram[len-1].start + ngram[len-1].duration));
                        ^
2 warnings and 1 error generated.
make[2]: *** [../obj/macosx/LatticeIndex.o] Error 1
make[1]: *** [release-libraries] Error 1
make: *** [World] Error 2

知道可能出了什么问题吗?它似乎在我部门的其他一些人的 mac 上编译得很好,我检查了他们的 makefile 是否存在差异,但没有弹出任何内容。这里没有人知道构建失败的原因,但如果您能帮助我们,我们将不胜感激。提前感谢您为我提供的任何帮助! :-)

【问题讨论】:

    标签: c++ build installation nlp


    【解决方案1】:

    问题是由于 Apple 使用 llvm-gcc/clang,它不支持可变长度数组。这个问题实际上可以通过修改 $SRILM/dstruct/src/Array.h 来解决,并且在即将发布的srilm 中已经注意到并解决了。

    目前,在 mac 上,使用 g++ 4.2 构建srilm,使用以下命令:

    $ make MACHINE_TYPE=macosx-m64 CXX=g++-4.2 World
    

    这在我所有的 Mac 上都可以毫无问题地构建 srilm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-18
      • 2019-10-03
      • 2022-07-07
      • 1970-01-01
      • 1970-01-01
      • 2018-07-17
      • 2018-12-05
      • 1970-01-01
      相关资源
      最近更新 更多