[Windows] roottest v6-36-00-patches: LNK1181: Core.lib issues [CEA 45230]


ROOT Version: tags/v6-36-00@v6-36-00
Platform: win64: Windows 10 22H2
Compiler: MSVC 19.33.31630.0: Visual Studio 2022 17.3.6


I compiled ROOT 6.36 for Windows and building roottest seems to trigger LNK1181 issues.

A related issue may be: [CEA 45230] roottest v6-36-00: IoBigEventGenerator -> MathCore Dependency Issue?

Environment: CMake, Python & ROOT

In “Developer PowerShell for VS 2022” which provides CMake, I activated a Python environment & loaded ROOT:

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.3.6
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\...> py -3.10 -m venv python
PS C:\...> & .\python\Scripts\Activate.ps1
(python) PS C:\...> . .\outputs\root\bin\thisroot.ps1
(python) PS C:\...> root -q
   ------------------------------------------------------------------
  | Welcome to ROOT 6.36.000                       https://root.cern |
  | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on Jun 12 2025, 13:50:30                         |
  | From tags/v6-36-00@v6-36-00                                      |
  | With MSVC 19.33.31630.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------


(python) PS C:\...>

Here are some data about ROOT configuration:

(python) PS C:\...> root-config --python-version
3.10.11
(python) PS C:\...> root-config --features
cxx17  asimage builtin_clang builtin_cling builtin_freetype builtin_gif builtin_gtest builtin_jpeg builtin_llvm builtin_lz4 builtin_lzma builtin_nlohmannjson builtin_pcre builtin_png builtin_xxhash builtin_zlib builtin_zstd dataframe fftw3 pyroot roofit shared testsupport tpython xml
(python) PS C:\...>

Here is a link to download this ROOT binary package if this might be useful: FileSender

Tests: roottest

Then here is how I tried to build GitHub - root-project/roottest at v6-36-00-patches with this package:

$ git clone -b v6-36-00-patches https://github.com/root-project/roottest.git
(python) PS C:\...\roottest\build> cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.33.31630.0
-- The CXX compiler identification is MSVC 19.33.31630.0
[...]
-- Configuring done
-- Generating done
-- Build files have been written to: C:/.../roottest/build
(python) PS C:\...\roottest\build> cmake --build . -j $(Get-ComputerInfo -Property CsProcessors).CsProcessors.NumberOfCores[0] --config Release
MSBuild version 17.3.1+2badb37d1 for .NET Framework
  Generating G__IoBigEventGeneration.cxx, IoBigEventGeneration_rdict.pcm, IoBigEventGeneration.rootmap
  Generating G__TreeFormulaReferencesGeneration.cxx, TreeFormulaReferencesGeneration_rdict.pcm, TreeFormulaReferencesGe
  neration.rootmap
  Creating directories for 'googletest'
  Performing download step (git clone) for 'googletest'
cl : ligne de commande  warning D9025: substitution de '/EHc' par '/EHc-' [C:\...\roottest\build\root\treeformula\references\TreeFormulaReferencesGeneration.vcxproj]
  G__TreeFormulaReferencesGeneration.cxx
cl : ligne de commande  warning D9025: substitution de '/EHc' par '/EHc-' [C:\...\roottest\build\root\io\bigevent\IoBigEventGeneration.vcxproj]
  G__IoBigEventGeneration.cxx
  TreeFormulaReferencesGeneration.cxx
  IoBigEventGeneration.cxx
  Génération de code en cours...
  Auto build dll exports
C:\...\roottest\root\io\bigevent\IoBigEventGeneration.cxx(355,11): warning C447
7: 'printf' : la chaîne de format '%ld' nécessite un argument de type 'long', mais l'argument variadique 1 est de type
'unsigned __int64' [C:\...\roottest\build\root\io\bigevent\IoBigEventGeneration
.vcxproj]
C:\...\roottest\root\io\bigevent\IoBigEventGeneration.cxx(355,11): message : ut
ilisez '%zd' dans la chaîne de format [C:\...\roottest\build\root\io\bigevent\I
oBigEventGeneration.vcxproj]
  Génération de code en cours...
LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entrée 'Core.lib' [C:\...\roottest\build\root\treeformula\references\TreeFormulaReferencesGeneration.vcxproj]
  -- googletest download command succeeded.  See also C:/.../roottest/build/goo
  gletest-prefix/src/googletest-stamp/googletest-download-*.log
  No update step for 'googletest'
  No patch step for 'googletest'
  Performing configure step for 'googletest'
  Auto build dll exports
LINK : fatal error LNK1181: impossible d'ouvrir le fichier en entrée 'Core.lib' [C:\...\roottest\build\root\io\bigevent\IoBigEventGeneration.vcxproj]

Have you encountered this LNK1181 issue on Windows with ROOT 6.36 and roottest: v6-36-00-patches ?
Do you know how to solve this problem?

A workaround might be to use GitHub - root-project/roottest at v6-34-00-patches

Best Regards,

We build ROOT v6-36-00-patches and run the tests every night and didn’t see this problem. But I’ll cross-check nevertheless

Do I understand correctly that you are trying to build and run roottest with a pre-built binary of ROOT?

Try to apply this diff in the source of roottest:

diff --git a/root/io/bigevent/CMakeLists.txt b/root/io/bigevent/CMakeLists.txt
index eb830403..8a3dd061 100644
--- a/root/io/bigevent/CMakeLists.txt
+++ b/root/io/bigevent/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__IoBigEventGeneration
 ROOT_LINKER_LIBRARY(IoBigEventGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/IoBigEventGeneration.cxx
   G__IoBigEventGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore Physics Graf Matrix)
+  LIBRARIES libCore libTree libHist libMathCore libPhysics libGraf libMatrix)

 if(MSVC)
   add_custom_command(TARGET IoBigEventGeneration POST_BUILD
diff --git a/root/treeformula/references/CMakeLists.txt b/root/treeformula/references/CMakeLists.txt
index 75373fe9..343101e6 100644
--- a/root/treeformula/references/CMakeLists.txt
+++ b/root/treeformula/references/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__TreeFormulaReferencesGeneration
 ROOT_LINKER_LIBRARY(TreeFormulaReferencesGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaReferencesGeneration.cxx
   G__TreeFormulaReferencesGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore)
+  LIBRARIES libCore libTree libHist libMathCore)

 if(MSVC)
   add_custom_command(TARGET TreeFormulaReferencesGeneration POST_BUILD

Yes I built a ROOT binary (on my client machine) and try to build and run roottest.

Note: I can’t use Release 6.36.00 binary distribution probably because of Visual Studio 2022 version mismatch:

Your Package:

PS C:\...\root_v6.36.00-rc1.win64.python311.vc17> root -q -e "gSystem->GetBuildCompilerVersion()"
   ------------------------------------------------------------------
  | Welcome to ROOT 6.35.99                        https://root.cern |
  | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on Apr 23 2025, 04:06:54                         |
  | From tags/v6-36-00-rc1@v6-36-00-rc1                              |
  | With MSVC 19.39.33521.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------


(const char *) "MSVC 19.39.33521.0"
PS C:\...\root_v6.36.00-rc1.win64.python311.vc17>

My Client Package:

(python) PS C:\...\roottest\build> root -q -e "gSystem->GetBuildCompilerVersion()"
   ------------------------------------------------------------------
  | Welcome to ROOT 6.36.000                       https://root.cern |
  | (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on Jun 12 2025, 13:50:30                         |
  | From tags/v6-36-00@v6-36-00                                      |
  | With MSVC 19.33.31630.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------


(const char *) "MSVC 19.33.31630.0"
(python) PS C:\...\roottest\build>

Then can I ask you why you don’t simply enable roottest (e.g. -Dtesting=ON -Drootest=ON) when building ROOT? This should work out of the box…
And BTW, any version of Visual Studio should work

It works!

$ git diff
diff --git a/root/io/bigevent/CMakeLists.txt b/root/io/bigevent/CMakeLists.txt
index eb830403..8a3dd061 100644
--- a/root/io/bigevent/CMakeLists.txt
+++ b/root/io/bigevent/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__IoBigEventGeneration
 ROOT_LINKER_LIBRARY(IoBigEventGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/IoBigEventGeneration.cxx
   G__IoBigEventGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore Physics Graf Matrix)
+  LIBRARIES libCore libTree libHist libMathCore libPhysics libGraf libMatrix)

 if(MSVC)
   add_custom_command(TARGET IoBigEventGeneration POST_BUILD
diff --git a/root/treeformula/references/CMakeLists.txt b/root/treeformula/references/CMakeLists.txt
index 75373fe9..343101e6 100644
--- a/root/treeformula/references/CMakeLists.txt
+++ b/root/treeformula/references/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__TreeFormulaReferencesGeneration
 ROOT_LINKER_LIBRARY(TreeFormulaReferencesGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaReferencesGeneration.cxx
   G__TreeFormulaReferencesGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore)
+  LIBRARIES libCore libTree libHist libMathCore)

 if(MSVC)
   add_custom_command(TARGET TreeFormulaReferencesGeneration POST_BUILD

[...]/roottest (v6-36-00-patches)
(python) PS C:\...\roottest\build> cmake ..
(python) PS C:\...\roottest\build> cmake --build . -j $(Get-ComputerInfo -Property CsProcessors).CsProcessors.NumberOfCores[0] --config Release
MSBuild version 17.3.1+2badb37d1 for .NET Framework
[...]
  Generating Event.root
(python) PS C:\...\roottest\build> $?
True
(python) PS C:\...\roottest\build>

Thank you very much.

However an “auto” completion of “lib” prefix could be nice.

That was somehow done for some other part, but not for these two… but as I said, enabling testing and roottest when building ROOT should work (it’s the way we do it in our nightlies)

I built ROOT requesting for testing but not roottest:

-DCMAKE_CXX_STANDARD=17 -DCMAKE_CONFIGURATION_TYPES=Release [...]
-Dtpython=ON -Dpyroot=ON -Dmlp=ON -Dxml=ON -Dsqlite=ON -Dtesting=ON -Dmathmore=ON -Dbuiltin_gtest=ON -Ddataframe=ON 
-Droofit=ON -Dasimage=ON -Dgminimal=ON -Dfftw3=ON

I’m sorry I don’t have a relevant answer.

You are right. I think I should enable testing and rootest since the project of my client heavily depends on ROOT.

Well, as I said, we run the tests every nights and before each release. So you don’t have to run the tests yourself, unless you modify some parts of ROOT…

1 Like

I apologise for what I said about Visual Studio version mismatch.

I will test root_v6.36.00.win64.python311.vc17.zip for instance.

No problem, no need to apologize! And if there is an issue with the binaries we distribute, please let us know!

1 Like

To tell the truth, I forked your roottest project to test and develop specific use cases for my client, e.g. uranie/tma/sensitivity/sobol/generate_pure.C · v6-32_uranie · Uranie CEA / ROOT / roottest · GitLab

Hence, using roottest as a sandbox is quite useful for my job.

Shall I open a pullrequest with your patch?

Or based on roottest/root/io/transient/base/CMakeLists.txt at v6-36-00-patches · root-project/roottest · GitHub can this be an alternative?

$ git diff
diff --git a/root/io/bigevent/CMakeLists.txt b/root/io/bigevent/CMakeLists.txt
index eb830403..85b5c4d7 100644
--- a/root/io/bigevent/CMakeLists.txt
+++ b/root/io/bigevent/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__IoBigEventGeneration
 ROOT_LINKER_LIBRARY(IoBigEventGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/IoBigEventGeneration.cxx
   G__IoBigEventGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore Physics Graf Matrix)
+  LIBRARIES ROOT::Core ROOT::Tree ROOT::Hist ROOT::MathCore ROOT::Physics ROOT::Graf ROOT::Matrix)

 if(MSVC)
   add_custom_command(TARGET IoBigEventGeneration POST_BUILD
diff --git a/root/treeformula/references/CMakeLists.txt b/root/treeformula/references/CMakeLists.txt
index 75373fe9..688d7eb2 100644
--- a/root/treeformula/references/CMakeLists.txt
+++ b/root/treeformula/references/CMakeLists.txt
@@ -5,7 +5,7 @@ ROOT_GENERATE_DICTIONARY(G__TreeFormulaReferencesGeneration
 ROOT_LINKER_LIBRARY(TreeFormulaReferencesGeneration
   ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaReferencesGeneration.cxx
   G__TreeFormulaReferencesGeneration.cxx
-  LIBRARIES Core Tree Hist MathCore)
+  LIBRARIES ROOT::Core ROOT::Tree ROOT::Hist ROOT::MathCore)

 if(MSVC)
   add_custom_command(TARGET TreeFormulaReferencesGeneration POST_BUILD

No, that was a solution for your issue, not a proper solution

Maybe. Can you give it a try?

OK. Thank you.

Yes, it was successfully tested:

(python) PS C:\...\roottest\build> cmake ..
-- Building for: Visual Studio 17 2022
[...]
(python) PS C:\...\roottest\build> cmake --build . -j $(Get-ComputerInfo -Property CsProcessors).CsProcessors.NumberOfCores[0] --config Release
MSBuild version 17.3.1+2badb37d1 for .NET Framework
[...]
  Generating Event.root
(python) PS C:\...\roottest\build> $?
True
(python) PS C:\...\roottest\build>
1 Like

Cool, thanks!

FYI, here is the PR #1337

1 Like