I've just checked in revision 3796 which fixes this problem, including the OnDiskWrapper issue for bonus kicks.
Tested with: ./configure, ./configure --without-kenlm, ./configure --enable-shared, and ./configure --enable-shared --without-kenlm . I would have just added -lkenlm to LIBS in configure.ac but then it tries to link -lkenlm when building the library itself :-(. So now every binary has @KENLM_LDFLAGS@ in Makefile.am. This could be renamed and subsume "-L$(top_srcdir)/OnDiskPt/src -lOnDiskPt" since libmoses depends on that too. There's probably a more elegant solution but libtool/autoconf/automake/autodefectivekitchensink terrify me; I'm a Boost.Build user. On 01/11/11 09:41, Sylvain Raybaud wrote: > Hi! thank you for the answer. It seems there is a problem when building moses > using --enable-shared. See: > > #with --enable-shared and --with-kenlm: > sylv...@markov ~/tmp $ svn co > https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder mosesdecoder- > kenlm > [...] > sylv...@markov ~/tmp $ cp -r mosesdecoder-kenlm/ mosesdecoder-noknelm > sylv...@markov ~/tmp $ cd mosesdecoder-kenlm/trunk > sylv...@markov ~/tmp/mosesdecoder-kenlm/trunk $ ./regenerate-makefiles.sh > [...] > sylv...@markov ~/tmp/mosesdecoder-kenlm/trunk $ ./configure --with- > srilm=${HOME}/loria/srilm --enable-shared --with-kenlm && make > [...] > /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/../../../../x86_64-pc-linux-gnu/bin/ld: > > cannot find -lkenlm > collect2: ld returned 1 exit status > make[3]: *** [libmoses.la] Error 1 > make[3]: Leaving directory `/home/sylvain/tmp/mosesdecoder- > kenlm/trunk/moses/src' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/home/sylvain/tmp/mosesdecoder- > kenlm/trunk/moses/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/sylvain/tmp/mosesdecoder-kenlm/trunk' > make: *** [all] Error 2 > sylv...@markov ~/tmp/mosesdecoder-kenlm/trunk $ echo $? > 2 > > > > > #with --enable-shared and --without-kenlm: > sylv...@markov ~/tmp/mosesdecoder-kenlm/trunk $ cd ~/tmp/mosesdecoder- > nokenlm/trunk/ > sylv...@markov ~/tmp/mosesdecoder-nokenlm/trunk $ ./regenerate-makefiles.sh > [...] > sylv...@markov ~/tmp/mosesdecoder-nokenlm/trunk $ ./configure --with- > srilm=${HOME}/loria/srilm/ --enable-shared --without-kenlm && make > [...] > > /bin/sh ../../libtool --tag=CXX --mode=link g++ -g -O2 - > L/home/sylvain/loria/srilm//lib/x86_64-gcc4 - > L/home/sylvain/loria/srilm//flm/obj/x86_64-gcc4 -o checkplf checkplf.o > ../../moses/src/libmoses.la -loolm -loolm -ldstruct -lmisc -lflm -lz > libtool: link: g++ -g -O2 -o .libs/checkplf checkplf.o - > L/home/sylvain/loria/srilm//lib/x86_64-gcc4 - > L/home/sylvain/loria/srilm//flm/obj/x86_64-gcc4 > ../../moses/src/.libs/libmoses.so -loolm -ldstruct -lmisc -lflm -lz > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::Word::~Word()' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::PhraseNode::GetTargetPhraseCollection(unsigned long, > OnDiskPt::OnDiskWrapper&) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::PhraseNode::GetChild(OnDiskPt::Word const&, > OnDiskPt::OnDiskWrapper&) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::GetMisc(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::PhraseNode::GetCount(unsigned long) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::~OnDiskWrapper()' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::PhraseNode::~PhraseNode()' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::TargetPhraseCollection::~TargetPhraseCollection()' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::GetRootSourceNode()' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::ConvertFromMoses(Moses::FactorDirection, > std::vector<unsigned long, std::allocator<unsigned long> > const&, > Moses::Word > const&) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::TargetPhraseCollection::ConvertToMoses(std::vector<unsigned long, > std::allocator<unsigned long> > const&, std::vector<unsigned long, > std::allocator<unsigned long> > const&, Moses::PhraseDictionary const&, > std::vector<float, std::allocator<float> > const&, Moses::WordPenaltyProducer > const*, Moses::LMList const&, std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, OnDiskPt::Vocab&) const' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::BeginLoad(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&)' > ../../moses/src/.libs/libmoses.so: undefined reference to > `OnDiskPt::OnDiskWrapper::OnDiskWrapper()' > collect2: ld returned 1 exit status > make[2]: *** [checkplf] Error 1 > make[2]: Leaving directory `/home/sylvain/tmp/mosesdecoder- > nokenlm/trunk/moses-cmd/src' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/sylvain/tmp/mosesdecoder-nokenlm/trunk' > make: *** [all] Error 2 > > > > > #on the other hand, without shared libraries: > sylv...@markov ~/loria/mosesdecoder/trunk $ ./configure --with- > srilm=${PWD}/../../srilm/ --with-kenlm > [...] > sylv...@markov ~/loria/mosesdecoder/trunk $ nice make -j4 > [...] > sylv...@markov ~/loria/mosesdecoder/trunk $ echo $? > 0 > > > regards, > > On Tuesday 11 January 2011 14:13:17 Barry Haddow wrote: >> Hi Sylvain >> >> There's an --enable-shared option to configure which should switch on the >> building of shared libraries. >> >> The way that branches work in svn is that the entire trunk is (effectively) >> copied into the branch directory. See (eg) here >> http://svnbook.red-bean.com/en/1.1/ch04.html >> >> Once you're added as a moses developer, if you create a branch then it >> doesn't really matter what you do there as it doesn't affect others. If >> you have useful contributions to trunk, then we're happy to have them, but >> we'd need to be careful to keep the trunk as stable as possible. >> >> best regards - Barry >> >> On Tuesday 11 January 2011 09:59, Sylvain Raybaud wrote: >>> Hello >>> >>> I would like to use moses as a library in a piece of software. It check >>> >>> out, compiled and browsed through the source tree, and it seems that no >>> shared library is built. I would like to create one (maybe more changes >>> will be made later). It seems that some contributions are included in the >>> repository under the "branches" directory. What are the conditions to >>> check in some work here ? should the entire source tree be copied here, >>> or just the files I want to change ? thank you >>> >>> best regards, > _______________________________________________ Moses-support mailing list Moses-support@mit.edu http://mailman.mit.edu/mailman/listinfo/moses-support