Compiling ROOT on Windows 10 (revisited)

Hello,

I am trying to build the latest ROOT in a Windows 10 environment on a virtual machine, using VS 2019 (community) and libraries installed mostly via vcpkg.

The beginning of the run log looks like this:

– Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
– The C compiler identification is MSVC 19.28.29913.0
– The CXX compiler identification is MSVC 19.28.29913.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found Git: C:/Program Files/Git/cmd/git.exe (found version “2.27.0.windows.1”)
– Detected ROOT_VERSION 6.25.01
– Looking for Python
– Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version “3.9.2”)
– Could NOT find Python2 (missing: Python2_EXECUTABLE Python2_LIBRARIES Python2_INCLUDE_DIRS Python2_NumPy_INCLUDE_DIRS Interpreter Development NumPy Development.Module Development.Embed)
– Looking for pthread.h
– Looking for pthread.h - not found
– Found Threads: TRUE
– Performing Test GLIBCXX_USE_CXX11_ABI
– Performing Test GLIBCXX_USE_CXX11_ABI - Failed
– ROOT Platform: win32

There has been a post from May '18 on the same subject which has been closed, but the difference now is that the latest VS compiler skips the check on whether there is a working C & CXX compiler. Could this be why the build fails?

Is there a workaround? (tried to set -DLIBCXX_USE_CXX11_ABI:BOOL=“ON” manually in the bat file but it gets reset to 0 and causes the failure).

I should add that I have installed the relevant packages (“pthreads” and “pthread” via vcpkg, so the file pthread.h is in the path

First, build in 32 bit mode (64 bit is not yet supported), and make sure you start from within a x86 Native Tools Command Prompt for VS 2019

How do I force x86? I have not set any flags, this is done by default. I also include
-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake
to link to the packages I have installed using vcpkg

From the x86 Native Tools Command Prompt for VS 2019

cmake -G "Visual Studio 16 2019" -A Win32 -Thost=x64 [other configure flags ...]

or when using the cmake-gui, you can select the build architecture

Thanks - did that but no change. Here’s my CMAKE command:

cmake -G “Visual Studio 16” -A Win32 -Thost=x64 -DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE:STRING=“Release” -Dbuiltin_zlib:BOOL=“OFF” -Dbuiltin_afterimage:BOOL=“ON” -DIMT=“ON” -DCMAKE_INSTALL_PREFIX:PATH=“C:/root/6.25.01” -Dfftw3:BOOL=“ON” -Dgsl_shared:BOOL=“ON” -Dmathmore:BOOL=“ON” -Dminuit2:BOOL=“ON” -Dmysql:BOOL=“ON” -Dpythia6:BOOL=“OFF” -Dpythia8:BOOL=“OFF” -Dsqlite:BOOL=“ON” -Dtmva:BOOL=“ON” -Dtmva-cpu:BOOL=“ON” -Dtmva-pymva:BOOL=“ON” -Dtmva-rmva:BOOL=“ON” -DMYSQL_DIR:PATH=“C:/MySQL/mysql-5.7.33-win32/” …/SourceCode/6.25.01/

I am not setting any paths apart from MySQL as they should be set by vcpkg for installed packages.

Here’s the output as far as it advanced:

– Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
– The C compiler identification is MSVC 19.28.29913.0
– The CXX compiler identification is MSVC 19.28.29913.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x86/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x86/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found Git: C:/Program Files/Git/cmd/git.exe (found version “2.27.0.windows.1”)
– Detected ROOT_VERSION 6.25.01
– Looking for Python
– Could NOT find Python3 (missing: Python3_NumPy_INCLUDE_DIRS NumPy) (found version “3.9.2”)
– Could NOT find Python2 (missing: Python2_EXECUTABLE Python2_LIBRARIES Python2_INCLUDE_DIRS Python2_NumPy_INCLUDE_DIRS Interpreter Development NumPy Development.Module Development.Embed)
– Looking for pthread.h
– Looking for pthread.h - not found
– Found Threads: TRUE
– Performing Test GLIBCXX_USE_CXX11_ABI
– Performing Test GLIBCXX_USE_CXX11_ABI - Failed
– ROOT Platform: win32
– ROOT Compiler: MSVC 19.28.29913.0
– ROOT Processor: AMD64
– ROOT Architecture: win32
– Build Type: ‘Release’ (flags = ‘-O2’)
– Compiler Flags: -nologo -IC:/Users/DevFVT/Desktop/RootCustomBuild/SourceCode/6.25.01/build/win -FIw32pragma.h -FIsehmap.h -Zc:__cplusplus -MD -GR -EHsc- -W3 -wd4141 -wd4291 -wd4244 -wd4049 -D_WIN32 -D_XKEYCHECK_H -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -O2
– ROOT default compression algorithm: zlib
– PyROOT will be built for version 3.9.2
– Looking for ZLib

And this is the error log file:

Determining if the include file pthread.h exists failed with the following output:
Change Dir: C:/RootBuild/6.25.01_build_20210322/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_17fa2.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && Microsoft ® Build Engine version 16.9.0+57a23d249 for .NET Framework

Copyright © Microsoft Corporation. All rights reserved.

Microsoft ® C/C++ Optimizing Compiler Version 19.28.29913 for x86

Copyright © Microsoft Corporation. All rights reserved.

CheckIncludeFile.c

cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D “CMAKE_INTDIR=“Debug”” /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_17fa2.dir\Debug\" /Fd"cmTC_17fa2.dir\Debug\vc142.pdb" /Gd /TC /analyze- /errorReport:queue C:\RootBuild\6.25.01_build_20210322\CMakeFiles\CMakeTmp\CheckIncludeFile.c

C:\RootBuild\6.25.01_build_20210322\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: ‘pthread.h’: No such file or directory [C:\Users\DevFVT\Desktop\RootCustomBuild\6.25.01_build_20210322\CMakeFiles\CMakeTmp\cmTC_17fa2.vcxproj]

Performing C++ SOURCE FILE Test GLIBCXX_USE_CXX11_ABI failed with the following output:
Change Dir: C:/RootBuild/6.25.01_build_20210322/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_38351.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=16.0 /v:m && Microsoft ® Build Engine version 16.9.0+57a23d249 for .NET Framework

Copyright © Microsoft Corporation. All rights reserved.

src.cxx

C:\RootBuild\6.25.01_build_20210322\CMakeFiles\CMakeTmp\src.cxx(4,1): fatal error C1189: #error: NOCXX11 [C:\RootBuild\6.25.01_build_20210322\CMakeFiles\CMakeTmp\cmTC_38351.vcxproj]

Source file was:

#include
#if _GLIBCXX_USE_CXX11_ABI == 0
#error NOCXX11
#endif
int main() {}

I have no idea what this option is doing: -DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake
Can you first try with:

cmake -G "Visual Studio 16" -A Win32 -Thost=x64 -DIMT=ON -DCMAKE_INSTALL_PREFIX="C:/root/6.25.01" -Dfftw3=ON -Dgsl_shared=ON -Dmathmore=ON -Dminuit2=ON -Dmysql=ON -Dpythia6=OFF -Dpythia8=OFF -Dsqlite=ON -Dtmva=ON -Dtmva-cpu=ON -Dtmva-pymva=ON -Dtmva-rmva=ON -DMYSQL_DIR="C:/MySQL/mysql-5.7.33-win32/" .../SourceCode/6.25.01/

And note that for mathmore you need GSL installed on your machine, and for IMT you need TBB (either builtin, or installed on your machine). And note also that all your libraries have to be 32 bit ones

Thanks - I switched from vcpkg to Anaconda x86 for managing the external libraries (all but MySQL). This seems to work only with CMAKE also installed and run from a conda prompt. Running from a VS2019 prompt does not find the external libraries, even when I manually set the paths. Running from a conda prompt gets through the configuration stage (output attached) but generates several failed tests toward the end. Other issues are that cmake still does not find R and ignores IMT=ON (despite TBB also as a conda package). Any ideas how to fix the remaining issues, what the failed tests mean, and whether this will work root build.txt (10.9 KB) ?

I think the easiest way is to open the cmake-gui interface from a VS2019 command prompt and fill the PATH to your external libraries. The other option is to give them from the command prompt, like you do for MySQL.
Note that -DCMAKE_BUILD_TYPE:STRING="Release" is useless on Windows, the R package has not been tested on Windows and is most probably not supported. And don’t worry about the failing tests, it’s simply CMake testing different compiler features.

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