Using ACLiC to compile a macaro

Hello

I am using ROOT 6.22/02 on Windows 10 (https://root.cern/download/root_v6.22.02.win32.vc16.exe) with Visual studio Community 2019 and trying to run script hsimple.C with ACLiC and I get errors below.
I tried to run my own script, which works fine in ROOT 5.34.38, received errors and tried the tutorial hsimple.C, the errors are similar.
The output is below. Could you explain to me what I need to do differently.

First in cmd window I have

C:\root_v6.22.02\tutorials> "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"

then

C:\root_v6.22.02\tutorials>root -l hsimple.C+

Welcome to the ROOT tutorials


Type ".x demos.C" to get a toolbar from which to execute the demos

Type ".x demoshelp.C" to see the help window

==> Many tutorials use the file hsimple.root produced by hsimple.C
==> It is recommended to execute hsimple.C before any other script

root [0]
Processing hsimple.C+...
Info in <TWinNTSystem::ACLiC>: creating shared library C:/root_v6.22.02/tutorials/hsimple_C.dll
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:15:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected member name or ';' after declaration specifiers
        !_Is_implicitly_default_constructible<_Uty1>::value || !_Is_implicitly_default_constructible<_Uty2>::value)
        ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:136:23: note: to match this '('
    constexpr explicit(
                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected member name or ';' after declaration specifiers
    constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
    ~~~~~~~~~~~~~~~~~~ ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:23: note: to match this '('
    constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
                      ^
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:63:31: error: '_To' does not refer to a value
    return __builtin_bit_cast(_To, _Val);
                              ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:51:17: note: declared here
template <class _To, class _From,
                ^
In file included from input_line_6:1:
In file included from C:/root_v6.22.02/include\Rtypes.h:23:
C:/root_v6.22.02/include/RtypesCore.h:89:14: error: redefinition of 'kTRUE'
const Bool_t kTRUE  = true;
             ^
note: 'C:/root_v6.22.02/include/RtypesCore.h' included multiple times, additional include site here
fatal error: cannot open file 'input_line_3': no such file or directory
C:/root_v6.22.02/include\Rtypes.h:23:10: note: 'C:/root_v6.22.02/include/RtypesCore.h' included multiple times, additional include site here
#include "RtypesCore.h"
         ^
C:/root_v6.22.02/include/RtypesCore.h:89:14: note: unguarded header; consider using #ifdef guards or #pragma once
const Bool_t kTRUE  = true;
             ^
Error in <ACLiC>: Executing 'C:\root_v6.22.02\bin\rootcling -v0 "--lib-list-prefix=C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_map" -f "C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_dict.cxx"  -rml hsimple_C -rmf "C:\root_v6.22.02\tutorials\hsimple_C.rootmap" -DR__ACLIC_ROOTMAP -I%ROOTSYS%\include -D__ACLIC__  "C:/root_v6.22.02/tutorials/hsimple.C" "C:\root_v6.22.02\tutorials\hsimple_C_ACLiC_linkdef.h"' failed!

    ------------------------------------------------------------------
  | Welcome to ROOT 6.22/02                        https://root.cern |
  | (c) 1995-2020, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win32 on Aug 17 2020, 12:46:52                         |
  | From tags/v6-22-02@v6-22-02                                      |
  | Try '.help', '.demo', '.license', '.credits', '.quit'/'.q'       |
   ------------------------------------------------------------------

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22/02
Platform: Windows 10
Compiler: Visual Studio 2019


1 Like

Indeed, I remember that error. It shows up with recent versions of MSVC (Visual Studio 2019 v16.7.0 to be precise). @bellenot worked around it by defining __CUDACC__.

If you built your own ROOT you can add the following lines:

diff --git a/interpreter/cling/lib/Interpreter/CIFactory.cpp b/interpreter/cling/lib/Interpreter/CIFactory.cpp
index c01e6221e6..738666ac61 100644
--- a/interpreter/cling/lib/Interpreter/CIFactory.cpp
+++ b/interpreter/cling/lib/Interpreter/CIFactory.cpp
@@ -788,6 +788,12 @@ static void stringifyPreprocSetting(PreprocessorOptions& PPOpts,
     PPOpts.addMacroDef("__CLING__GNUC_MINOR__=" ClingStringify(__GNUC_MINOR__));
 #elif defined(_MSC_VER)
     PPOpts.addMacroDef("__CLING__MSVC__=" ClingStringify(_MSC_VER));
+#if (_MSC_VER >= 1926)
+    // FIXME: Silly workaround for cling not being able to parse the STL
+    //        headers anymore after the update of Visual Studio v16.7.0
+    //        To be checked/removed after the upgrade of LLVM & Clang
+    PPOpts.addMacroDef("__CUDACC__");
+#endif
 #endif
 
 // https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

Or you grab a nightly binary which should have that fixed: https://root.cern/download/nightly/?C=N;O=D

Cheers, Axel.

Thank you Axel,

I tried the nightly build and I have the same errors.

Processing hsimple.C+...
Info in <TWinNTSystem::ACLiC>: creating shared library C:/root_v6.23.01/tutorials/hsimple_C.dll
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:15:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected member name or ';' after declaration specifiers
        !_Is_implicitly_default_constructible<_Uty1>::value || !_Is_implicitly_default_constructible<_Uty2>::value)
        ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:137:9: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:136:23: note: to match this '('
    constexpr explicit(
                      ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected member name or ';' after declaration specifiers
    constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
    ~~~~~~~~~~~~~~~~~~ ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:24: error: expected ')'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\utility:218:23: note: to match this '('
    constexpr explicit(!is_convertible_v<const _Other1&, _Ty1> || !is_convertible_v<const _Other2&, _Ty2>)
                      ^
In file included from input_line_3:2:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\string:11:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xstring:14:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xmemory:16:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:63:31: error: '_To' does not refer to a value
    return __builtin_bit_cast(_To, _Val);
                              ^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\\include\xutility:51:17: note: declared here
template <class _To, class _From,
                ^
In file included from input_line_6:1:
In file included from C:/root_v6.23.01/include\Rtypes.h:23:
C:/root_v6.23.01/include/RtypesCore.h:91:17: error: redefinition of 'kTRUE'
const Bool_t    kTRUE        = true;
                ^
note: 'C:/root_v6.23.01/include/RtypesCore.h' included multiple times, additional include site here
fatal error: cannot open file 'input_line_3': no such file or directory
C:/root_v6.23.01/include\Rtypes.h:23:10: note: 'C:/root_v6.23.01/include/RtypesCore.h' included multiple times, additional include site here
#include "RtypesCore.h"
         ^
C:/root_v6.23.01/include/RtypesCore.h:91:17: note: unguarded header; consider using #ifdef guards or #pragma once
const Bool_t    kTRUE        = true;
                ^
Error in <ACLiC>: Executing 'C:\root_v6.23.01\bin\rootcling -v0 "--lib-list-prefix=C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_map" -f "C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_dict.cxx"  -rml hsimple_C -rmf "C:\root_v6.23.01\tutorials\hsimple_C.rootmap" -DR__ACLIC_ROOTMAP -I%ROOTSYS%\include -D__ACLIC__  "C:/root_v6.23.01/tutorials/hsimple.C" "C:\root_v6.23.01\tutorials\hsimple_C_ACLiC_linkdef.h"' failed!

Anton

2 Likes

I tried to build root also,
I did in termianal

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"

D:\>cd root-6.22.02-build

cmake -Dall=OFF -Dmathmore=OFF -Dbuiltin_zlib=ON -Dgfal=OFF -Dbuiltin_freetype=ON -Dbuiltin_ftgl=ON -Droofit=ON -Dfftw3=ON -DFFTW_INCLUDE_DIR=D:\fftw -DFFTW_LIBRARY=D:\fftw\libfftw3-3.lib D:\root-6.22.02-source

The output is in cmake-output-1.txt.
Then

cmake --build .  --config Release  > cmake-build-1.txt

The output is in cmake-build-1.txt

And no success

Anton

cmake-output-1.txt (9.2 KB) cmake-build-1.txt (876.7 KB)

1 Like

Any help on how to compile root on Windows 10?

You need two extra switches: -A Win32 -Thost=x64, see Run ROOT 6.19.02 on Windows 10

Thanks Axel,
I tried that and still received errors.

cmake -G "Visual Studio 16 2019" -A Win32 -Thost=x64 -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_STANDARD=14 -Droofit=ON -Dfftw3=ON -DFFTW_INCLUDE_DIR=D:\fftw -DFFTW_LIBRARY=D:\fftw\libfftw3-3.lib D:\root-6.22.02-source > ..\cmake-output-2.txt

I think configuration and generating went without errors cmake-output-2.txt (10.1 KB)

cmake --build . --config Release -- /maxcpucount  > ..\cmake-build-2.txt

and here were errors cmake-build-2.txt (1.4 MB)

Here is my configuration of VS

I followed Run ROOT 6.19.02 on Windows 10
and I read Building and Executing ROOT6 on Windows with VS2019
but I do not see encoding related errors.