Issue compiling ROOT master from source on Mac OS Mojave

Hi experts,
I checked out ROOT master an run the baseline cmake setup
Compilation abort with this

/Users/lpnhe/root/core/base/inc/TStorage.h:148:1: error: unknown type name 'R__EXTERN'
R__EXTERN FreeIfTMapFile_t *gFreeIfTMapFile;
^
/Users/lpnhe/root/core/base/inc/TStorage.h:148:27: error: expected ';' after top level declarator
R__EXTERN FreeIfTMapFile_t *gFreeIfTMapFile;
                          ^
                          ;
/Users/lpnhe/root/core/base/inc/TStorage.h:149:1: error: unknown type name 'R__EXTERN'
R__EXTERN void *gMmallocDesc;
^
/Users/lpnhe/root/core/base/inc/TStorage.h:149:11: error: expected unqualified-id
R__EXTERN void *gMmallocDesc;
          ^
In file included from /Users/lpnhe/root/core/base/src/TApplication.cxx:23:
In file included from /Users/lpnhe/root/core/base/inc/TApplication.h:30:
In file included from /Users/lpnhe/root/core/base/inc/TQObject.h:40:
In file included from /usr/local/include/TList.h:25:
In file included from /usr/local/include/TSeqCollection.h:25:
In file included from /usr/local/include/TCollection.h:31:
In file included from /usr/local/include/TVirtualRWMutex.h:26:
/usr/local/include/TVirtualMutex.h:32:1: error: unknown type name 'R__EXTERN'
R__EXTERN TVirtualMutex *gGlobalMutex;
^
/usr/local/include/TVirtualMutex.h:32:24: error: expected ';' after top level declarator
R__EXTERN TVirtualMutex *gGlobalMutex;
                       ^
                       ;
In file included from /Users/lpnhe/root/core/base/src/TApplication.cxx:23:
In file included from /Users/lpnhe/root/core/base/inc/TApplication.h:30:
In file included from /Users/lpnhe/root/core/base/inc/TQObject.h:40:
In file included from /usr/local/include/TList.h:25:
In file included from /usr/local/include/TSeqCollection.h:25:
In file included from /usr/local/include/TCollection.h:31:
/usr/local/include/TVirtualRWMutex.h:36:1: error: unknown type name 'R__EXTERN'
R__EXTERN TVirtualRWMutex *gCoreMutex;
^
/usr/local/include/TVirtualRWMutex.h:36:26: error: expected ';' after top level declarator
R__EXTERN TVirtualRWMutex *gCoreMutex;
                         ^
                         ;
In file included from /Users/lpnhe/root/core/base/src/TApplication.cxx:23:
In file included from /Users/lpnhe/root/core/base/inc/TApplication.h:30:
In file included from /Users/lpnhe/root/core/base/inc/TQObject.h:40:
In file included from /usr/local/include/TList.h:25:
In file included from /usr/local/include/TSeqCollection.h:25:
/usr/local/include/TCollection.h:43:1: error: unknown type name 'R__EXTERN'
R__EXTERN TVirtualMutex *gCollectionMutex;
^
/usr/local/include/TCollection.h:43:24: error: expected ';' after top level declarator
R__EXTERN TVirtualMutex *gCollectionMutex;
                       ^
                       ;
In file included from /Users/lpnhe/root/core/base/src/TApplication.cxx:23:
In file included from /Users/lpnhe/root/core/base/inc/TApplication.h:30:
In file included from /Users/lpnhe/root/core/base/inc/TQObject.h:42:
In file included from /Users/lpnhe/root/core/base/inc/TVirtualQConnection.h:16:
/usr/local/include/TInterpreter.h:42:1: error: unknown type name 'R__EXTERN'
R__EXTERN TVirtualMutex *gInterpreterMutex;
^
/usr/local/include/TInterpreter.h:42:24: error: expected ';' after top level declarator
R__EXTERN TVirtualMutex *gInterpreterMutex;
                       ^
                       ;
/usr/local/include/TInterpreter.h:374:20: error: unknown type name 'gInterpreterMutex'
      R__LOCKGUARD(gInterpreterMutex);
                   ^
/usr/local/include/TInterpreter.h:374:7: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
      R__LOCKGUARD(gInterpreterMutex);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/TVirtualMutex.h:94:61: note: expanded from macro 'R__LOCKGUARD'
#define R__LOCKGUARD(mutex) TLockGuard _R__UNIQUE_(R__guard)(mutex)
                                                            ^~~~~~~
/usr/local/include/TInterpreter.h:374:20: note: add a pair of parentheses to declare a variable
      R__LOCKGUARD(gInterpreterMutex);
                   ^
                   (
/usr/local/include/TVirtualMutex.h:94:62: note: expanded from macro 'R__LOCKGUARD'
#define R__LOCKGUARD(mutex) TLockGuard _R__UNIQUE_(R__guard)(mutex)
                                                             ^
In file included from /Users/lpnhe/root/core/base/src/TApplication.cxx:23:
In file included from /Users/lpnhe/root/core/base/inc/TApplication.h:30:
In file included from /Users/lpnhe/root/core/base/inc/TQObject.h:42:
In file included from /Users/lpnhe/root/core/base/inc/TVirtualQConnection.h:16:
/usr/local/include/TInterpreter.h:553:1: error: unknown type name 'R__EXTERN'
R__EXTERN TInterpreter* gCling;
^
/usr/local/include/TInterpreter.h:553:23: error: expected ';' after top level declarator
R__EXTERN TInterpreter* gCling;
                      ^
                      ;
/usr/local/include/TInterpreter.h:559:8: error: use of undeclared identifier 'gCoreMutex'
   if (gCoreMutex)
       ^
/usr/local/include/TInterpreter.h:560:9: error: no member named 'gCling' in the global namespace
      ::gCling->SnapshotMutexState(gCoreMutex);
      ~~^
/usr/local/include/TInterpreter.h:560:36: error: use of undeclared identifier 'gCoreMutex'
      ::gCling->SnapshotMutexState(gCoreMutex);
                                   ^
/usr/local/include/TInterpreter.h:564:8: error: use of undeclared identifier 'gCoreMutex'
   if (gCoreMutex)

And my cmake …/
Prompt this

~/root/build_root (master)
$|=>cmake ../
-- Detected ROOT_VERSION 6.23.01
-- Looking for Python
-- Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version "3.9.1")
-- Found a macOS system 10.14
-- Found an x86_64 system
-- ROOT Platform: macosx
-- ROOT Compiler: AppleClang 10.0.1.10010046
-- ROOT Processor: x86_64
-- ROOT Architecture: macosx64
-- Build Type: 'Release' (flags = '-O2')
-- Compiler Flags:  -std=c++14 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -O2
-- ROOT default compression algorithm: zlib
-- PyROOT will be built for versions 3.9.1 (Main) and 2.7.16
-- Looking for ZLib
-- Building freetype version 2.6.1 included in ROOT itself
-- Looking for PCRE
-- Looking for LZMA
-- Looking for ZSTD
-- Looking for LZ4
-- Building AfterImage library included in ROOT itself
-- Looking for GSL
-- Looking for OpenGL
-- Looking for gl2ps
-- Looking for LibXml2
-- Looking for SQLite
-- Looking for FFTW3
-- Looking for CFITSIO
-- Looking for XROOTD
-- Found Xrootd version num: 4.6.1 (setting -DROOTXRDVERS=400060001)
--              libXrdMain not found: xproofd will be a wrapper around xrootd
--              libXrdClient not found: use built-in
--              include_dirs: /usr/local/include;/usr/local/include/private
--              libraries: /usr/local/lib/libXrdUtils.dylib;/usr/local/lib/libXrdCl.dylib
-- Checking for module 'davix>=0.6.4'
--   Found davix, version 0.7.6
-- Looking for VDT
-- Cannot select cudnn without selecting cuda or tmva-gpu. Option is ignored
-- Looking for BLAS for optional parts of TMVA
-- Building LLVM in 'Release' mode.
-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Native target architecture is X86
-- Threads disabled.
-- Doxygen disabled.
-- Go bindings enabled.
-- Found ld64 - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- LLVM host triple: x86_64-apple-darwin18.7.0
-- LLVM default target triple: x86_64-apple-darwin18.7.0
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- SysLibs: curses;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libz.tbd
-- Targeting X86
-- Targeting NVPTX
-- Clang version: 5.0.0
-- Cling version (from VERSION file): ROOT_0.8~dev
-- Cling will look for C++ headers in '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1' at runtime.
-- And if not found, will invoke: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ ' for them.
-- Performing Test found_stdstringview
-- Performing Test found_stdstringview - Success
-- Performing Test found_stod_stringview
-- Performing Test found_stod_stringview - Failed
-- Performing Test found_stdapply
-- Performing Test found_stdapply - Failed
-- Performing Test found_stdinvoke
-- Performing Test found_stdinvoke - Failed
-- Performing Test found_stdindexsequence
-- Performing Test found_stdindexsequence - Success
-- ROOT Configuration

System          Darwin-18.7.0
Processor       4 core Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz (x86_64)
Build type      Release
Install path    /usr/local
Compiler        AppleClang 10.0.1.10010046
Compiler flags:
C                -m64 -pipe -W -Wall -fsigned-char -fno-common -Qunused-arguments -pthread -O2 -DNDEBUG
C++              -std=c++14 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -O2 -DNDEBUG
Linker flags:
Executable       -mmacosx-version-min=10.14
Module
Shared

-- Enabled support for:  asimage builtin_afterimage builtin_clang builtin_freetype builtin_ftgl builtin_glew builtin_llvm builtin_nlohmannjson builtin_openssl builtin_openui5 builtin_tbb builtin_xxhash clad cocoa dataframe davix exceptions fftw3 fitsio gdml http imt libcxx mathmore mlp opengl pyroot roofit runtime_cxxmodules shared sqlite ssl tmva tmva-cpu spectrum vdt xml xrootd
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/lpnhe/root/build_root

Thanks in advance ,
Renato


Please read tips for efficient and successful posting and posting code

_ROOT Version: master
Platform: Mac Os


NB, i tried also to use 6.22/06, but i get errors about missing ECursor dependencies in TVirtualPad.h file ( i can retry to compile there if it can help)

I updated my OS to BigSur and reinstalled latest xCode ,

/Users/lpnhe/root/core/base/inc/TStorage.h:148:1: error: unknown type name 'R__EXTERN'
R__EXTERN FreeIfTMapFile_t *gFreeIfTMapFile;
^

Are you re-using a build area or starting fresh? Do you have $ROOTSYS set and if so does it point to the new/current build directory?

Hi @pcanal,

I had some $PATH configured in my bash environment which was possibly interfering, i removed all of them and started from scratch. The new $PATH setup is

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin

This is what i did to get a fresh ROOT

$ git clone --branch master  https://github.com/root-project/root.git root_src
$ mkdir root_build root_install && cd root_build
$ cmake -Dbuiltin_glew=ON -DCMAKE_INSTALL_PREFIX=../root_install ../root_src for warnings or errors
$ cmake --build . -- install -j4 # if you have 4 cores available for compilation

NB : i had to add Dbuiltin_glew=ON because cmake was telling so .

After it starts compiling i get the same error as before. ( and i had no $ROOTSYS configured at all)
I tried to set

export ROOTSYS=$PWD

in the build directory before compiling ( rm -rf * in the build directory) and run again

$ export ROOTSYS=$PWD
$ cmake -Dbuiltin_glew=ON -DCMAKE_INSTALL_PREFIX=../root_install ../root_src for warnings or errors
$ cmake --build . -- install -j4

And i stil get the same error

In file included from /Users/lpnhe/root_src/core/base/inc/TObject.h:18:
/Users/lpnhe/root_src/core/base/inc/TStorage.h:148:1: error: unknown type name 'R__EXTERN'
R__EXTERN FreeIfTMapFile_t *gFreeIfTMapFile;
^
/Users/lpnhe/root_src/core/base/inc/TStorage.h:148:27: error: expected ';' after top level declarator
R__EXTERN FreeIfTMapFile_t *gFreeIfTMapFile;
                          ^
                          ;
/Users/lpnhe/root_src/core/base/inc/TStorage.h:149:1: error: unknown type name 'R__EXTERN'
R__EXTERN void *gMmallocDesc;
^
In file included from /Users/lpnhe/root_src/core/base/src/TApplication.cxx:23:
.....

On the same side
If i instead download and source

root_v6.23.01.macosx64-11.0-clang120RELEASE.tar.gz

it works, but i cannot import ROOT in python3.X sessions (or my ipython), only in 2.7 .
My default python is

Python 3.9.1 (default, Dec 10 2020, 10:36:41)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Thanks for the help
Renato

Digging a bit around i realized the R__EXTERN is a macro defined in RTypes.h which unfortunately was landing in my /usr/local/include path which was then used when compiling ROOT.

I opted for a very brutal approach, which is removing all files where "ROOT" keyword was present .

/usr/local/include
$|=>ls | grep -l "ROOT" *.h  | xargs rm

I suspect the fact i had some old installation of ROOT present there was forcing ROOT to compile using includes from there .
I wonder if it exists a clean way to make such cleanup.
I.e , are there some MAGIC keywords one can use to rm -rf everything in the $PATH linking to old system-wide ROOT installation ?
For the time being i just deleted what made sense to delete T*.h files, some folders like TMVA, Minuit2 etc…
and then for the other .h files i just grepped “ROOT” and delete all of them

The compilation seems to pass over the step where it was failing and i am left with few warnings

/Users/lpnhe/root_src/bindings/pyroot/cppyy/CPyCppyy/src/API.cxx:54:9: warning:
      'PyEval_InitThreads' is deprecated [-Wdeprecated-declarations]
        PyEval_InitThreads();
        ^
/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/include/python3.9/ceval.h:130:1: note:
      'PyEval_InitThreads' has been explicitly marked deprecated here
Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);
^
/usr/local/Cellar/python@3.9/3.9.1/Frameworks/Python.framework/Versions/3.9/include/python3.9/pyport.h:508:54: note:
      expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                     ^

and a failure

Undefined symbols for architecture x86_64:
  "XrdClientAbs::GetCurrentUrl()", referenced from:
      TXNetSystem::GetPathInfo(char const*, FileStat_t&) in TXNetSystem.cxx.o
  "XrdClientAbs::LastServerResp()", referenced from:
      TXNetSystem::Prepare(char const*, unsigned char, unsigned char) in TXNetSystem.cxx.o
      TXNetSystem::Prepare(TCollection*, unsigned char, unsigned char, TString*) in TXNetSystem.cxx.o
      TXNetSystem::GetPathsInfo(char const*, unsigned char*) in TXNetSystem.cxx.o
  "XrdClientAbs::LastServerError()", referenced from:
      TXNetSystem::Connect(char const*) in TXNetSystem.cxx.o

which to me sounds like i have to start fresh again since i have maybe deleted too much stuff… (or i deleted something which was expected. I try to start clean again and report.

In any case, @pcanal any suggestions on how to get this warning about python disappear ?

I got rid of ithe XrdClient errors, enabling with ccmake builtin_xrootd ON (was off by default). I think somehow i had some issues similar to the missing openssl-dev dependency described in

I successfully compiled ROOT/master from source now with all the above which i summarize here

  1. Checking that in $PATH/include i had not spurious ROOT installed files and folders . Then removed them by hand grep "ROOT" *.h
  2. I configured the build to have built_inxROOTD
  3. I had to compile it 1-2 times for some Clad errors, probably the -j4 is not sufficient and some order-dependencies are mismatched

For reference ,

$|=>root --version
ROOT Version: 6.23/01
Built for macosx64 on Dec 17 2020, 09:40:37
From heads/master@v6-23-01-RF-binSampling-337-g16d6f31b7f

,

$|=>python
Python 3.9.1 (default, Dec 10 2020, 10:36:41)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT as r
>>>

updating then pip install ipython , i aligned ipython to the rest, same for jupyterlab etc…

The remaining issue I have is about having ROOT_GENERATE_DICTIONARY in my code and importing libraries in pyROOT session.
@pcanal is there a recommended ROOT version to use for this?
It seems like building my software stack and generating libraries was working smoothly with python (i think i had py2.7) and ROOT 6/18, however on ROOT 6.23.1 i see libcppy3.9 breaking as well as with python2.7 . I can keep downgrading myself, but i wonder if there are any know issues and if there have been updates on the machinery to compile custom classes and using pyROOT to access them.
( basically inside python i do

import ROOT as r
r.gSystem.LoadLibraries("PATHTHO/mylib") #mylib is lib.dylib for MAC
#as soon as i try 
r.NAMESPACE.XX = c 

Where namespaces or classe have been created with a Linkdef and ROOT_GENERATE_DICTIONARY i get segfaults about libcppy3.9
(I can try to reproduce the issue with a reduced CMakeLists project in principle if it would help)
Renato

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.