C++ 如何使用debug libstdc&x2B+;在linux上(GLIBCXX_调试标志)

C++ 如何使用debug libstdc&x2B+;在linux上(GLIBCXX_调试标志),c++,boost,g++,b2,C++,Boost,G++,B2,我尝试使用以下命令构建boost: #!/bin/bash if [ -z "$BUILD_PATH" ] then echo "Variable BUILD_PATH isn't specified!" exit fi BOOST_BUILD_PATH="$BUILD_PATH/boost" mkdir "$BOOST_BUILD_PATH" NBITS=64 STAGEDIR="$BOOST_BUILD_PATH" PLATF_AUX="architecture=x86

我尝试使用以下命令构建boost:

#!/bin/bash

if [ -z "$BUILD_PATH" ]
then
    echo "Variable BUILD_PATH isn't specified!"
    exit
fi

BOOST_BUILD_PATH="$BUILD_PATH/boost"
mkdir "$BOOST_BUILD_PATH"

NBITS=64
STAGEDIR="$BOOST_BUILD_PATH"
PLATF_AUX="architecture=x86 address-model=64"
NUMBER_OF_PROCESSORS=$(nproc)
SPEZ_DEFS="-D_GLIBCXX_DEBUG"



./bootstrap.sh
./b2 -j$NUMBER_OF_PROCESSORS --toolset=gcc cxxflags=-std=c++14,-D_GLIBCXX_DEBUG cflags=-D_GLIBCXX_DEBUG variant=release,debug link=shared runtime-link=shared threading=multi \
            --with-locale -s ICU_PATH=$BUILD_PATH/icu \
            --with-system --with-atomic --with-timer --with-thread --with-chrono --with-program_options --with-filesystem --with-date_time --with-regex --with-iostreams \
            -s NO_ZLIB=0 -s ZLIB_INCLUDE=../BUILD/zlib/include -s ZLIB_LIBPATH=$BUILD_PATH/zlib/lib -s NO_BZIP2=1 \
            --stagedir=$STAGEDIR debug-symbols=on $PLATF_AUX --layout=tagged stage
我不知道如何彻底检查boost是否使用正确的标志编译。显然不是,因为我从构建依赖于boost的lib中得到了这样的错误:

In function `boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)':
/path/to/project/../../shared/boost/boost/program_options/detail/parsers.hpp:44: undefined reference to `boost::program_options::detail::cmdline::cmdline(std::__debug::vector<std::string, std::allocator<std::string> > const&)'
在函数“boost::program_options::basic_command_line_parser::basic_command_line_parser(int,char const*const*)”中:
/path/to/project/./../shared/boost/boost/program_options/detail/parsers.hpp:44:对“boost::program_options::detail::cmdline::cmdline(std::_debug::vector const&)”的未定义引用

但是提到boost可以用debug libstdc++编译。但是如何编译呢?

为什么要用
-D_GLIBCXX_DEBUG
编译?它在stdlibc++中启用调试断言检查,就像对向量进行范围检查一样。为什么要用
-D_GLIBCXX_DEBUG
编译呢?它在stdlibc++中启用调试断言检查,就像对向量进行范围检查一样。