5

I am installing the Moses Translation Software on my Mac OS X 10.9.5 with Xcode 6.1. The instructions say that I need g++ and Boost installed. Once I do that, I git clone, "cd" into the directory, and then type ./bjam -j8. First, I verified I have the prerequisites. First, g++ (I just clicked the TAB to see what was available):

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

Then boost:

$ brew install boost
Warning: boost-1.56.0 already installed

Then I tried installing:

$ ./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

There's a ton of error messages not shown (condensed into "// Additional error messages"), and they are all of the form "ld: library not found for -lboost_thread". So it's clear that something can't find a boost-related library, but I don't know how to fix this. Does anyone have suggestions? I literally just copied a couple of lines from the installation instructions, and Moses is popular enough such that an obvious error in the installation instructions would have been caught long ago.

Additional comment: On the installation instructions page, they list a command where they can force an installer to find the boost library:

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

My boost is in

/usr/local/Cellar/boost/1.56.0/

I tried substituting the --with-boost= argument with the above file path, but that did not work either (I got the same errors).

I'm going to post this on the Moses mailing list but I'd also want to ask here because I have gotten this same error ("library not found ... clang: error: linker command failed with exit code 1") with other software and it would be helpful for me to learn a general strategy for making sure that clang can find my libraries.

ComputerScientist
  • 936
  • 4
  • 12
  • 20

2 Answers2

0

This package expects a non-standard layout of boost (or maybe that's the standard liayout for installed boost on many systems, but it certainly isn't the default layout for boost in my working directories):

bjam --help says:

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

If Boost is in a non-standard location, specify it here. This directory is expected to contain include and lib or lib64.

When my Boost build tree is in

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

I have created a "forwarding" directory - so I'm not required to install 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

Now I could trigger a build in the mosesdecoder directory with

./bjam --with-boost=/tmp/boost-moses
sehe
  • 374,641
  • 47
  • 450
  • 633
  • I didn't notice the part where it said "this directory is expected to contain include and lib or lib64." But even so, when I do `ls /usr/local/Cellar/boost/1.56.0/` I see an `include` and a `lib` directory, so I don't know why just plugging that in for the `--with-boost` argument doesn't work. I am not sure if I should be linking because my boost is just a standard installation from `brew`. Oh well, I guess I should head over to the mailing list. Thanks for the answer. – ComputerScientist Nov 15 '14 at 21:37
  • Well, 6 minutes later my build was complete with "SUCCESS". (I have no clue what I've been building but that does matter, once I reboot my /tmp is gone :)) – sehe Nov 15 '14 at 22:35
  • do you know anything about the difference between layout=tagged and layout=system with regards to boost? I'm wondering if this is my problem. I have libboost_thread-mt.a but the installer seems like it's looking for libboost_thread.a. – ComputerScientist Nov 16 '14 at 18:51
0

It's not said here which Moses version ComputerScientist compiled, but his last comment hit the nail. When I was about to compile version 2.1.1, I needed to rewrite Jamroot file and jam-files/boost-build/tools/mpi.jam and change all the boost_mpi mentions to boost_mpi-mt. It seems to me that boost-1.55 used different library style then boost-1.56 and Moses was in that version adapted to 1.55.

However I am not able to compile Moses 3.0 with either boost-1.55 or boost-1.56 now because of undefined reference to boost::filesystem::path::stem(). Unfortunatelly I can not post this as a comment to previous answer...

Houmles
  • 197
  • 11
  • 1
    I used the most recent version at the time of my posting (Nov 15, 2014). I did end up getting it to work but it took a LONG time and I don't even remember what I did. I think it was more like: delete almost everything from my computer and start things up again. =( – ComputerScientist Mar 17 '15 at 23:40