【发布时间】:2019-04-15 15:52:10
【问题描述】:
我在使用柯南版 Boost 时遇到以下错误。代码使用操作系统的库编译得很好(尽管在另一个系统上)。
错误输出:
[ 2%] Built target logging
[ ...] ....
[ 18%] Linking CXX executable ../bin/DEPTHFILE_UTILS
../lib/lib_logging.so: undefined reference to "boost::log::v2_mt_posix::aux::code_convert_impl(wchar_t const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long, std::locale const&)"
../lib/lib_logging.so: undefined reference to "boost::log::v2_mt_posix::parse_error::throw_(char const*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::log::v2_mt_posix::attribute_name const&)"
../lib/lib_logging.so: undefined reference to "boost::log::v2_mt_posix::sinks::text_file_backend::consume(boost::log::v2_mt_posix::record_view const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)"
collect2: error: ld returned 1 exit status
src/CMakeFiles/DEPTHFILE_UTILS.dir/build.make:146: set di istruzioni per l'obiettivo "bin/DEPTHFILE_UTILS" non riuscito
make[2]: *** [bin/DEPTHFILE_UTILS] Errore 1
CMakeFiles/Makefile2:1018: set di istruzioni per l'obiettivo "src/CMakeFiles/DEPTHFILE_UTILS.dir/all" non riuscito
make[1]: *** [src/CMakeFiles/DEPTHFILE_UTILS.dir/all] Errore 2
Makefile:94: set di istruzioni per l'obiettivo "all" non riuscito
我已经在logging.h 标头中定义了BOOST_LOG_DYN_LINK,我在其中声明了所有与日志相关的宏。 lib_logging.so 是 init() 方法所在的位置。
CMake 找到所有需要的库并正常工作。
柯南配置:
[requires]
boost/1.66.0@conan/stable
gtest/1.8.1@bincrafters/stable
opencv/3.4.5@conan/stable
[generators]
cmake
[options]
boost:shared=True
感谢任何帮助。
系统信息:
- 在装有 Ubuntu 16.04 LTS 的虚拟机上运行
- 柯南1.13.0版
- CXX 编译器 GNU
- CXX 编译器版本 5.4.0
柯南配置:
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=5
os=Linux
os_build=Linux
使用this 作为参考在build 目录内运行命令(超出源代码构建):
virtualenv vconan -no-site-package
source vconan/bin/activate
pip install -upgrade pip
pip install conan
conan install ../
deactivate
cmake -DCMAKE_BUILD_TYPE=Release -DCONAN_BUILD=ON ..
make
【问题讨论】:
-
您使用的是哪个操作系统?哪个编译器和版本?哪个处理器架构?你运行了哪些命令?你运行的是哪个柯南版本?
-
感谢您报告自己的修复:+1: