CMake无法通过brew找到boost_python lib(macOS) [英] CMake not finding boost_python lib with brew (macOS)

查看:123
本文介绍了CMake无法通过brew找到boost_python lib(macOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我快要疯了.出于某些奇怪的原因,我无法得到cmake来找到boost_python.我一直使用相同的CMakeList和相同的步骤在macOS上安装带有Boost-Python支持的Boost.在GNU/Linux和Windows上,我通常只是手动构建该库,并且运行良好.几个月前,通过发出以下命令,它在macOS上也运行良好:

I think I'm going crazy. For some weird reason, I cannot get cmake to find boost_python. I've always used the same CMakeList and the same steps for installing Boost with Boost-Python support on macOS. On GNU/Linux and Windows I usually just build the library manually and it works just fine. Several months ago it also just worked perfectly fine on macOS by issuing the following commands:

brew install python2 boost boost-python

(我专门使用python2而不是python3)

(I'm specifically using python2 and not python3)

我不知道是什么原因导致了这个问题,因为我以前从未遇到过……也许它无法从brew中找到boost-python库? (/usr/local/Cellar/boost-python/1.67.0/lib/).但是话又说回来,我再也不会为cmake或类似的东西更改搜索路径了.此CMakeList始终可以在Linux和macOS上运行.

I've no idea what's causing this issue because I've never had it before... perhaps it can't find the boost-python library from brew? (/usr/local/Cellar/boost-python/1.67.0/lib/). But then again, I never bothered with changing search paths for cmake or anything like that. This CMakeList always worked both under Linux and macOS.

我的CMakeList.txt

my CMakeList.txt

cmake_minimum_required(VERSION 3.6)
project(game-client)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}-std=c++1z -Wall -Wextra -Wno-unused-parameter -pthread")

# configure boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

find_package(Boost COMPONENTS filesystem system python REQUIRED)
if (NOT Boost_FOUND)
  MESSAGE(FATAL_ERROR "Could not find boost library")
endif ()

# configure python
find_package(PythonLibs 2.7 REQUIRED)
if (NOT PYTHONLIBS_FOUND)
  MESSAGE(FATAL_ERROR "Could not find python library")
endif ()

include_directories(${Boost_INCLUDE_DIRS})
include_directories(${PYTHON_INCLUDE_DIRS})

# configure preprocessor flags for internal classlogs
add_definitions(-DDUMP_GOOD_PACKETS)
# add_definitions(-DCLASSLOG)

set(SOURCE_FILES src/main.cpp src/Config.cpp include/Config.hpp     src/SequenceTable.cpp include/SequenceTable.hpp
        include/Singleton.hpp include/Logger.hpp src/NetworkStream.cpp include/NetworkStream.hpp
    include/packets/incoming/in.hpp include/packets/outcoming/out.hpp src/Buffer.cpp include/Buffer.hpp
    include/Packet.hpp src/PacketHandler.cpp include/PacketHandler.hpp src/Core.cpp
    include/Core.hpp src/Cipher.cpp include/Cipher.hpp src/KeyAgreement.cpp include/KeyAgreement.hpp
    src/AuthInput.cpp include/AuthInput.hpp src/MainInput.cpp include/MainInput.hpp include/PythonManager.hpp
    src/PythonManager.cpp include/PythonInstance.hpp src/PythonInstance.cpp include/packets/common/common.hpp
    src/Entity.cpp include/Entity.hpp include/Item.hpp src/Item.cpp src/Environment.cpp include/Environment.hpp)
add_executable(game-client ${SOURCE_FILES})
target_link_libraries(game-client ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}     cryptopp)

cmake输出:

memcpys-MBP:build memcpy$ cmake ..
-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ --     works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at     /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:2044     (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.67.0

  Boost include path: /usr/local/include

  Could not find the following static Boost libraries:

          boost_python

  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:10 (find_package)


CMake Error at CMakeLists.txt:12 (MESSAGE):
  Could not find boost library


-- Configuring incomplete, errors occurred!
See also "/Users/memcpy/git-repos/game-    client/build/CMakeFiles/CMakeOutput.log".

我使用注释中建议的以下选项运行cmake:

I run cmake with with following options as suggested in the comments:

cmake -DBoost_DEBUG=ON ..

-- The C compiler identification is Clang 6.0.0
-- The CXX compiler identification is Clang 6.0.0
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1121 ] _boost_TEST_VERSIONS = 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/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1123 ] Boost_USE_MULTITHREADED = ON
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1125 ] Boost_USE_STATIC_LIBS = ON
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1127 ] Boost_USE_STATIC_RUNTIME = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1129 ] Boost_ADDITIONAL_VERSIONS = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1131 ] Boost_NO_SYSTEM_PATHS = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1199 ] Declared as CMake or Environmental Variables:
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1201 ]   BOOST_ROOT = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1203 ]   BOOST_INCLUDEDIR = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1205 ]   BOOST_LIBRARYDIR = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1207 ] _boost_TEST_VERSIONS = 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/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1282 ] Include debugging info:
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1284 ]   _boost_INCLUDE_SEARCH_DIRS = PATHS;C:/boost/include;C:/boost;/sw/local/include
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1286 ]   _boost_PATH_SUFFIXES = boost-1_67_0;boost_1_67_0;boost/boost-1_67_0;boost/boost_1_67_0;boost-1_67;boost_1_67;boost/boost-1_67;boost/boost_1_67;boost-1_66_0;boost_1_66_0;boost/boost-1_66_0;boost/boost_1_66_0;boost-1_66;boost_1_66;boost/boost-1_66;boost/boost_1_66;boost-1_65_1;boost_1_65_1;boost/boost-1_65_1;boost/boost_1_65_1;boost-1_65_0;boost_1_65_0;boost/boost-1_65_0;boost/boost_1_65_0;boost-1_65;boost_1_65;boost/boost-1_65;boost/boost_1_65;boost-1_64_0;boost_1_64_0;boost/boost-1_64_0;boost/boost_1_64_0;boost-1_64;boost_1_64;boost/boost-1_64;boost/boost_1_64;boost-1_63_0;boost_1_63_0;boost/boost-1_63_0;boost/boost_1_63_0;boost-1_63;boost_1_63;boost/boost-1_63;boost/boost_1_63;boost-1_62_0;boost_1_62_0;boost/boost-1_62_0;boost/boost_1_62_0;boost-1_62;boost_1_62;boost/boost-1_62;boost/boost_1_62;boost-1_61_0;boost_1_61_0;boost/boost-1_61_0;boost/boost_1_61_0;boost-1_61;boost_1_61;boost/boost-1_61;boost/boost_1_61;boost-1_60_0;boost_1_60_0;boost/boost-1_60_0;boost/boost_1_60_0;boost-1_60;boost_1_60;boost/boost-1_60;boost/boost_1_60;boost-1_59_0;boost_1_59_0;boost/boost-1_59_0;boost/boost_1_59_0;boost-1_59;boost_1_59;boost/boost-1_59;boost/boost_1_59;boost-1_58_0;boost_1_58_0;boost/boost-1_58_0;boost/boost_1_58_0;boost-1_58;boost_1_58;boost/boost-1_58;boost/boost_1_58;boost-1_57_0;boost_1_57_0;boost/boost-1_57_0;boost/boost_1_57_0;boost-1_57;boost_1_57;boost/boost-1_57;boost/boost_1_57;boost-1_56_0;boost_1_56_0;boost/boost-1_56_0;boost/boost_1_56_0;boost-1_56;boost_1_56;boost/boost-1_56;boost/boost_1_56;boost-1_55_0;boost_1_55_0;boost/boost-1_55_0;boost/boost_1_55_0;boost-1_55;boost_1_55;boost/boost-1_55;boost/boost_1_55;boost-1_54_0;boost_1_54_0;boost/boost-1_54_0;boost/boost_1_54_0;boost-1_54;boost_1_54;boost/boost-1_54;boost/boost_1_54;boost-1_53_0;boost_1_53_0;boost/boost-1_53_0;boost/boost_1_53_0;boost-1_53;boost_1_53;boost/boost-1_53;boost/boost_1_53;boost-1_52_0;boost_1_52_0;boost/boost-1_52_0;boost/boost_1_52_0;boost-1_52;boost_1_52;boost/boost-1_52;boost/boost_1_52;boost-1_51_0;boost_1_51_0;boost/boost-1_51_0;boost/boost_1_51_0;boost-1_51;boost_1_51;boost/boost-1_51;boost/boost_1_51;boost-1_50_0;boost_1_50_0;boost/boost-1_50_0;boost/boost_1_50_0;boost-1_50;boost_1_50;boost/boost-1_50;boost/boost_1_50;boost-1_49_0;boost_1_49_0;boost/boost-1_49_0;boost/boost_1_49_0;boost-1_49;boost_1_49;boost/boost-1_49;boost/boost_1_49;boost-1_48_0;boost_1_48_0;boost/boost-1_48_0;boost/boost_1_48_0;boost-1_48;boost_1_48;boost/boost-1_48;boost/boost_1_48;boost-1_47_0;boost_1_47_0;boost/boost-1_47_0;boost/boost_1_47_0;boost-1_47;boost_1_47;boost/boost-1_47;boost/boost_1_47;boost-1_46_1;boost_1_46_1;boost/boost-1_46_1;boost/boost_1_46_1;boost-1_46_0;boost_1_46_0;boost/boost-1_46_0;boost/boost_1_46_0;boost-1_46;boost_1_46;boost/boost-1_46;boost/boost_1_46;boost-1_45_0;boost_1_45_0;boost/boost-1_45_0;boost/boost_1_45_0;boost-1_45;boost_1_45;boost/boost-1_45;boost/boost_1_45;boost-1_44_0;boost_1_44_0;boost/boost-1_44_0;boost/boost_1_44_0;boost-1_44;boost_1_44;boost/boost-1_44;boost/boost_1_44;boost-1_43_0;boost_1_43_0;boost/boost-1_43_0;boost/boost_1_43_0;boost-1_43;boost_1_43;boost/boost-1_43;boost/boost_1_43;boost-1_42_0;boost_1_42_0;boost/boost-1_42_0;boost/boost_1_42_0;boost-1_42;boost_1_42;boost/boost-1_42;boost/boost_1_42;boost-1_41_0;boost_1_41_0;boost/boost-1_41_0;boost/boost_1_41_0;boost-1_41;boost_1_41;boost/boost-1_41;boost/boost_1_41;boost-1_40_0;boost_1_40_0;boost/boost-1_40_0;boost/boost_1_40_0;boost-1_40;boost_1_40;boost/boost-1_40;boost/boost_1_40;boost-1_39_0;boost_1_39_0;boost/boost-1_39_0;boost/boost_1_39_0;boost-1_39;boost_1_39;boost/boost-1_39;boost/boost_1_39;boost-1_38_0;boost_1_38_0;boost/boost-1_38_0;boost/boost_1_38_0;boost-1_38;boost_1_38;boost/boost-1_38;boost/boost_1_38;boost-1_37_0;boost_1_37_0;boost/boost-1_37_0;boost/boost_1_37_0;boost-1_37;boost_1_37;boost/boost-1_37;boost/boost_1_37;boost-1_36_1;boost_1_36_1;boost/boost-1_36_1;boost/boost_1_36_1;boost-1_36_0;boost_1_36_0;boost/boost-1_36_0;boost/boost_1_36_0;boost-1_36;boost_1_36;boost/boost-1_36;boost/boost_1_36;boost-1_35_1;boost_1_35_1;boost/boost-1_35_1;boost/boost_1_35_1;boost-1_35_0;boost_1_35_0;boost/boost-1_35_0;boost/boost_1_35_0;boost-1_35;boost_1_35;boost/boost-1_35;boost/boost_1_35;boost-1_34_1;boost_1_34_1;boost/boost-1_34_1;boost/boost_1_34_1;boost-1_34_0;boost_1_34_0;boost/boost-1_34_0;boost/boost_1_34_0;boost-1_34;boost_1_34;boost/boost-1_34;boost/boost_1_34;boost-1_33_1;boost_1_33_1;boost/boost-1_33_1;boost/boost_1_33_1;boost-1_33_0;boost_1_33_0;boost/boost-1_33_0;boost/boost_1_33_0;boost-1_33;boost_1_33;boost/boost-1_33;boost/boost_1_33
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1306 ] location of version.hpp: /usr/local/include/boost/version.hpp
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1330 ] version.hpp reveals boost 1.67.0
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1416 ] guessed _boost_COMPILER = 
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1426 ] _boost_MULTITHREADED = -mt
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1502 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1504 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1567 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG   = /usr/local/include/lib;/usr/local/include/../lib;/usr/local/include/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1756 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mt-1_67;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1809 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mt-d-1_67;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1756 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-mt-1_67;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1809 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-mt-d-1_67;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1756 ] Searching for PYTHON_LIBRARY_RELEASE: boost_python-mt-1_67;boost_python-mt;boost_python
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_RELEASE = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1809 ] Searching for PYTHON_LIBRARY_DEBUG: boost_python-mt-d-1_67;boost_python-mt-d;boost_python-mt;boost_python
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:400 ]  Boost_LIBRARY_DIR_DEBUG = /usr/local/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = /usr/local/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
-- [ /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:1883 ] Boost_FOUND = 1
CMake Error at /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindBoost.cmake:2044 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.67.0

  Boost include path: /usr/local/include

  Could not find the following static Boost libraries:

          boost_python

  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:10 (find_package)


CMake Error at CMakeLists.txt:12 (MESSAGE):
  Could not find boost library


-- Configuring incomplete, errors occurred!
See also "/Users/memcpy/git-repos/game-client/build/CMakeFiles/CMakeOutput.log".

推荐答案

@Tsyvarev这样.我需要将组件更改为"python27".这种行为肯定会随着时间而改变.我不记得必须在Boost Release> = 1.65< = 1.67时执行此操作.谢谢.

@Tsyvarev this. I needed to change the COMPONENTS as "python27". This behavior definitely changed over the time. I don't remember having to do this at boost release >= 1.65 <= 1.67. Thanks.

这篇关于CMake无法通过brew找到boost_python lib(macOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆