Cxx14 flag when compiling ROOT with clang 3.4.2

Dear ROOTers,

I recently updated my ROOT5 and ROOT6 versions to 5.34.32 and 6.02.12 respectively and I noticed that now the ‘‘configure’’ options include also the flag cxx14, provided that your compiler supports it.

Apparently my ‘‘configure’’:

./configure --all --with-clang --enable-cxx14 --enable-soversion --fail-on-missing |& tee configure.output

thinks that my system (cern centos 7.1 linux x86_64) supports c++14, and in fact clang should support it as version 3.4

However ‘‘make’’ encounters at least the following error (I also attached the full output):

clang++ -O2 -DNDEBUG -pipe -m64 -std=c++1y -Wshadow -Wall -W -Woverloaded-virtual -fPIC -Iinclude  -Wno-deprecated-declarations -pthread -DINCLUDEDIR=\"/usr/include\" -DOBJSUFFIX=\".o\" -o build/rmkdepend/mainroot.o -c /tmp/malfonsi/ROOT6/root-6.02.12/build/rmkdepend/mainroot.cxx
In file included from /tmp/malfonsi/ROOT6/root-6.02.12/build/rmkdepend/mainroot.cxx:28:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/string:52:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/bits/basic_string.h:2815:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/ext/string_conversions.h:43:
/usr/bin/../lib/gcc/x86_64-redhat-linux/4.8.3/../../../../include/c++/4.8.3/cstdio:120:11: error: no member named 'gets' in the global namespace
  using ::gets;
1 error generated.

As far as I remember gets() was deprecated some time ago and maybe it is now completely removed from the std.
I am not sure if this error means that clang on linux is still using from GNU gcc and this is not yet fully compliant to c++14…

… anyway is this error easily fixable? Otherwise for the time being I will just stick to c++11…

Thanks a lot,
make.output.txt (9.99 KB)
configure.output.txt (7.64 KB)

Hi all,

it seems that this is a problem of CERN Centos 7.1 system, that has not yet the most up-to-date gcc (c libraries are taken from gcc as far as I understand).

It seems that it compiles fine on a Debian 8 system with clang 3.5.0-10 and gcc 4.9

Is there any workaround for my CERN Centos 7.1 or should I rely on Redhat DevToolsets or should I wait for the upgrade?


P.S. BTW on this Debian system the script thisroot.csh, as for ROOT version V6.04.00, fails because it looks for the command /usr/sbin/lsof, which, on Debian 8 system, is in /usr/bin/lsof. (Recently added to the script? I guess the infinite quest to have this script callable by other tcsh scripts…). Maybe this is a useful information.

You can try to use gcc4.9. An installation exists in /afs/
You can add in the configure command --with-gcc-toolchain=/afs/
Thanks for reporting the problem with thisroot.csh. We will have a look.

BTW you should start building with CMake because is the method that we plan to maintain long term. If there is any problem we will fix it.

Created ticket

Sorry if I come back to this, but is cxx14 really enabled with this configure option?

As I mention in the previous reply, I manage to compile ROOT6 on the Debian 8 system, but I believe that the c++14 extension are not really actived:

root [0] auto adder = [](auto op1, auto op2) { return op1+op2; }
ROOT_prompt_0:1:17: error: 'auto' not allowed in lambda parameter
auto adder = [](auto op1, auto op2) { return op1+op2; }
ROOT_prompt_0:1:27: error: 'auto' not allowed in lambda parameter
auto adder = [](auto op1, auto op2) { return op1+op2; }
root [1] __cplusplus
(long) 201103

root [3] .L
Info in <TUnixSystem::ACLiC>: creating shared library /fs01/ma09/homes/malfonsi/./
In file included from input_line_12:9:
/fs01/ma09/homes/malfonsi/./ error: 'auto' return without trailing return type; deduced return types are a
      C++14 extension
auto testfeatureuniqueptr()
/fs01/ma09/homes/malfonsi/./ error: no member named 'make_unique' in namespace 'std'
  return std::make_unique<int>();
/fs01/ma09/homes/malfonsi/./ error: expected '(' for function-style cast or type construction
  return std::make_unique<int>();
/fs01/ma09/homes/malfonsi/./ error: expected expression
  return std::make_unique<int>();
Error in <ACLiC>: Dictionary generation failed!

where the code in “” is just:

#include <memory>

auto testfeatureuniqueptr()
  return std::make_unique<int>();

Should I try to install ROOT6 with CMake ?

Thanks again,

The option, --enable-cxx14 tells to build ROOT itself with c++14. You case is using ACLiC. So, the question is should ROOT pass the -std=c++14 flag to the ACLiC compilation? The answer is probably yes. So, I will have a look why it is not the case.

Yes, please try with CMake. The equivalent option is -Dcxx14=ON

Committed a fix into master branch. … bdbb9559be
Can you please check if the fix will work for you?

Dear Pere,

I “git cloned” the last version of root. The most recent commit at the moment of the test was:

commit 3dbadd0054cee182ac3376a9987493c947007b21
Author: Pere Mato <>
Date:   Wed Jul 15 19:00:06 2015 +0200

    Fix for ROOT-7478 - Generating PCH fails with CXX flags with spaces

(so more recent than the 6.04.02 tag, while the previous posts concerned downloaded v6.04.00 tag)

The two tests are performed on a Debian 8 system:
Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux

First test: configure + make

./configure --all --with-clang --enable-cxx14 --enable-soversion --fail-on-missing | & tee configure.output

It compiles fine (output attached).
The c++14 extensions become available in the interpret (it was not the case before):

root [0] auto adder = [](auto op1, auto op2) { return op1+op2; }
(class (lambda at ROOT_prompt_0:1:14) &) @0x7faf6e012028
root [1] adder(3,4)
(int) 7
root [2] __cplusplus
(long) 201402
root [3] #include <memory>
root [4] auto p = std::make_unique<std::array<int,5>>()
(class std::unique_ptr<struct std::array<int, 5>, struct std::default_delete<struct std::array<int, 5> > > &) @0x7f211d525028

However, AcLic is still sticking to c++11, as I get exactly the same error messages as in my previous post (please refer to it) when I try to compile the script

Second test: cmake + make

$ cmake ../root_to_be_compiled_with_cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR_FOR_ROOT6 -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_F_COMPILER=gfortran -Droottest=ON -Dcxx14=ON -Dsoversion=ON -Dmathmore=ON -Dfftw3=ON -Dgviz=ON -Dgdml=ON -Dhttp=ON -Dmemstat=ON -Dminuit2=ON -Dopengl=ON -Dpython=ON -Droofit=ON -Dshared=ON -Dtable=ON -Dtmva=ON -Dunuran=ON -Dvc=ON -Dvdt=ON -Dx11=ON -Dxft=ON -Dxml=ON | & tee cmake.output

(if I look at the attached output it does not seem to take gfortran but at the moment I do not care)

In this case the compilation fails complaining for the experimental “string_view” feature that cannot be found.

[ 33%] Generating G__IO.cxx, ../../lib/libRIO.rootmap
In file included from input_line_9:6:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/TStreamerInfoActions.h:17:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/TStreamerInfo.h:26:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/TVirtualStreamerInfo.h:25:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/TNamed.h:29:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/TString.h:41:
In file included from /localscratch/DownloadedSoftware/ROOT/ROOT6/root-6.04.02/root_builddir/include/RStringView.h:24:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/experimental/string_view:39:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/bits/c++14_warning.h:32:2: error: This file requires compiler and library support for the forthcoming ISO C++ 2014 standard. This support is currently experimental, and must be enabled with the -std=c++1y or -std=gnu++1y compiler options.

Please let me know if you need other tests.


of course I forgot the attachments
make_after_configure.output.txt.gz (168 KB)
cmake.output.txt (16.6 KB)
make_after_cmake.output.txt.gz (12 KB)
configure.output.txt (7.37 KB)

Dear Pere,

thx for the fix. Now (commit 76b885b598999bbc811082aa31d933577ba16a04) c++14 extensions are available both in the interpret and with AcLic.

However I succeeded only with the configure+make installation method.

CMake compilation have the same problem as my previous post on this Debian 8 machine, i.e. the fact that the experimental string_view include file is not found where expected.

However I believe that this is a different problem w.r.t. the issue discussed in this thread.