Reputation: 609
I am currently trying to install PySift inside a virtualenv on Mac. However, the Zstandard library results in an error when being installed.
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
Most of the solutions I've seen on Stack Overflow usually suggest running xcode-select --install
, but it did not work. Alternatively, this post suggests to use the following command
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
The command will open up a window that allows you to install the missing MacOS SDK. Yet, it still didn't work. After that, I realized I have not updated Xcode to the latest version. But even after updating, the error still appears. Lastly, I tried to use brew
, like in this post, and do some updating in case there was some corrupted software that prevented the installation to be completed.
I've also checked this post, and didn't find my answer because I was specifically trying to find out why __has_include
before (
resulted in an error.
In the end, it still did not work. I wonder if somebody can me point to what I was missing that caused the error?
Upvotes: 2
Views: 4863
Reputation: 35560
You are getting a syntax error from the preprocessor, b/c it doesn't recognize __has_include
as a valid function-like macro. That's because it is a c++17 specific directive.
You could work around by just removing that line (and the matching #endif) from the file. If you get a compiler error about a missing include, remove the #include line too.
Upvotes: 2