New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/usr/include no longer exists on macOS 10.14 #365
Comments
It is not clear how long this will continue to be provided by Apple but there is a fix for this (or at least I think it should work).
Try installing:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
(Clear as mud as far as obvious solutions go…)
|
Confirmed that fixes the problem (actually it works better than my workaround). I guess we'll have to revisit this once that package gets removed. |
Adding a note to myself to check this again now that #412 has merged. It's possible this problem has finally been fixed. |
On nixos global include directories do not exist either. This permits nixos to do things like have multiple major versions of dependencies simultaneously installed for different projects and switch versions around freely, however, it also causes problems when build scripts assume things like "the clang header and library files are this relative path from the LLVM header and library files." Since the build scripts make this assumption and I'm using nixos as my primary OS now (seriously, it's really great) is making my life developing this more difficult. |
Let's split nixos off into a separate issue, because macOS still does (as I understand it) have a global location for headers, it's just off in |
I got confirmation today that this has NOT been fixed by #412. So I guess Clang's auto-detect isn't smart enough. I do wonder how Apple's Clang manages to get it right though. |
This gets even better: in macOS Catalina 10.15, the package mentioned above doesn't exist at all, so there's no way to get
Based on this comment: https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15#comment103258053_58323411 But I sure am not upgrading to find out if it works. Edit: I can at least confirm that directory exists on macOS Mojave 10.14. But I can't really test if compilation with work with that fix because I installed the package above. |
Ok, the Some searching around seems to indicate the solution is to set |
export SDKROOT=`xcrun --show-sdk-path` works for me. |
export INCLUDE_PATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include Seemed to fix this for me on Catalina. |
I have a branch where I've been playing around with Github Actions, which uses Catalina. The line I've been using there is: https://github.com/elliottslaughter/terra/blob/github-actions/travis.sh#L148 Though it compiles, the resulting Terra is not fully functional and several tests fail. So there's more debugging to be done here if someone has time/energy to do it. |
This commit enables Terra to build and pass all tests on macOS Mojave without the installing the header package suggested in #365 (which does not exist in macOS Catalina anyway). Caveats: * It requires CMake. Make fails somewhere in the step where we run a Lua script to unpack the .a files. * It requires passing -DCMAKE_C_COMPILER=$(which CC), because apparently CMake tries to auto-detect the XCode installation, and LuaJIT can't build with that compiler. * It still requires setting INCLUDE_PATH="$(xcrun --sdk macosx --show-sdk-path)/usr/include". This may indicate we're still not getting all of the Clang initialization right. * It includes a workaround for LuaJIT/LuaJIT#575, which at the moment means we bump the deployment target to 10.7. Shouldn't matter for most users but if you want to use a LuaJIT 2.1 build from Git, this is now required.
This isn't fully fixed, but if you follow the set of caveats listed in #435 (namely, setting |
As of #481 Terra now supports Since this matches the behavior of Clang itself (see #479 (comment)), I'm going to consider this issue fixed. Edit: for posterity, a typical setting of export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" |
I confirmed as of #483 the workaround for the setting of So as of this comment, the ONLY setting that is required is export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" |
On macOS 10.14 with an updated copy of the Command Line Tools,
/usr/include
no longer appears to exist. This means that Terra fails to find basic headers likemath.h
. Terra relies on Clang for this functionality, but a generic (non-Apple) Clang build doesn't seem to be smart enough to find it, at least as of LLVM 7.A short-term workaround for this is to set
INCLUDE_PATH
to the location where headers are located. On my machine this is/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
.Hopefully in the longer term LLVM will be updated to be able to find the headers. Otherwise we'll have to find some way of locating them ourselves, and I can't think of any solution that isn't going to be very brittle. For example, running
/usr/bin/clang++ -E -x c - -v < /dev/null
prints the system search path, but I'm not sure we can depend on the output of this command being stable.The text was updated successfully, but these errors were encountered: