Compilation on macOS does not work out of the box
During the BTTB8 tutorial on corryvreckan I tried installing it on my laptop and the compilation fails.
- Running macOS 10.14.4
- ROOT and Eigen3 installed through homebrew, the root setup script had been sourced.
- XCode has been installed and
xcode-select --install
has also been ran.
After running make install -j4
I get the error message:
In file included from /Users/cristovao/BTTB/corryvreckan/build2/src/objects/CorryvreckanObjectsDictionary.cxx:8:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stdio.h:108:15: fatal error:
'stdio.h' file not found
#include_next <stdio.h>
^~~~~~~~~
1 error generated.
The error seems to be related to apple's recent decision to deprecate /usr/include and the compiler is then unable to find the C headers. Sources of the bug seem a bit hard to understand because compiling simple programs seems to work without a problem. This points that something is probably being incorrectly identified in cmake and being propagated to make.
The last proposed solution from link seems to solve the issue. i.e. a successfull compilation is achieved by running
make install -j4 SDKROOT=`xcrun --show-sdk-path` MACOSX_DEPLOYMENT_TARGET=
The CI is using ninja as an alternative to make and this is likely why this issue has not been caught by the CI. I have not tested this point.
Other discussions on this issue, users report varying degrees of success with the different fixes, macOS 10.14, macOS 10.15