Compilation error ROOT v6.18/04 on OS X (LLVM Clang 8.0)

Hello,

I need ROOT with C++14 features, so I tried to build it from source (has not given (much) problems with older ROOT versions like v6.13). Now that we want to upgrade to the currently latest stable version (v6.18/04) the build fails with errors such as the following on OS X 10.12 (no problems on Ubuntu and CentOS):

[ 77%] Building CXX object core/metacling/src/CMakeFiles/MetaCling.dir/TClingCallbacks.cxx.o
In file included from /Users/ahmad/bdm-build-third-party/root/core/metacling/src/TClingCallbacks.cxx:37:
In file included from /Users/ahmad/bdm-build-third-party/root/core/metacling/src/ClingRAII.h:13:
/Users/ahmad/bdm-build-third-party/root/interpreter/cling/include/cling/Utils/ParserStateRAII.h:32:29: error: 'TemplateIds' is a private member of 'clang::Parser'
    decltype(clang::Parser::TemplateIds) OldTemplateIds;
                            ^
/usr/local/opt/llvm/include/clang/Parse/Parser.h:254:43: note: implicitly declared private here
  SmallVector<TemplateIdAnnotation *, 16> TemplateIds;
                                          ^
In file included from /Users/ahmad/bdm-build-third-party/root/core/metacling/src/TClingCallbacks.cxx:37:
/Users/ahmad/bdm-build-third-party/root/core/metacling/src/ClingRAII.h:60:29: error: no type named 'CleanupAndRestoreCacheRAII' in 'clang::Preprocessor'
       clang::Preprocessor::CleanupAndRestoreCacheRAII fCleanupRAII;
       ~~~~~~~~~~~~~~~~~~~~~^

Building with the following options:

cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang \
-DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ \
-DCMAKE_INSTALL_PREFIX=/Users/ahmad/bdm-build-third-party/root-install \
-Dcxx14=on \
 ../root/

Should clang be including headers from my system’s LLVM directory, or should it be using the headers that are shipped with ROOT? The errors above make me believe the latter…

Any ideas on how to fix this?

Ahmad


ROOT Version: 6.18/04
Platform: Mac OS 10.12
Compiler: LLVM Clang 8.0.1 (non-Apple version)


Hi Ahmad,

If you want ROOT use your external LLVM build with -Dbuiltin_llvm=OFF, it needs to be special only (!) LLVM 5.0 branch with ROOT patches on the top from http://root.cern.ch/git/llvm.git

So in your case, ROOT picks wrong headers…

I am using similar setup on my desktop using Clang HEAD build:
export PATH=/home/oksana/CERN/llvm/bin:$PATH
CC=clang CXX=clang++ cmake ../

Can you try please clean build?

Hi Oksana :slight_smile:

Thanks for your reply. I don’t have a specific reason to use my system’s LLVM. I just want ROOT to pick up the clang(++) compiler and for the rest it’s fine to use the built-in Clang headers in ROOT.

Is there a way to tell CMake to not pick up the headers from my system’s LLVM? I used to compile with LLVM Clang v6 (the one I get from brew) with the same CMake command options (i.e. never set the builtin-llvm flag to something other than the default), and it would never complain about incompatibilities between the built-in clang stuff and my system’s clang. I’m just not sure if this problem now occurs because I upgraded LLVM to v8 (also from brew), or because I’m using a newer ROOT version.

Looks like it could be a bug…Let me try to reproduce it and add JIRA issue!

1 Like

Jira issue https://sft.its.cern.ch/jira/browse/ROOT-10327

1 Like

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