ROOT build fails on Monterey

Tried to build and install the latest version of root. Here are the commands I used.

git clone --branch latest-stable --depth=1 https://github.com/root-project/root.git root_src
mkdir root_build root_install && cd root_build
cmake -DCMAKE_INSTALL_PREFIX=../root_install ../root_src 
cmake --build . -- install -j4

Here are the errors that I get:

[ 76%] Linking CXX executable src/rootcling_stage1
[ 76%] Built target clad
[ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingTypeInfo.cxx.o
[ 76%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingValue.cxx.o
[ 76%] Built target rootcling_stage1
[ 76%] Generating G__Core.cxx, ../lib/Core.pcm
While building module 'Core':
While building module 'std' imported from input_line_1:1:
In file included from <module-includes>:31:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/complex.h:28:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ccomplex:20:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/complex:245:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:321:9: error: missing '#include "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h"'; declaration of 'signbit' must be imported from module 'std.depr.math_h' before it is
      required
using ::signbit;
        ^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h:329:1: note: previous declaration is here
signbit(_A1 __lcpp_x) _NOEXCEPT
^
[ 76%] Built target MetaCling
Scanning dependencies of target Cling
[ 76%] Linking CXX shared library ../../../lib/libCling.so
input_line_1:1:10: fatal error: could not build module 'std'
#include <new>
 ~~~~~~~~^
Warning in cling::IncrementalParser::CheckABICompatibility():
  Failed to extract C++ standard library version.
Warning in cling::IncrementalParser::CheckABICompatibility():
  Possible C++ standard library mismatch, compiled with _LIBCPP_ABI_VERSION '1'
  Extraction of runtime standard library version was: ''
While building module 'Core':
While building module 'Cling_Runtime' imported from input_line_2:1:
While building module 'Cling_Runtime_Extra' imported from /Users/aregjan/root/root_build/etc/cling/Interpreter/RuntimeUniverse.h:27:
In file included from <module-includes>:1:
/Users/aregjan/root/root_build/etc/cling/Interpreter/DynamicExprInfo.h:13:10: fatal error: could not build module 'std'
#include <string>
 ~~~~~~~~^
/Users/aregjan/root/root_build/etc/cling/Interpreter/RuntimeUniverse.h:27:10: fatal error: could not build module 'Cling_Runtime_Extra'
#include "cling/Interpreter/Visibility.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While building module 'Core':
While building module 'ROOT_Rtypes' imported from /Users/aregjan/root/root_build/include/Rtypes.h:23:
In file included from <module-includes>:1:
/Users/aregjan/root/root_build/include/RtypesCore.h:28:10: fatal error: could not build module 'std'
#include <cstddef> // size_t, NULL
 ~~~~~~~~^
In file included from input_line_3:2:
/Users/aregjan/root/root_build/include/Rtypes.h:23:10: fatal error: could not build module 'ROOT_Rtypes'
#include "RtypesCore.h"
 ~~~~~~~~^~~~~~~~~~~~~~
While building module 'Core':
While building module 'ROOT_Foundation_C' imported from /Users/aregjan/root/root_build/include/Rtypes.h:29:
In file included from <module-includes>:1:
/Users/aregjan/root/root_build/include/ThreadLocalStorage.h:60:10: fatal error: could not build module 'ROOT_Rtypes'
#include "RtypesCore.h"
 ~~~~~~~~^~~~~~~~~~~~~~
While building module 'Core':
While building module 'ROOT_Foundation_Stage1_NoRTTI' imported from /Users/aregjan/root/root_build/include/Rtypes.h:195:
In file included from <module-includes>:2:
/Users/aregjan/root/root_build/include/ROOT/RStringView.hxx:25:10: fatal error: could not build module 'std'
#include <string_view>
 ~~~~~~~~^
[ 76%] Built target Cling
Error: Error loading the default rootcling header files.
make[2]: *** [core/G__Core.cxx] Error 1
make[1]: *** [core/CMakeFiles/G__Core.dir/all] Error 2
make: *** [all] Error 2


Please read tips for efficient and successful posting and posting code

ROOT Version: the latest stable
Platform: Mac OS X Monterey 12.1
Compiler: not sure how to get it?


Do you want to build with Xcode or just the command line tools? What does clang --version say?

Just the command line tools.

>clang --version
Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Hmm that’s a clang version I cannot find anywhere… Can you try to update it, please?

Looking through clang documentation it looks like my clang is just one version behind (clang 14 is current, and came out just in March).

The problem is actually quite a bit broader. I build root back in April and it worked totally fine, until two days ago, when it started throwing crazy errors when I try to load (see here for more detail). The problems listed in the main post happened when I gave up trying to fix root and just tried to build the most recent version…

Ok, there’s some progress. I ran a system update, which updated clang from 13.0 to 13.1.6. It is now able to build the Core module.

The error that now I am getting is python related:

[ 79%] Built target cppyy3_8
[ 79%] Building CXX object bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy2_7.dir/src/CallContext.cxx.o
In file included from /Users/aregjan/root/root_src/bindings/pyroot/cppyy/CPyCppyy/src/API.cxx:2:
/Users/aregjan/root/root_src/bindings/pyroot/cppyy/CPyCppyy/src/CPyCppyy.h:35:10: fatal error: 'Python.h' file not found
#include "Python.h"
         ^~~~~~~~~~
In file included from /Users/aregjan/root/root_src/bindings/pyroot/cppyy/CPyCppyy/src/CallContext.cxx:2:
/Users/aregjan/root/root_src/bindings/pyroot/cppyy/CPyCppyy/src/CPyCppyy.h:35:10: fatal error: 'Python.h' file not found
#include "Python.h"
         ^~~~~~~~~~
1 error generated.
make[2]: *** [bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy2_7.dir/src/CallContext.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 79%] Generating G__RIO.cxx, ../../lib/RIO.pcm
1 error generated.
make[2]: *** [bindings/jupyroot/CMakeFiles/JupyROOT2_7.dir/src/IOHandler.cxx.o] Error 1
make[1]: *** [bindings/jupyroot/CMakeFiles/JupyROOT2_7.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
1 error generated.
make[2]: *** [bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy2_7.dir/src/API.cxx.o] Error 1
make[1]: *** [bindings/pyroot/cppyy/CPyCppyy/CMakeFiles/cppyy2_7.dir/all] Error 2
[ 79%] Linking CXX executable ../bin/root.exe
[ 79%] Built target root.exe
Scanning dependencies of target G__RIO
[ 79%] Building CXX object io/io/CMakeFiles/G__RIO.dir/G__RIO.cxx.o
[ 79%] Built target G__RIO
make: *** [all] Error 2

Hopefully a simpler problem to troubleshoot?

I think the full XCode is required, not only the commandlinetools.

Install XCode in App store, open XCode and it will ask you to install some components. Install them, and then come back to compile.

Ok, problem solved. To summarize for users out there in the future:

  • the real fix was the update to the command line tools (via a system update), which among other things updated clang v13 to v13.1.6
  • the problems I had after that were only due to me not re-running
cmake -DCMAKE_INSTALL_PREFIX=../root_install ../root_src 

I re-ran that, and re-did

cmake --build . -- install -j4

and voila, the build succeeded and root is working fine now. To be clear - this is root version 6.26/04.

Thank you all for your help.

Areg

1 Like

That’s incorrect. ROOT can be built with either command line tools or Xcode.