vowpalwabbit编译中的boost :: program_options未定义的引用,ubuntu 16.04

时间:2017-04-10 10:27:59

标签: c++ ubuntu boost boost-program-options vowpalwabbit

我正在尝试在ubuntu 16.04中安装vowpal_wabbit
错误:

./libvw.a(search.o): In function `Search::setup(vw&)':
search.cc:(.text+0xa5f8): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
search.cc:(.text+0xaafe): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
search.cc:(.text+0xac0e): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
search.cc:(.text+0xad20): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
search.cc:(.text+0xadda): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
search.cc:(.text+0xae94): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
./libvw.a(search.o):search.cc:(.text+0xafaa): more undefined references to `boost::program_options::abstract_variables_map::operator[](std::string const&) const' follow
./libvw.a(search_meta.o): In function `SelectiveBranchingMT::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_meta.cc:(.text+0x7645): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
./libvw.a(search_sequencetask.o): In function `SequenceSpanTask::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_sequencetask.cc:(.text+0x14ab): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
./libvw.a(search_sequencetask.o): In function `ArgmaxTask::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_sequencetask.cc:(.text+0x2a02): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
./libvw.a(search_dep_parser.o): In function `DepParserTask::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_dep_parser.cc:(.text+0x4328): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
./libvw.a(search_dep_parser.o): In function `void Search::check_option<unsigned int>(unsigned int&, vw&, boost::program_options::variables_map&, char const*, bool, bool (*)(unsigned int, unsigned int), char const*, char const*)':
search_dep_parser.cc:(.text._ZN6Search12check_optionIjEEvRT_R2vwRN5boost15program_options13variables_mapEPKcbPFbS1_S1_ESA_SA_[_ZN6Search12check_optionIjEEvRT_R2vwRN5boost15program_options13variables_mapEPKcbPFbS1_S1_ESA_SA_]+0x1ea): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
./libvw.a(search_entityrelationtask.o): In function `EntityRelationTask::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_entityrelationtask.cc:(.text+0x33f7): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
./libvw.a(search_graph.o): In function `GraphTask::initialize(Search::search&, unsigned long&, boost::program_options::variables_map&)':
search_graph.cc:(.text+0x17aa): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
search_graph.cc:(.text+0x196c): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
./libvw.a(scorer.o): In function `scorer_setup(vw&)':
scorer.cc:(.text+0x1cd): undefined reference to `boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
scorer.cc:(.text+0x271): undefined reference to `boost::program_options::abstract_variables_map::operator[](std::string const&) const'
collect2: error: ld returned 1 exit status
Makefile:46: recipe for target 'vw' failed
make[1]: *** [vw] Error 1
make[1]: Leaving directory '/home/kapil/Projects/MachineLearning/vowpal_wabbit/vowpalwabbit'
Makefile:97: recipe for target 'vw' failed
make: *** [vw] Error 2

我按照存储库中提供的说明进行操作。我安装了libboost-program-options-devzlib1g-dev&amp; libboost-python-dev。我试图先运行make,这会给出未定义的引用错误。然后我尝试在autogen.sh之前使用make脚本,但这也会导致相同的错误。我也试过使用像make BOOST_FLAGS=-lboost-program-options&amp;这样的命令,但没有成功。 make BOOST_FLAGS=-lboost_options。我尝试使用clang++但是它提供了相同的输出。我检查过boost&amp; boost_program-options&amp;它们存在并且是最新版本。如何删除错误?

问题是,虽然我可以在ubuntu中使用ppa安装vowpalwabbit,但是当我尝试使用pip为python安装它时,它会给出相同的引用错误。我需要安装python版本。

1 个答案:

答案 0 :(得分:1)

您收到的错误表明您没有安装libboost个开发库(更具体地说,libboost-program-options-dev)。从源代码构建libboost-program-options-dev的先决条件中列出了vw。您可以通过安装元软件包libboost-all-dev来安装所有 boost库+标头。

根据official instructions in the README.md file,无需在Ubuntu上运行autogen.sh(事实上,建议 默认情况下这样做是因为它会覆盖原来的Makefile,它可以正常工作。

以下是完整的Ubuntu说明(为方便起见,从github上的官方wiki转载):

Ubuntu / Debian特定信息

在Ubuntu / Debian / Mint上类似,以下序列应该用于构建github的最新版本:

获取libboost程序选项和zlib:

apt-get install libboost-program-options-dev zlib1g-dev

获取python libboost绑定(python subdir) - 可选:

apt-get install libboost-python-dev

获取大众信息源:

git clone git://github.com/JohnLangford/vowpal_wabbit.git

构建

cd vowpal_wabbit
make
make test       # (optional)
make install

如果这些说明不适合您,请确保您没有对您的环境进行其他非标准更改。已知会导致问题的更改包括非标准LD_LIBRARY_PATHLD_RPRELOADldconfig更改,这些更改可能会导致链接器无法在标准位置找到库。