【发布时间】:2019-08-29 11:18:43
【问题描述】:
我目前正在尝试在 Mac 上的 virtualenv 中安装 PySift。但是,Zstandard 库在安装时会导致错误。
In file included from /usr/include/Availability.h:236:0,
from /usr/include/stdlib.h:61,
from zstd/lib/compress/fse_compress.c:38:
/usr/include/AvailabilityInternal.h:33:18: error: missing binary operator before token "("
#if __has_include(<AvailabilityInternalPrivate.h>)
^
In file included from /usr/include/stdlib.h:61:0,
from zstd/lib/compress/fse_compress.c:38:
/usr/include/Availability.h:497:18: error: missing binary operator before token "("
#if __has_include(<AvailabilityProhibitedInternal.h>)
^
error: command 'gcc' failed with exit status 1
我在 Stack Overflow 上看到的大多数解决方案通常建议运行 xcode-select --install,但它不起作用。或者,this post 建议使用以下命令
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
该命令将打开一个窗口,允许您安装缺少的 MacOS SDK。然而,它仍然没有奏效。在那之后,我意识到我还没有将 Xcode 更新到最新版本。但即使更新后,错误仍然出现。最后,我尝试使用brew,就像在this post 中一样,并进行一些更新,以防某些损坏的软件阻止安装完成。
我还检查了this post,但没有找到我的答案,因为我专门试图找出为什么__has_include 在( 之前会导致错误。
最后,它仍然没有工作。我想知道是否有人可以指出我错过了什么导致错误?
【问题讨论】:
-
__has_include是特定于 C++17 的 - 如果构建选项选择了较早的标准或者您使用的是较旧的编译器版本,则不会被识别。在日志中包含编译器命令行。