1

我正在尝试在我的 OS X 10.10.5 上编译VRPN库。

我使用 :设置了cmake 配置ccmake ../vrpn。当我尝试配置项目时,出现以下错误:

CMake Error at /usr/local/Cellar/cmake/3.4.0/share/cmake/Modules/Platform/Darwin.cmake:76 (message):
   CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT:
    ""
   is not set to a MacOSX SDK with a recognized version.  Either set
   CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
   empty.
Call Stack (most recent call first):
   /usr/local/Cellar/cmake/3.4.0/share/cmake/Modules/CMakeSystemSpecificInformation.cmake:36 (include)
   CMakeLists.txt:3 (project)

CMake Error: Internal CMake error, TryCompile configure of cmake failed

最终 CMake 错误,cmake 的 TryCompile 配置失败

我在配置中看到了变量:

CMAKE_OSX_DEPLOYMENT_TARGET      10.10

尝试再次配置项目时,我收到以下消息以及上一个错误:

CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but the matching SDK does not exist
   at:
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk"

Instead using SDK:
 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk".

显然,问题在于默认的 cmake 配置设置了错误的 SDK 版本。

我将版本更改为10.11

CMAKE_OSX_DEPLOYMENT_TARGET      10.11

CMAKE_OSX_SYSROOT根据需要设置:

CMAKE_OSX_SYSROOT    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk

配置很好,但随后出现以下错误:

Could NOT find Threads (missing: Threads_FOUND)

令我惊讶的是,在另一个 CMakeLists.txt 上,我尝试获取 Threads 库并且 cmake 执行很好:

cmake_minimum_required (VERSION 3.4) 
find_package(Threads REQUIRED)

我认为问题在于自定义CMAKE_OSX_SYSROOT并使CMAKE_OSX_DEPLOYMENT_TARGETThreads 包无法找到。但是每次我尝试从配置中删除CMAKE_OSX_DEPLOYMENT_TARGETand时,我都会收到第一条错误消息,并且会重置为.CMAKE_OSX_SYSROOTccmakeCMAKE_OSX_DEPLOYMENT_TARGET10.10

你有任何信息/测试可以尝试解决这个问题吗?

4

1 回答 1

1

将 Xcode 更新到 8.1 并安装命令行工具为我解决了这个问题

xcode-select --install
于 2016-12-09T10:51:22.923 回答