• Mac下编译Moses工具


           闲来无事,就想在mac平台下编译Moses,以后没事的时候可以折腾一下。但是编译的过程中发生了很多想不到的问题。Moses依赖于其他几个工具,比如GIZA++,SRILM和XMLRPC等工具包,相比于第一次编译,突然发觉现在的编译过程已经极大的简化了,但是有些网站却没有做相应的更新(http://www.statmt.org/moses_steps.html),但是可以很明显的看出问题,也就不详细解释了。

            在编译SRILM这个工具包遇到了一个我觉得很蛋疼的问题,编译错误的提示信息如下:

    make[2]: [http://www.cnblogs.com/bin/macosx-m64/fngram] Error 1 (ignored)
    g++ -DHAVE_ZOPEN -I/usr/include -I. -Ihttp://www.cnblogs.com/include -DHAVE_ZOPEN -c -g -O2 -fno-common -o ../obj/macosx-m64/lattice-tool.o lattice-tool.cc
    g++ -DHAVE_ZOPEN -I/usr/include -I. -Ihttp://www.cnblogs.com/include -DHAVE_ZOPEN -u _matherr -Lhttp://www.cnblogs.com/lib/macosx-m64 -g -O2 -fno-common -o ../bin/macosx-m64/lattice-tool ../obj/macosx-m64/lattice-tool.o ../obj/macosx-m64/liblattice.a http://www.cnblogs.com/lib/macosx-m64/libflm.a http://www.cnblogs.com/lib/macosx-m64/liboolm.a http://www.cnblogs.com/lib/macosx-m64/libdstruct.a http://www.cnblogs.com/lib/macosx-m64/libmisc.a -L/usr/lib -ltcl -lm 2>&1 | c++filt
    Undefined symbols for architecture x86_64:
    "FNgramSpecs<unsigned long>::FNgramSpec::ParentSubset::backoffValueRSubCtxW(unsigned int, unsigned int const*, unsigned int, BackoffNodeStrategy, FNgram&, unsigned int, unsigned int)", referenced from:
    FNgram::boNode(unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)in libflm.a(FNgramLM.o)
    "FNgramSpecs<unsigned long>::FNgramSpec::BGChildIterCnstr::next(unsigned int&)", referenced from:
    FNgram::computeBOWs(unsigned int, unsigned int)in libflm.a(FNgramLM.o)
    FNgram::bgChildProbBO(unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)in libflm.a(FNgramLM.o)
    FNgram::boNode(unsigned int, unsigned int const*, unsigned int, unsigned int, unsigned int)in libflm.a(FNgramLM.o)
    "FNgramSpecs<unsigned long>::FNgramSpec::BGChildIterCnstr::BGChildIterCnstr(unsigned int, unsigned int, unsigned int)", referenced from:
    FNgram::computeBOWs(unsigned int, unsigned int)in libflm.a(FNgramLM.o)
    。。。。。。。。。(中间的内容跟前面差不多,所以省去了)
    "LHash<char const*, unsigned int>::getInternalKey(char const*, bool&) const", referenced from:
    SubVocab::addWord(unsigned int)in liboolm.a(SubVocab.o)
    "LHash<unsigned int, unsigned int>::find(unsigned int, bool&) const", referenced from:
    Vocab::isNonEvent(unsigned int) constin liboolm.a(SubVocab.o)
    KneserNey::estimate(NgramStats&, unsigned int)in liboolm.a(Discount.o)
    ModKneserNey::estimate(NgramStats&, unsigned int)in liboolm.a(Discount.o)
    GoodTuring::estimate(NgramStats&, unsigned int)in liboolm.a(Discount.o)
    ld: symbol(short) not found for architecture x86_64
    collect2: ld returned 1 exit status
    /Users/zhangyu/Src/Project/tools/srilm/sbin/decipher-install 0555 ../bin/macosx-m64/lattice-tool http://www.cnblogs.com/bin/macosx-m64
    ERROR: File to be installed (../bin/macosx-m64/lattice-tool) does not exist.
    Usage: decipher-install [-p] <mode> <file1> ... <fileN> <directory>
    mode: file permission mode, in octal
    file1 ... fileN: files to be installed
    directory: where the files should be installed

            按照编译错误的提示,应该是文件编译的格式出问题,可能不是X86_64架构的,但是我用file文件查看时,每一个obj文件都是X86_64架构的,而且这里提示缺少的文件,我都能在一些obj和ar文件中查询到,这个问题到现在也没有解决。。。。。。

            遇到的另外一个问题就是苹果的动态库,貌似跟windows的有点差别,加载路径已经定死了,是写入了可执行文件之中,不得随意更改,如果没有绝对路径,那么查找相应的动态链接库就会失败,这是觉得比较奇怪的地方,解决的方法是设置两个环境变量(DYLD_FALLBACK_FRAMEWORK_PATH,DYLD_LIBRARY_PATH),将你的库文件路径加入到环境变量之中即可。

  • 相关阅读:
    tornado web 框架的认识
    JavaScript 作用域知识点梳理
    服务器
    git——学习
    webservice——和API接口
    celery——任务调度模块
    supervisor——进程管理工具
    Python常用的语句
    数据类型比较总结
    字符集和字符编码问题
  • 原文地址:https://www.cnblogs.com/lacozhang/p/2733249.html
Copyright © 2020-2023  润新知