5

我正在使用 Xcode 6.1 在我的 Mac OS X 10.9.5 上安装 Moses 翻译软件。说明说我需要g++Boost安装。一旦我这样做了,我 git clone, "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: library not found for -lboost_thread”的形式。所以很明显有些东西找不到与boost相关的库,但我不知道如何解决这个问题。有人有建议吗?我实际上只是从安装说明中复制了几行,Moses 很受欢迎,以至于安装说明中的明显错误早就被发现了。

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

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

我的动力在

/usr/local/Cellar/boost/1.56.0/

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

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

4

2 回答 2

0

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

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

我创建了一个“转发”目录 - 所以我不需要安装 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
于 2014-11-15T21:09:24.483 回答
0

这里没有说 ComputerScientist 编译了哪个摩西版本,但他最后的评论一针见血。当我即将编译 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(). 不幸的是,我不能将此作为对先前答案的评论发布...

于 2015-03-17T23:26:08.123 回答