I’m not a C++ programmer by any stretch, but I wanted to try my hand at the sample code provided in the README.md for CTranslate. So I fired up a docker ubuntu:16.04
container, installed git, g++, libboost-all-dev, and libeigen3-dev. Then I cloned CTranslate and ran git submodule update --init
.
Finally, I set the CPLUS_INCLUDE_PATH
env var to:
/CTranslate/include:/CTranslate/include/onmt:/CTranslate/lib/TH:/CTranslate/lib/tokenizer/include:/usr/include/eigen3
Now, attempting to compile test.c (copy-pasted from the README) failed spectacularly:
/tmp/ccXYswIf.o: In function 'onmt::ids_to_words(onmt::Dictionary const&, std::vector<unsigned long, std::allocator<unsigned long> > const&)': test.c:(.text+0xaf): undefined reference to 'onmt::Dictionary::get_id_word[abi:cxx11](unsigned long) const' /tmp/ccXYswIf.o: In function 'onmt::ids_to_words_replace(onmt::Dictionary const&, onmt::PhraseTable const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&)': test.c:(.text+0x1c7): undefined reference to 'onmt::Dictionary::unk_id' test.c:(.text+0x1fc): undefined reference to 'onmt::Dictionary::get_id_word[abi:cxx11](unsigned long) const' test.c:(.text+0x2cf): undefined reference to 'onmt::PhraseTable::is_empty() const' test.c:(.text+0x2f0): undefined reference to 'onmt::PhraseTable::lookup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /tmp/ccXYswIf.o: In function 'onmt::words_to_ids(onmt::Dictionary const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)': test.c:(.text+0x463): undefined reference to 'onmt::Dictionary::get_word_id(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' /tmp/ccXYswIf.o: In function 'main': test.c:(.text+0x7bb): undefined reference to 'onmt::TranslatorFactory::build(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, unsigned long, unsigned long)' collect2: error: ld returned 1 exit status
What am I missing?