2010年8月17日星期二

Moses平台的搭建

52nlp网站上有个很详细的帖子介绍如何在Ubuntu下搭建Moses, 可参见
http://www.52nlp.cn/ubuntu-moses-platform-build-process-record

以下记录本人在按上述流程操作时,碰到的一些问题及解决方案.

1. The command to download Moses via SVN (you have to install svn in advance):
svn co https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk moses

2. While comping Moses with the command "./regnerate-makefiles.sh" under the directory 'moses', it meets:

name@name:~/smt/moses$ ./regenerate-makefiles.sh
Calling /usr/bin/aclocal…
Calling /usr/bin/autoconf…
configure.in:12: error: possibly undefined macro: AC_DISABLE_SHARED
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.in:13: error: possibly undefined macro: AC_PROG_LIBTOOL
autoconf failed

run the command again, it meets:

Calling /usr/bin/aclocal...
Calling /usr/bin/autoconf...
Calling /usr/bin/automake...
moses/src/Makefile.am:1: Libtool library used but `LIBTOOL' is undefined
moses/src/Makefile.am:1: The usual way to define `LIBTOOL' is to add
`AC_PROG_LIBTOOL'
moses/src/Makefile.am:1: to `configure.in' and run `aclocal' and
`autoconf' again.
moses/src/Makefile.am:1: If `AC_PROG_LIBTOOL' is in `configure.in', make
sure
moses/src/Makefile.am:1: its definition is in aclocal's search path.
automake failed


Check that you have libtool installed, and that you're using recent versions
of the autoconf/automake tools (The version of autoconf/automake should be 1.9 or higher).


3. While comping Moses Support Scripts with the command "make release" under the directory 'moses/scripts', it meets the following errors:

phrasetable.h:17:27: error: boost/bimap.hpp: No such file or directory

Make sure the boost have installed (download boost at http://www.boost.org).
(While installing boost, use "sudo ./bjam install" command and ignor such errors as "libs/iostreams/src/bzip2.cpp....")

Then, the following error happens:

Please specify a BINDIR.

The BINDIR directory must contain GIZA++, snt2cooc.out and mkcls executables.
These are available from http://www.fjoch.com/GIZA++.html and
http://www-i6.informatik.rwth-aachen.de/Colleagues/och/software/mkcls.html .

Copy GIZA++ and snt2cooc.out from the directory GIZA++-v2, and mkcls from the diectory mkcls-v2 into the directory "$SMT/bin". Then run the command "make release".

OK, done. It creates a directory "scripts-yyyymmdd-hhmm".


其他问题:
安装srilm时, 提示tcl.h找不到时, 需要修改common/Makefile.machine.i686文件, 找到Tcl support部分, 修改为
# Tcl support (standard in Linux)
TCL_INCLUDE = -I/usr/include/tcl8.5
TCL_LIBRARY = -L/usr/lib/tcl8.5

安装irstlm (irstlm-5.60.02)时, 运行./regenerate-makefiles.sh, autoconf出错:
configure.in:17: error: possibly undefined macro: AC_DISABLE_SHARED
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.in:18: error: possibly undefined macro: AC_PROG_LIBTOOL
autoconf failed
再次运行./regenerate-makefiles.sh, automake出错
src/Makefile.am:1: Libtool library used but `LIBTOOL' is undefined
src/Makefile.am:1: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'
src/Makefile.am:1: to `configure.in' and run `aclocal' and `autoconf' again.
src/Makefile.am:1: If `AC_PROG_LIBTOOL' is in `configure.in', make sure
src/Makefile.am:1: its definition is in aclocal's search path.
src/Makefile.am: installing `./depcomp'
src/Makefile.am: C source seen but `CC' is undefined
src/Makefile.am: The usual way to define `CC' is to add `AC_PROG_CC'
src/Makefile.am: to `configure.in' and run `autoconf' again.
automake failed

确保安装libtool (sudo apt-get install libtool) 和 autoconf/automake版本在1.9或以上 (sudo apt-get install automake1.10).
再次运行./regenerate-makefiles.sh, OK!!

运行./configure --prefix=/home/..../irstlm --enable-caching
运行make, 提示gzfilebuf.h:8:18: error: zlib.h: No such file or directory, 安装zlib (sudo apt-get install zlib1g-dev), 重新运行make, OK!!

运行make install, OK!!