mason
mason copied to clipboard
[[llvm] Clearly document the OS X requirement for full XCode installation
The llvm/clang++ compiler used and provided by mason needs a full XCode installation available. Otherwise you'll hit a warning like:
clang-5.0: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
And an error when the program tries to use something from the C standard library. For example:
fatal error: 'stdlib.h' file not found
#include <stdlib.h>
^~~~~~~~~~
1 error generated.
But this error will depend on what of the C standard library is being requested.
The way to solve this is for OS X users to install a full version of XCode.
This reliance on a full version of XCode is due to this line in our compiler config: https://github.com/mapbox/mason/blob/6aa9591a336ac71bfa1974185b6ee784a9b6033a/scripts/llvm/base/common.sh#L230. It is possible we could try to get this working against the Command line tools install of C headers as well, but this is not something I've tried.
Or, we could try to get the default build of LLVM changed such that it does work with the command line tools.
Debugging locally with @millzpaugh and @allieoop we found that clang++ v5.0.1 from mason could be made to work without XCode (and only the "command line tools" install) by passing:
-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ -I/Library/Developer/CommandLineTools//usr/include/c++/v1/