我正在尝试安装 vowpal_wabbit在 Ubuntu 16.04 中。
错误:
./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-dev
、zlib1g-dev
和 libboost-python-dev
。我尝试先运行 make
,这给出了 undefined reference 错误。然后我尝试在 make
之前使用 autogen.sh
脚本,但这也会导致同样的错误。我也尝试过,但没有成功,使用像 make BOOST_FLAGS=-lboost-program-options
& make BOOST_FLAGS=-lboost_options
这样的命令。我尝试使用 clang++
但给出了相同的输出。我已经检查了 boost
和 boost_program-options
并且它们存在并且是最新版本。如何消除错误?
问题是,虽然我可以在 ubuntu 中使用 ppa 安装 vowpalwabbit,但是当我尝试使用 pip 为 python 安装它时,它会给出相同的引用错误。我需要安装python版本。
最佳答案
您收到的错误表明您没有安装 libboost
开发库(更具体地说,libboost-program-options-dev
)。 libboost-program-options-dev
列在从源代码构建 vw
的先决条件中。您可以通过安装元数据包libboost-all-dev
来安装所有 boost 库+ header 。
根据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 绑定(bind)(python 子目录)- 可选:
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_PATH
、LD_RPRELOAD
或 ldconfig
更改,这些更改可能会导致链接器无法在标准的地方。
关于c++ - 在 vowpalwabbit 编译中未定义对 boost::program_options 的引用,ubuntu 16.04,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43320774/