安装的助推系统不可用

时间:2015-05-05 19:39:44

标签: c++ linux debian

我的配置脚本有问题:如果我运行./configure,我会得到:

checking whether the Boost::Filesystem library is available... yes
checking for exit in -lboost_filesystem... yes
checking whether the Boost::System library is available... no
checking whether the Boost::Program_Options library is available... yes
checking for exit in -lboost_program_options... yes
checking whether the Boost::Unit_Test_Framework library is available... no
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex... yes
checking whether the Boost::ASIO library is available... yes

但我肯定安装了libboost-system1.55-dev,因为Aptitude这么说。

如果我运行make,我会得到:

/usr/bin/ld: network.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv
//usr/lib/x86_64-linux-gnu/libboost_system.so.1.55.0: error adding symbols: DSO missing from command line

我目前在Debian Jessie下运行。

以下是我的configure.ac的一些部分:

AX_BOOST_BASE([1.55],, [AC_MSG_ERROR([boost 1.55 is needed, but it was not found in your system])])
AX_BOOST_FILESYSTEM
AX_BOOST_SYSTEM
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_UNIT_TEST_FRAMEWORK
AX_BOOST_REGEX
AX_BOOST_ASIO
AX_BOOST_THREAD

BOOST_LDLIBS="$BOOST_LDFLAGS $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIBRARY $BOOST_PROGRAM_OPTIONS_LIB $BOOST_REGEX_LIB $BOOST_SYSTEM"
AC_SUBST(BOOST_LDLIBS)

有趣的是,如果我将configure.ac中的行BOOST_LDLIBS更改为:

,则所有内容都会编译
BOOST_LDLIBS="$BOOST_LDFLAGS $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIBRARY $BOOST_PROGRAM_OPTIONS_LIB $BOOST_REGEX_LIB $BOOST_SYSTEM -lboost_system"

但我不想要这个,因为这是一个非常肮脏的黑客。

编辑: 这是一个最小的(非)工作示例: configure.ac:

AC_INIT([Test],[0.0.1],[],[],[])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])   #TODO: remove foreign
AC_PROG_CXX
AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
AC_CONFIG_MACRO_DIR([m4])
AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([-pedantic], [CPPFLAGS="$CPPFLAGS -pedantic"])
AX_CHECK_COMPILE_FLAG([-Wextra], [CPPFLAGS="$CPPFLAGS -Wextra"])
AX_CHECK_COMPILE_FLAG([-Werror], [CPPFLAGS="$CPPFLAGS -Werror"])
AX_BOOST_BASE([1.55],, [AC_MSG_ERROR([boost 1.55 is needed, but it was not found in your system])])
AX_BOOST_FILESYSTEM
AX_BOOST_SYSTEM
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_UNIT_TEST_FRAMEWORK
AX_BOOST_REGEX
AX_BOOST_ASIO
AX_BOOST_THREAD

#BOOST_SYSTEM="-lboost_system"       #TODO: comment this in, to get it working
BOOST_LDLIBS="$BOOST_LDFLAGS $BOOST_FILESYSTEM_LIB $BOOST_THREAD_LIBRARY $BOOST_PROGRAM_OPTIONS_LIB $BOOST_REGEX_LIB $BOOST_SYSTEM"
AC_SUBST(BOOST_LDLIBS)

AC_OUTPUT([Makefile
           ])

Makefile.am:

bin_PROGRAMS = mwe

mwe_SOURCES = mwe.cpp
mwe_LDFLAGS = $(BOOST_LDFLAGS)
mwe_LDADD = $(BOOST_LDLIBS) -lpthread

ACLOCAL_AMFLAGS = -I m4 --install

mwe.cpp:

#include<boost/asio.hpp>

int main(void) {
}

0 个答案:

没有答案