如何排除通过了autoconf / automake的Boost库/头包容? [英] How do I troubleshoot boost library/header inclusion via autoconf/automake?

查看:225
本文介绍了如何排除通过了autoconf / automake的Boost库/头包容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来autom4te,而我试图使用autoconf / automake的建立和多种架构链接C ++程序。更为复杂的链接是,该项目需要提升(文件系统,系统,program_options)的事实。

I'm new to autom4te, and I'm trying to use autoconf/automake to build and link a C++ program on multiple architectures. Complicating the linking is the fact that the project requires boost (filesystem, system, program_options).

我使用boost.m4(从 http://github.com/tsuna/ boost.m4 /树/ ),似乎找到所有库和头成功。

I'm using boost.m4 (from http://github.com/tsuna/boost.m4/tree/), and it seems to locate all the libraries and headers successfully.

不幸的是,连接仍然失败,留下我糊涂了。

Unfortunately, linking still fails, leaving me confused.

这些都是相关的行 configure.ac

AC_CONFIG_MACRO_DIR([m4])
# ...
AC_PROG_CXX
AC_PROG_LIBTOOL
# ...
BOOST_REQUIRE([1.41.0])
BOOST_FILESYSTEM
BOOST_SYSTEM
BOOST_PROGRAM_OPTIONS
# ...

而在的src / Makefile.am

bin_PROGRAMS = phenomatrix
phenomatrix_CXXFLAGS = $(BOOST_CPPFLAGS)
phenomatrix_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_FILESYSTEM_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LDFLAGS) # $(BOOST_SYSTEM_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_FILESYSTEM_LIB)
phenomatrix_LIBS = $(BOOST_SYSTEM_LIBS) $(BOOST_FILESYSTEM_LIBS) $(BOOST_PROGRAM_OPTIONS_LIBS)
phenomatrix_SOURCES = adjacency_list.cpp distance.cpp genephene.cpp knearest.cpp marshall.cpp oracle.cpp type_shield.cpp avgmindist.cpp euclidean.cpp hypergeometric.cpp main.cpp mindist.cpp partialbayes.cpp utilities.cpp

这些给没有任何错误,它甚至设法找到库和头文件:

These give no errors, and it even manages to find the libraries and headers:

checking for Boost headers version >= 104100... yes
checking for Boost's header version... 1_41
checking for the toolset name used by Boost for g++... gcc44 -gcc
checking boost/system/error_code.hpp usability... yes
checking boost/system/error_code.hpp presence... yes
checking for boost/system/error_code.hpp... yes
checking for the Boost system library... yes
checking boost/filesystem/path.hpp usability... yes
checking boost/filesystem/path.hpp presence... yes
checking for boost/filesystem/path.hpp... yes
checking for the Boost filesystem library... yes
checking for boost/system/error_code.hpp... (cached) yes
checking for the Boost system library... (cached) yes
checking boost/program_options.hpp usability... yes
checking boost/program_options.hpp presence... yes
checking for boost/program_options.hpp... yes
checking for the Boost program_options library... yes

但后来,当我运行制作,我得到的错误:

libtool: link: g++ -g -O2 -o phenomatrix phenomatrix-adjacency_list.o phenomatrix-distance.o phenomatrix-genephene.o phenomatrix-knearest.o phenomatrix-marshall.o phenomatrix-oracle.o phenomatrix-type_shield.o phenomatrix-avgmindist.o phenomatrix-euclidean.o phenomatrix-hypergeometric.o phenomatrix-main.o phenomatrix-mindist.o phenomatrix-partialbayes.o phenomatrix-utilities.o  -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
phenomatrix-adjacency_list.o: In function `__static_initialization_and_destruction_0':
/usr/local/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()'
/usr/local/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()'
/usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()'
/usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()'
/usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()'

其中重复广告nauseum。

which repeat ad nauseum.

我什至不知道如何去测试,看看它是否包含正确的目录。是的,我知道有上G ++一个 -t 标记,但我不知道究竟如何传递(从autom4te内)。

I'm not even sure how to go about testing to see if it's including the right directories. Yes, I understand that there's a -t flag on g++, but I don't exactly know how to pass that (from within autom4te).

我推测这事做与升压库和头文件在同一台机器上的多个版本,并没有多少我能做到这一点。

I gather this has something to do with multiple versions of the boost libs and headers on the same machine, and there's not much I can do about that.

推荐答案

它不会编译,因为它的库没有正确设置...的脚本不正确配置的 -lboost_libraryname 选项。

It does not compile because it the library are not properly set... The script does not configure correctly the -lboost_libraryname option.

$(BOOST_PROGRAM_OPTIONS_LIB) -> $(BOOST_PROGRAM_OPTIONS_LIBS) in tyour makefil.am your_program_LDFLAGS

该ax_boost_的 * 的在下面的库.m4脚本正常工作与我:

The ax_boost_*.m4 script in the the following repository worked fine with me:

  • Script listing (http://www.nongnu.org/autoconf-archive/The-Macros.html#The-Macros)

这篇关于如何排除通过了autoconf / automake的Boost库/头包容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆