Я хочу использовать библиотеку boost в cmake на рабочей станции Fedora.
Я установил все зависимости с помощью: sudo dnf install git clang make cmake flex bison boost-devel llvm-devel
. После этого шага будет много файлов /usr/lib64/libboost-*.so
, а файлов /usr/lib/libboost-*.so
.
Вот часть моего CMakeLists.txt
:
set(Boost_DEBUG ON)
set(Boost_DETAILED_FAILURE_MSG ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_DEBUG_LIBS OFF)
set(Boost_USE_RELEASE_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS program_options system filesystem REQUIRED)
Вот сообщение об ошибке:
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1487 ] _boost_TEST_VERSIONS = "1.73.0;1.73;1.72.0;1.72;1.71.0;1.71;1.70.0;1.70;1.69.0;1.69;1.68.0;1.68;1.67.0;1.67;1.66.0;1.66;1.65.1;1.65.0;1.65;1.64.0;1.64;1.63.0;1.63;1.62.0;1.62;1.61.0;1.61;1.60.0;1.60;1.59.0;1.59;1.58.0;1.58;1.57.0;1.57;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1488 ] Boost_USE_MULTITHREADED = "ON"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1489 ] Boost_USE_STATIC_LIBS = "ON"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1490 ] Boost_USE_STATIC_RUNTIME = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1491 ] Boost_ADDITIONAL_VERSIONS = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1492 ] Boost_NO_SYSTEM_PATHS = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1524 ] BOOST_ROOT = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1525 ] ENV{BOOST_ROOT} = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1526 ] BOOST_INCLUDEDIR = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1527 ] ENV{BOOST_INCLUDEDIR} = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1528 ] BOOST_LIBRARYDIR = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1529 ] ENV{BOOST_LIBRARYDIR} = <unset>
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1617 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1657 ] Boost_VERSION = "106900"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1658 ] Boost_VERSION_STRING = "1.69.0"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1659 ] Boost_VERSION_MACRO = "106900"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1660 ] Boost_VERSION_MAJOR = "1"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1661 ] Boost_VERSION_MINOR = "69"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1662 ] Boost_VERSION_PATCH = "0"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1663 ] Boost_VERSION_COUNT = "3"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1680 ] Boost_LIB_PREFIX = ""
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1681 ] Boost_NAMESPACE = "boost"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:797 ] _boost_COMPILER = "-gcc10" (guessed)
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1717 ] _boost_MULTITHREADED = "-mt"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1794 ] _boost_ARCHITECTURE_TAG = "" (detected)
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1798 ] _boost_RELEASE_ABI_TAG = "-"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1799 ] _boost_DEBUG_ABI_TAG = "-d"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1859 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = "/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:1860 ] _boost_LIBRARY_SEARCH_DIRS_DEBUG = "/usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib"
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2045 ] Searching for PROGRAM_OPTIONS_LIBRARY_RELEASE: boost_program_options-gcc10-mt-1_69;boost_program_options-gcc10-mt;boost_program_options-gcc10-mt;boost_program_options-mt-1_69;boost_program_options-mt;boost_program_options-mt;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2100 ] Searching for PROGRAM_OPTIONS_LIBRARY_DEBUG: boost_program_options-gcc10-mt-d-1_69;boost_program_options-gcc10-mt-d;boost_program_options-gcc10-mt-d;boost_program_options-mt-d-1_69;boost_program_options-mt-d;boost_program_options-mt-d;boost_program_options-mt;boost_program_options
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2045 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc10-mt-1_69;boost_system-gcc10-mt;boost_system-gcc10-mt;boost_system-mt-1_69;boost_system-mt;boost_system-mt;boost_system-mt;boost_system
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2100 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc10-mt-d-1_69;boost_system-gcc10-mt-d;boost_system-gcc10-mt-d;boost_system-mt-d-1_69;boost_system-mt-d;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2045 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc10-mt-1_69;boost_filesystem-gcc10-mt;boost_filesystem-gcc10-mt;boost_filesystem-mt-1_69;boost_filesystem-mt;boost_filesystem-mt;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake/Modules/FindBoost.cmake:2100 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc10-mt-d-1_69;boost_filesystem-gcc10-mt-d;boost_filesystem-gcc10-mt-d;boost_filesystem-mt-d-1_69;boost_filesystem-mt-d;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Boost (missing: program_options system filesystem) (found
version "1.69.0")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake/Modules/FindBoost.cmake:2166 (find_package_handle_standard_args)
src/CMakeLists.txt:48 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/linrongbin/shepherd/debug/CMakeFiles/CMakeOutput.log".
See also "/home/linrongbin/shepherd/debug/CMakeFiles/CMakeError.log".
gmake: *** No targets specified and no makefile found. Stop.
Я обнаружил, что в моем CMakeLists.txt есть 2 проблемы:
cmake не обнаруживает /usr/lib64
как каталог библиотеки boost. Я пробовал использовать export BOOST_LIBRARYDIR=/usr/lib64
в ~/.bashrc
. Эта проблема, кажется, исправлена.
В /usr/lib64
есть libboost_program_options.so
и libboost_program_options.so.1.69.0
, но нет файлов библиотеки stati c boost. Я хочу связать файлы библиотеки stati c boost, как и libboost_program_options.a
. Но я не могу найти файлов .a
.
Как мне настроить cmake, чтобы find_package работал правильно?