Не удалось найти следующие библиотеки Boost: boost_fiber - PullRequest
0 голосов
/ 25 октября 2018

Я не знаком с бустом.И я хочу использовать класс в boost, как boost :: context :: fiber и boost :: context :: continue.Итак, я скачиваю новейшую версию boost 1.68.Создайте его с помощью инструкции на официальном сайте.

Сначала запустите загрузчик и сгенерируйте файл b2.

$ ./bootstrap.sh --with-libraries=all --prefix=/usr/local/boost_168_build

Затем запустите его с установкой.

@--:/usr/local/boost_1_68_0$ ./b2 --show-libraries
The following libraries require building:
- atomic
- chrono
- container
- context
- contract
- coroutine
- date_time
- exception
- fiber
- filesystem
- graph
- graph_parallel
- iostreams
- locale
- log
- math
- mpi
- program_options
- python
- random
- regex
- serialization
- signals
- stacktrace
- system
- test
- thread
- timer
- type_erasure
- wave
@--:/usr/local/boost_1_68_0$ sudo ./b2 install

И я делаю проект cmake, создаю Cmakelist.

cmake_minimum_required(VERSION 3.12)
project(boost_context)

set(Boost_USE_STATIC_LIBS        OFF) # only find static libs
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)

set(CMAKE_CXX_STANDARD 11)

set (BOOST_ROOT
    "/usr/local/boost_1_68_0")
set (BOOST_LIBRARYDIR
    "/usr/local/boost_1_68_0/lib")

find_package( Boost REQUIRED COMPONENTS context fiber)
if(Boost_FOUND)
ADD_DEFINITIONS( "-DHAS_BOOST" )
message(STATUS ${Boost_INCLUDE_DIRS})
#    include_directories(${Boost_INCLUDE_DIRS})
message(STATUS ${Boost_LIBRARIES})
message(STATUS ${BOOST_LIBRARYDIR})
message(STATUS ${Boost_LIBRARIES})
message(STATUS ${Boost_LIBRARIES})
message(STATUS ${Boost_LIBRARIES})
endif()

add_executable(boost_context main.cpp)

Но когда я включаю Boost_USE_STATIC_LIBS cmake сообщит:

/clion-2018.2.5/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" 
/Other_Project/boost-context
CMake Error at /clion-2018.2.5/bin/cmake/linux/share/cmake-
3.12/Modules/FindBoost.cmake:2048 (message):
Unable to find the requested Boost libraries.

Boost version: 1.68.0

Boost include path: /usr/local/boost_168_build/include

Could not find the following static Boost libraries:

      boost_fiber

Some (but not all) of the required Boost libraries were found.  You may
need to install these additional Boost libraries.  Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or 
BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:15 (find_package)

Отключите Boost_USE_STATIC_LIBScmake сообщит:

/clion-2018.2.5/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Other_Project/boost-context
CMake Error at /clion-2018.2.5/bin/cmake/linux/share/cmake-3.12/Modules/FindBoost.cmake:2048 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.68.0

  Boost include path: /usr/local/boost_168_build/include

  Could not find the following Boost libraries:

          boost_fiber

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)

Наконец-то, вы знаете, что меня действительно смущает, почему я могу найти это ???

@--0:/usr/local/boost_168_build/include/boost/fiber$ pwd
/usr/local/boost_168_build/include/boost/fiber
@--0:/usr/local/boost_168_build/include/boost/fiber$ ls
algo                   condition_variable.hpp  fiber.hpp            hip             pooled_fixedsize_stack.hpp     scheduler.hpp
all.hpp                context.hpp             fixedsize_stack.hpp  mutex.hpp       properties.hpp                 segmented_stack.hpp
barrier.hpp            cuda                    fss.hpp              numa            protected_fixedsize_stack.hpp  timed_mutex.hpp
buffered_channel.hpp   detail                  future               operations.hpp  recursive_mutex.hpp            type.hpp
channel_op_status.hpp  exceptions.hpp          future.hpp           policy.hpp      recursive_timed_mutex.hpp      unbuffered_channel.hpp

Но в lib * нет ничего ни волокна, ни продолжения1025 *

@--0:/usr/local/boost_168_build/lib$ pwd
/usr/local/boost_168_build/lib
@--0:/usr/local/boost_168_build/lib$ ls
libboost_atomic.a              libboost_iostreams.so         libboost_numpy27.a                       libboost_stacktrace_backtrace.so.1.68.0
libboost_atomic.so             libboost_iostreams.so.1.68.0  libboost_numpy27.so                      libboost_stacktrace_basic.a
libboost_atomic.so.1.68.0      libboost_locale.a             libboost_numpy27.so.1.68.0               libboost_stacktrace_basic.so
libboost_chrono.a              libboost_locale.so            libboost_prg_exec_monitor.a              libboost_stacktrace_basic.so.1.68.0
libboost_chrono.so             libboost_locale.so.1.68.0     libboost_prg_exec_monitor.so             libboost_stacktrace_noop.a
libboost_chrono.so.1.68.0      libboost_log.a                libboost_prg_exec_monitor.so.1.68.0      libboost_stacktrace_noop.so
libboost_container.a           libboost_log_setup.a          libboost_program_options.a               libboost_stacktrace_noop.so.1.68.0
libboost_container.so          libboost_log_setup.so         libboost_program_options.so              libboost_system.a
libboost_container.so.1.68.0   libboost_log_setup.so.1.68.0  libboost_program_options.so.1.68.0       libboost_system.so
libboost_context.a             libboost_log.so               libboost_python27.a                      libboost_system.so.1.68.0
libboost_context.so            libboost_log.so.1.68.0        libboost_python27.so                     libboost_test_exec_monitor.a
libboost_context.so.1.68.0     libboost_math_c99.a           libboost_python27.so.1.68.0              libboost_thread.a
libboost_contract.a            libboost_math_c99f.a          libboost_random.a                        libboost_thread.so
libboost_contract.so           libboost_math_c99f.so         libboost_random.so                       libboost_thread.so.1.68.0
libboost_contract.so.1.68.0    libboost_math_c99f.so.1.68.0  libboost_random.so.1.68.0                libboost_timer.a
libboost_coroutine.a           libboost_math_c99l.a          libboost_regex.a                         libboost_timer.so
libboost_coroutine.so          libboost_math_c99l.so         libboost_regex.so                        libboost_timer.so.1.68.0
libboost_coroutine.so.1.68.0   libboost_math_c99l.so.1.68.0  libboost_regex.so.1.68.0                 libboost_type_erasure.a
libboost_date_time.a           libboost_math_c99.so          libboost_serialization.a                 libboost_type_erasure.so
libboost_date_time.so          libboost_math_c99.so.1.68.0   libboost_serialization.so                libboost_type_erasure.so.1.68.0
libboost_date_time.so.1.68.0   libboost_math_tr1.a           libboost_serialization.so.1.68.0         libboost_unit_test_framework.a
libboost_exception.a           libboost_math_tr1f.a          libboost_signals.a                       libboost_unit_test_framework.so
libboost_filesystem.a          libboost_math_tr1f.so         libboost_signals.so                      libboost_unit_test_framework.so.1.68.0
libboost_filesystem.so         libboost_math_tr1f.so.1.68.0  libboost_signals.so.1.68.0               libboost_wave.a
libboost_filesystem.so.1.68.0  libboost_math_tr1l.a          libboost_stacktrace_addr2line.a          libboost_wave.so
libboost_graph.a               libboost_math_tr1l.so         libboost_stacktrace_addr2line.so         libboost_wave.so.1.68.0
libboost_graph.so              libboost_math_tr1l.so.1.68.0  libboost_stacktrace_addr2line.so.1.68.0  libboost_wserialization.a
libboost_graph.so.1.68.0       libboost_math_tr1.so          libboost_stacktrace_backtrace.a          libboost_wserialization.so
libboost_iostreams.a           libboost_math_tr1.so.1.68.0   libboost_stacktrace_backtrace.so         libboost_wserialization.so.1.68.0

Может кто-нибудь сказать мне, где я пропустил.Спасибо

1 Ответ

0 голосов
/ 25 октября 2018

fiber - это библиотека только для заголовков, поэтому нет ничего для ссылки и нет необходимости добавлять ее в качестве компонента для поиска.

Список скомпилированных библиотек находится в doc: https://www.boost.org/doc/libs/1_68_0/more/getting_started/unix-variants.html#header-only-libraries

...