Clang8 on MacOS 10.14

[Please cc me, as I am not on this list.]

When installing the clang8 MacOS binary by
  wget <clang-binaries-tarball-url>
  tar -xf clang*
  cd clang*
  sudo mkdir /usr/local/clang8
  sudo cp -R * /usr/local/clang8
the compiler works on MacOS 10.13, but not on MacOS 10.14, with an error:
  /usr/local/clang/bin/../include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found
  #include_next <stdio.h>
              ^~~~~~~~~
The distribution does not seem to contain any other file stdio.h.

Hi Hans,

The distribution does not seem to contain any other file stdio.h.

You're going to need a normal copy of Xcode installed to provide the
system headers and libraries; and macOS has been moving away from
putting anything in /usr/include even with the command line tools.

So you probably need to add an extra sysroot argument to your clang
invocation, pointing it at the Xcode installation: -isysroot $(xcrun
--show-sdk-path macosx). Alternatively I believe you can set the
SDKROOT environment variable to that path, if adding CFLAGS is too
tricky. Build systems often detect all this for you (I know CMake
does).

Cheers.

Tim.

I am using autotools:

If setting, in ./configure, CXXFLAGS to contain that explicitly, which is
  -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/‘

then the configure script will not look into /usr/local/.

I can configure and compile by adding a soft link
sudo ln -s /usr/local /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/local

And then pass to configure the preprocessor argument
CPPFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/ -I /usr/local/include’

Exactly. Installing the command line tools on macOS 10.13 will create /usr/include, but not on 10.14. To get /usr/include on macOS 10.14 you need to install an extra package:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Have a look at: