Я пытаюсь настроить проект, используя библиотеку boost из conan-center на linux. Чтобы проверить мою проблему в небольшой среде, я создал проект, который вы можете протестировать.
https://github.com/resqsx/conan-boost
Я тестирую на
- ubuntu 18.04
- conan 1.24.0
- boost 1.72.0
Мой conafile выглядит так:
[requires]
boost/1.72.0
[options]
boost:shared=True
[generators]
cmake
[imports]
bin, *.dll -> ./bin
lib, *.dylib* -> ./bin
lib, *.so* -> ./bin
И CMake:
cmake_minimum_required (VERSION 3.12.0)
project(spielwiese)
# Load Conan
include(${CMAKE_SOURCE_DIR}/conan.cmake)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_cmake_run(CONANFILE conanfile.txt
BASIC_SETUP CMAKE_TARGETS BUILD missing)
add_executable(spielwiese spielwiese.cpp)
target_link_libraries(spielwiese CONAN_PKG::boost)
Мой процесс сборки выглядит нормально в соответствии с результатом:
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
conanfile.txt: Installing package
Requirements
boost/1.72.0 from 'conan-center' - Cache
bzip2/1.0.8 from 'conan-center' - Cache
zlib/1.2.11 from 'conan-center' - Cache
Packages
boost/1.72.0:5b61a950a8e504865808bd4e284db10c833b020f - Cache
bzip2/1.0.8:b27e2b40bcb70be2e7d6f0e0c6e43e35c530f8d3 - Cache
zlib/1.2.11:d50a0d523d98c15bb147b18fa7d203887c38be8b - Cache
Installing (downloading, building) binaries...
bzip2/1.0.8: Already installed!
zlib/1.2.11: Already installed!
boost/1.72.0: Already installed!
boost/1.72.0: LIBRARIES: ['boost_wave', 'boost_container', 'boost_contract', 'boost_exception', 'boost_graph', 'boost_iostreams', 'boost_locale', 'boost_log', 'boost_program_options', 'boost_random', 'boost_regex', 'boost_serialization', 'boost_wserialization', 'boost_coroutine', 'boost_fiber', 'boost_context', 'boost_timer', 'boost_thread', 'boost_chrono', 'boost_date_time', 'boost_atomic', 'boost_filesystem', 'boost_system', 'boost_type_erasure', 'boost_log_setup', 'boost_math_c99', 'boost_math_c99f', 'boost_math_c99l', 'boost_math_tr1', 'boost_math_tr1f', 'boost_math_tr1l', 'boost_stacktrace_addr2line', 'boost_stacktrace_backtrace', 'boost_stacktrace_basic', 'boost_stacktrace_noop', 'boost_unit_test_framework']
boost/1.72.0: Package folder: /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
conanfile.txt imports(): Copied 36 '.0' files
conanfile.txt imports(): Copied 36 '.72' files
conanfile.txt imports(): Copied 36 '.1' files
conanfile.txt imports(): Copied 36 '.so' files
-- Conan: Automatic detection of conan settings from cmake
-- Conan: Settings= -s;build_type=Release;-s;compiler=gcc;-s;compiler.version=7;-s;compiler.libcxx=libstdc++11
-- Conan: checking conan executable
-- Conan: Found program /home/.local/bin/conan
-- Conan: Version found Conan version 1.24.0
-- Conan executing: /home/.local/bin/conan install /home/work/tim_spielwiese/conanfile.txt -s build_type=Release -s compiler=gcc -s compiler.version=7 -s compiler.libcxx=libstdc++11 -g=cmake --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=7
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
conanfile.txt: Installing package
Requirements
boost/1.72.0 from 'conan-center' - Cache
bzip2/1.0.8 from 'conan-center' - Cache
zlib/1.2.11 from 'conan-center' - Cache
Packages
boost/1.72.0:5b61a950a8e504865808bd4e284db10c833b020f - Cache
bzip2/1.0.8:b27e2b40bcb70be2e7d6f0e0c6e43e35c530f8d3 - Cache
zlib/1.2.11:d50a0d523d98c15bb147b18fa7d203887c38be8b - Cache
Installing (downloading, building) binaries...
bzip2/1.0.8: Already installed!
zlib/1.2.11: Already installed!
boost/1.72.0: Already installed!
boost/1.72.0: LIBRARIES: ['boost_wave', 'boost_container', 'boost_contract', 'boost_exception', 'boost_graph', 'boost_iostreams', 'boost_locale', 'boost_log', 'boost_program_options', 'boost_random', 'boost_regex', 'boost_serialization', 'boost_wserialization', 'boost_coroutine', 'boost_fiber', 'boost_context', 'boost_timer', 'boost_thread', 'boost_chrono', 'boost_date_time', 'boost_atomic', 'boost_filesystem', 'boost_system', 'boost_type_erasure', 'boost_log_setup', 'boost_math_c99', 'boost_math_c99f', 'boost_math_c99l', 'boost_math_tr1', 'boost_math_tr1f', 'boost_math_tr1l', 'boost_stacktrace_addr2line', 'boost_stacktrace_backtrace', 'boost_stacktrace_basic', 'boost_stacktrace_noop', 'boost_unit_test_framework']
boost/1.72.0: Package folder: /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f
conanfile.txt: Generator cmake created conanbuildinfo.cmake
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
conanfile.txt imports(): Copied 36 '.1' files
conanfile.txt imports(): Copied 36 '.0' files
conanfile.txt imports(): Copied 36 '.so' files
conanfile.txt imports(): Copied 36 '.72' files
-- Conan: Loading conanbuildinfo.cmake
-- Conan: Adjusting output directories
-- Conan: Using cmake targets configuration
-- Library boost_wave found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_wave.so
-- Library boost_container found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_container.so
-- Library boost_contract found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_contract.so
-- Library boost_exception found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_exception.a
-- Library boost_graph found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_graph.so
-- Library boost_iostreams found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_iostreams.so
-- Library boost_locale found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_locale.so
-- Library boost_log found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_log.so
-- Library boost_program_options found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_program_options.so
-- Library boost_random found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_random.so
-- Library boost_regex found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_regex.so
-- Library boost_serialization found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_serialization.so
-- Library boost_wserialization found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_wserialization.so
-- Library boost_coroutine found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_coroutine.so
-- Library boost_fiber found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_fiber.so
-- Library boost_context found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_context.so
-- Library boost_timer found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_timer.so
-- Library boost_thread found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_thread.so
-- Library boost_chrono found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_chrono.so
-- Library boost_date_time found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_date_time.so
-- Library boost_atomic found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_atomic.so
-- Library boost_filesystem found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_filesystem.so
-- Library boost_system found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_system.so
-- Library boost_type_erasure found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_type_erasure.so
-- Library boost_log_setup found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_log_setup.so
-- Library boost_math_c99 found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_c99.so
-- Library boost_math_c99f found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_c99f.so
-- Library boost_math_c99l found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_c99l.so
-- Library boost_math_tr1 found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_tr1.so
-- Library boost_math_tr1f found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_tr1f.so
-- Library boost_math_tr1l found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_math_tr1l.so
-- Library boost_stacktrace_addr2line found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_stacktrace_addr2line.so
-- Library boost_stacktrace_backtrace found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_stacktrace_backtrace.so
-- Library boost_stacktrace_basic found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_stacktrace_basic.so
-- Library boost_stacktrace_noop found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_stacktrace_noop.so
-- Library boost_unit_test_framework found /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_unit_test_framework.so
-- Library z found /media/DATA/conan_data_linux/zlib/1.2.11/_/_/package/d50a0d523d98c15bb147b18fa7d203887c38be8b/lib/libz.a
-- Library bz2 found /media/DATA/conan_data_linux/bzip2/1.0.8/_/_/package/b27e2b40bcb70be2e7d6f0e0c6e43e35c530f8d3/lib/libbz2.a
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/work/tim_spielwiese/build
-- Conan: Compiler GCC>=5, checking major version 7
-- Conan: Checking correct version: 7
-- Configuring done
-- Generating done
-- Build files have been written to: /home/work/tim_spielwiese/build
[2/2] Linking CXX executable bin/spielwiese
Но когда я проверяю свои общие библиотеки, я уже вижу проблему.
ldd ./build/bin/spielwiese
linux-vdso.so.1 (0x00007fff27d49000)
libboost_log.so.1.72.0 => /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_log.so.1.72.0 (0x00007fe57101e000)
libboost_thread.so.1.72.0 => /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_thread.so.1.72.0 (0x00007fe570dfa000)
libboost_log_setup.so.1.72.0 => /media/DATA/conan_data_linux/boost/1.72.0/_/_/package/5b61a950a8e504865808bd4e284db10c833b020f/lib/libboost_log_setup.so.1.72.0 (0x00007fe570b4c000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe57092d000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe5705a4000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe57038c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe56ff9b000)
libboost_filesystem.so.1.72.0 => not found
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe56fd93000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe571532000)
libboost_regex.so.1.72.0 => not found
libboost_filesystem.so.1.72.0 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe56f9f5000)
Не найдены файловая система и регулярные выражения библиотек.
Что не так с моей конфигурацией?