安装摩西翻译软件。错误消息:“ld:找不到-lboost_thread的库”

时间:2014-11-15 20:08:33

标签: c++ xcode boost moses

我正在使用Xcode 6.1在我的Mac OS X 10.9.5上安装摩西翻译软件。 The instructions say我需要安装g++Boost。一旦我这样做,我git克隆,“cd”到目录,然后键入./bjam -j8。首先,我确认我有先决条件。首先,g ++(我只是点击了TAB以查看可用的内容):

$ g++
g++      g++-4.9 

然后提升:

$ brew install boost
Warning: boost-1.56.0 already installed

然后我尝试安装:

$ ./bjam -j8
Tip: install tcmalloc for faster threading.  See BUILD-INSTRUCTIONS.txt for more information.
mkdir: bin: File exists
...patience...
...patience...
...found 4469 targets...
...updating 155 targets...
darwin.link lm/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/query
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)

// Additional error messages...

    ...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/util_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>util_test...
darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)

    "g++"  -o "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/VocabularyTest.o" "mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/libmert_lib.a"   -lboost_unit_test_framework -llzma -lbz2 -ldl -lboost_system -lz -lboost_thread -lm -liconv   -g -Wl,-dead_strip -no_dead_strip_inits_and_terms 


...failed darwin.link mert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi/vocabulary_test...
...skipped <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test.passed for lack of <pmert/bin/darwin-4.2.1/release/debug-symbols-on/link-static/threading-multi>vocabulary_test...
...failed updating 72 targets...
...skipped 83 targets...
The build failed.  If you need support, run:
  ./jam-files/bjam -j8 --debug-configuration -d2 |gzip >build.log.gz
then attach build.log.gz to your e-mail.
You MUST do 3 things before sending to the mailing list:
   1. Subscribe to the mailing list at http://mailman.mit.edu/mailman/listinfo/moses-support
   2. Attach build.log.gz to your e-mail
   3. Say what is the EXACT command you executed when you got the error
ERROR

有大量错误消息未显示(浓缩为“//附加错误消息”),它们都是“ld:找不到-lboost_thread的库”形式。所以很明显有些东西找不到与boost相关的库,但我不知道如何解决这个问题。有没有人有建议?我只是从安装说明中复制了几行,而Moses很受欢迎,因此安装说明中的明显错误很久以前就会被捕获。

其他评论:在安装说明页面上,他们列出了一个命令,可以强制安装程序找到升级库:

./bjam --with-boost=~/workspace/temp/boost_1_55_0 -j8

我的提升在

/usr/local/Cellar/boost/1.56.0/

我尝试用上面的文件路径替换--with-boost=参数,但这也不起作用(我得到了相同的错误)。

我将在Moses邮件列表上发布此内容,但我也想问这里,因为我收到了同样的错误(“找不到库... clang:错误:链接器命令失败,退出代码为1 “)使用其他软件,对我来说,学习确保clang可以找到我的库的一般策略会很有帮助。

2 个答案:

答案 0 :(得分:0)

这个软件包需要一个非标准的提升布局(或者许多系统上的已安装提升的标准布局,但它肯定不是默认布局提升我的工作目录):

bjam --help说:

  

--with-boost=/path/to/boost

     

如果Boost位于非标准位置,请在此处指定。这个目录是      期望包含include和lib或lib64。

当我的Boost构建树位于

/home/sehe/custom/boost/boost       // headeers
/home/sehe/custom/boost/stage
/home/sehe/custom/boost/stage/lib   // libraries

我创建了一个&#34;转发&#34;目录 - 所以我不需要安装boost:

mkdir /tmp/boost-moses 
cd /tmp/boost-moses/
ln -sfv /home/sehe/custom/boost/stage/lib lib
ln -sfv /home/sehe/custom/boost include

现在我可以使用

触发mosesdecoder目录中的构建
./bjam --with-boost=/tmp/boost-moses

答案 1 :(得分:0)

这里没有说摩西版本的计算机科学家编写的,但他的最后一句评论很明显。当我即将编译版本2.1.1时,我需要重写Jamroot文件和jam-files/boost-build/tools/mpi.jam并将所有boost_mpi提及更改为boost_mpi-mt。在我看来,boost-1.55使用了不同的库风格,然后是boost-1.56,摩西在那个版本中适应了1.55。

但由于undefined reference to boost::filesystem::path::stem(),我现在无法使用boost-1.55或boost-1.56编译Moses 3.0。 不幸的是,我不能将此作为对先前答案的评论发表...