Error compiling ROOT and Pythia8 from source (M1 Mac)

Hello, I am a beginner when it comes to using the terminal and unix, and I am trying to compile Root from source with Pythia8.

I believe that I have downloaded pythia and root as well as added the various important directories to my $PATH, but I get an error at 75% when I type the command “make -j4”
For context, I am using an M1 mac and am installing ROOT 6.28.00 and Pythia8309
I have XCode installed
here is the error I am getting, it is quite long, and I am unsure which aspects are important.
Let me know if you have any ideas of what I can try. Thank you :slight_smile:

[ 75%] **Generating G__Core.cxx, ../lib/Core.pcm**

[ 75%] Built target MetaCling

While building module 'Core':

While building module 'std' imported from input_line_1:1:

While building module 'Darwin' imported from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ctype.h:38:

In file included from <module-includes>:1430:

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/ncurses.h:141:

**/Users/jake/opt/anaconda3/include/unctrl.h:61:38:** **error:** **cannot initialize a variable of type 'char *' with an lvalue of type 'char *(chtype)' (aka 'char *(unsigned int)')**

NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);

**^ ~~~~~~**

**/Users/jake/opt/anaconda3/include/unctrl.h:61:61:** **error:** **expected ';' after top level declarator**

NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);

**^**

While building module 'Core':

While building module 'std' imported from input_line_1:1:

In file included from <module-includes>:2:

**/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ctype.h:38:15:** **fatal error:** **could not build module 'Darwin'**

#include_next <ctype.h>

**~~~~~~~~~~~~~^**

**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/jake/progs/ROOT/root-build/etc/cling/Interpreter/RuntimeUniverse.h:27:

In file included from <module-includes>:1:

**/Users/jake/progs/ROOT/root-build/etc/cling/Interpreter/DynamicExprInfo.h:13:10:** **fatal error:** **could not build module 'std'**

#include <string>

**~~~~~~~~^**

**/Users/jake/progs/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 '_Builtin_intrinsics':

In file included from <module-includes>:2:

In file included from /Users/jake/progs/ROOT/root-build/etc/cling/lib/clang/13.0.0/include/immintrin.h:22:

In file included from /Users/jake/progs/ROOT/root-build/etc/cling/lib/clang/13.0.0/include/xmmintrin.h:27:

In file included from /Users/jake/progs/ROOT/root-build/etc/cling/lib/clang/13.0.0/include/mm_malloc.h:13:

In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stdlib.h:93:

**/Users/jake/progs/ROOT/root-build/etc/cling/lib/clang/13.0.0/include/stdlib.h:8:15:** **fatal error:** **could not build module 'Darwin'**

#include_next <stdlib.h>

**~~~~~~~~~~~~~^**

While building module 'Core':

<<< cling interactive line includer >>>: **fatal error:** **could not build module '_Builtin_intrinsics'**

Error: Module '_Builtin_intrinsics' failed to load.

While building module 'Core':

While building module 'ROOT_Rtypes' imported from /Users/jake/progs/ROOT/root-build/include/Rtypes.h:23:

In file included from <module-includes>:1:

In file included from /Users/jake/progs/ROOT/root-build/include/RtypesCore.h:23:

**/Users/jake/progs/ROOT/root-build/include/ROOT/RConfig.hxx:279:13:** **fatal error:** **could not build module 'Darwin'**

# include <AvailabilityMacros.h>

**~~~~~~~~^**

While building module 'Core':

While building module 'ROOT_Rtypes' imported from /Users/jake/progs/ROOT/root-build/include/Rtypes.h:23:

While building module 'ROOT_Config' imported from /Users/jake/progs/ROOT/root-build/include/RtypesCore.h:25:

In file included from <module-includes>:1:

In file included from /Users/jake/progs/ROOT/root-build/include/RConfig.h:23:

**/Users/jake/progs/ROOT/root-build/include/ROOT/RConfig.hxx:279:13:** **fatal error:** **could not build module 'Darwin'**

# include <AvailabilityMacros.h>

**~~~~~~~~^**

While building module 'Core':

While building module 'ROOT_Foundation_C' imported from /Users/jake/progs/ROOT/root-build/include/Rtypes.h:29:

In file included from <module-includes>:1:

In file included from /Users/jake/progs/ROOT/root-build/include/ThreadLocalStorage.h:57:

**/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/stddef.h:45:15:** **fatal error:** **could not build module 'Darwin'**

#include_next <stddef.h>

**~~~~~~~~~~~~~^**

While building module 'Core':

While building module 'ROOT_Foundation_Stage1_NoRTTI' imported from /Users/jake/progs/ROOT/root-build/include/Rtypes.h:195:

In file included from <module-includes>:2:

**/Users/jake/progs/ROOT/root-build/include/ROOT/RStringView.hxx:25:10:** **fatal error:** **could not build module 'std'**

#include <string_view>

**~~~~~~~~^**

Error: Error loading the default rootcling header files.

core/CMakeFiles/G__Core.dir/build.make:473: recipe for target 'core/G__Core.cxx' failed

make[2]: *** [core/G__Core.cxx] Error 1

make[2]: Target 'core/CMakeFiles/G__Core.dir/depend' not remade because of errors.

CMakeFiles/Makefile2:31177: recipe for target 'core/CMakeFiles/G__Core.dir/all' failed

make[1]: *** [core/CMakeFiles/G__Core.dir/all] Error 2

-- clad build command succeeded. See also /Users/jake/progs/ROOT/root-build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-build-*.log

[ 75%] **Performing install step for 'clad'**

-- clad install command succeeded. See also /Users/jake/progs/ROOT/root-build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-install-*.log

[ 75%] **Completed 'clad'**

[ 75%] Built target clad

[ 75%] **Linking CXX shared library ../../../lib/libCling.so**

[ 75%] Built target Cling

make[1]: Target 'all' not remade because of errors.

Makefile:155: recipe for target 'all' failed

make: *** [all] Error 2

make: Target 'default_target' not remade because of errors.

I wanted to add that I have been able to download a precompiled version of root from the cern website, but I would like to be able to run root and pithia inline together, so I think I would need to compile from source for that?

I have solved the issue. I added the -Druntime_cxxmodules=OFF flag to my cmake command to build so it ended up looking like:

cmake -DCMAKE_INSTALL_PREFIX=$HOME/progs/ROOT/root-install -DPYTHIA8_DIR=$PYTHIA8 -DPYTHIA8_INCLUDE_DIR=$PYTHIA8_INC -DPYTHIA8_LIBRARY=$PYTHIA8_LIB/libpythia8.a -Dbuiltin_glew=ON -DPythia8=ON -Druntime_cxxmodules=OFF -Dxroot=ON -DCMAKE_SYSTEM_PROCESSOR=arm64 ../root-sources 

then I ran make -j4 and it worked.
I found this solution from this previous thread.

1 Like