ROOT on Windows 11

Hello,

I need a robust ROOT installation under Windows 11 using VS2022 and powershell.

This used to be possible with precompiled binaries for ROOT5 under Windows 10 with VS2010.

It is no longer possible (Win11, VS2022, ROOT6), because:
1.) The precompiled binaries crash;
2.) Multiple errors occur when installing from source;

My office at CERN is 3/1-066 in case someone from the root team would be kind enough to install it for me. I have a workstation Dell Precision 5820.

Many thanks in advance!
Deyan

Welcome to the ROOT Forum!

How does it crashes? How/where did you install ROOT? What exact version (which file did you download)? How do you start ROOT?

1.) i just now re-installed:
root_v6.30.06.win64.vc17.exe (127Mb)

2.) and I have:
Microsoft Visual Studio Community 2022
Version 17.7.6
VisualStudio.17.Release/17.7.6+34221.43
Microsoft .NET Framework
Version 4.8.09032

Now I get the error message at the start:
PS D:> root
Assertion failed: !(isOverridden && isOutOfDate) && “an overridden cannot be out-of-date”, file C:\ROOT-CI\src\interpreter\llvm-project\clang\include\clang/Serialization/ModuleFile.h, line 78

This is strange, because it used to work. Anyway, problems. Pls, tell me which version to install how, etc. I want:
a) Win 11 64 bit
b) VC17
c) powershell integration
d) no pyton, cmake, etc.

I just downloaded root_v6.32.08.win64.vc17.zip, on my Windows 11 desktop, unzipped it in C:\root, then started a Developer PowerShell for VS 2022, and then, from there:

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.12.1
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\Program Files\Microsoft Visual Studio\2022\Community> cd ~
PS C:\Users\bellenot> C:\root\bin\thisroot.ps1
PS C:\Users\bellenot> root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.32.08                        https://root.cern |
  | (c) 1995-2024, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for win64 on Nov 14 2024, 09:53:39                         |
  | From tags/v6-32-08@v6-32-08                                      |
  | With MSVC 19.39.33521.0                                          |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |
   ------------------------------------------------------------------

root [0]

Thanks!

1.) Could you, please, run the example below with “.x test.cpp” twice. The second time it fails.
2.) Could you compile it with “.x test.cpp++”. It returns an error.

My experience is with older versions of root. Never had the above problems.

I am used to running heavy scripts, which have to be compiled, otherwise they take long. The interpreter is not an option for those.

Here is my example “test.cpp”

#include "iostream"
using namespace std;
void test()
{ cout<<"blabla"<<endl;}

Right, there are still issues with unloading…

**********************************************************************
** Visual Studio 2022 Developer PowerShell v17.12.1
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************
PS C:\Program Files\Microsoft Visual Studio\2022\Community> cd C:\root-dev\
PS C:\root-dev> C:\root\bin\thisroot.ps1
PS C:\root-dev> root -l test.cpp++
root [0]
Processing test.cpp++...
Info in <TWinNTSystem::ACLiC>: creating shared library C:/root-dev/test_cpp.dll
test_cpp_ACLiC_dict.cxx
   Creating library C:/root-dev\test_cpp.lib and object C:/root-dev\test_cpp.exp
test_cpp_ACLiC_dict.cxx
   Creating library C:/root-dev\test_cpp.lib and object C:/root-dev\test_cpp.exp
blabla
root [1]

It does not compile for me.

As the error message it telling, you build fox x86 architecture while ROOT has been built for x64. Please start a x64 PowerShell (make sure the DevCmdArguments are -arch=x64 -host_arch=x64)

It seems the only PS installed by visual studio is not 64bit.
1.) Can you, please, give me the exact syntaxis to set the DevCmdArguments?
2.) Or, would you recommend I download the 32bit binaries of root?

Do you really need PowerShell? Can you try first with a x64 Native Tools Command Prompt for VS 2022? I personally use a Windows Terminal (Version: 1.21.3231.0) from where you can invoke several command prompts and PowerShell

I am not IT, so my knowledge is basic. Yes, I prefer powershell, but cmd might be ok.

1.) Can’t setup the environment variables in cmd, which in powershell is done with: “C:\root\bin\thisroot.ps1”. Should I use the installation package instead?

2.) In the past I had a PS profile which setup VS for use in the powershell, and I used the installation package to set the variables for root. Can you provide a powershell profile that does both? Here is roughly (some folder names are guessed) what I had in the past, but I did not write it myself, so I hardly understand it.

## Aliases.ps1 -- to be dot-sourced from your profile
if($Host.Version.Major -ge 2) {
   function script:Resolve-Aliases
   {
      param($line)

      [System.Management.Automation.PSParser]::Tokenize($line,[ref]$null) | % {
         if($_.Type -eq "Command") {
            if($cmd.CommandType -eq "Alias") {
               $line = $line.Remove( $_.StartColumn -1, $_.Length ).Insert( $_.StartColumn -1, $cmd.Definition )
            }
         }
      }
      $line
   }
}

function alias {
   # pull together all the args and then split on =
   $alias,$cmd = [string]::join(" ",$args).split("=",2) | % { $_.trim()}

   if($Host.Version.Major -ge 2) {
      $cmd = Resolve-Aliases $cmd
   }
   New-Item -Path function: -Name "Global:Alias$Alias" -Options "AllScope" -Value @"
Invoke-Expression '$cmd `$args'
###ALIAS###
"@

   Set-Alias -Name $Alias -Value "Alias$Alias" -Description "A UNIX-style alias using functions" -Option "AllScope" -scope Global -passThru
}

function unalias([string]$Alias,[switch]$Force){
   if( (Get-Alias $Alias).Description -eq "A UNIX-style alias using functions" ) {
      Remove-Item "function:Alias$Alias" -Force:$Force
      Remove-Item "alias:$alias" -Force:$Force
      if($?) {
         "Removed alias '$Alias' and accompanying function"
      }
   } else {
      Remove-Item "alias:$alias" -Force:$Force
      if($?) {
         "Removed alias '$Alias'"
      }
   }
}

alias rt='root -l'
alias rq='root -l -q'

pushd "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
foreach {
  if ($_ -match "=") {
    $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
  }
}
popd
#Write-Host "`nVisual Studio 2022 Command Prompt variables set." -ForegroundColor Yellow

D:

cls

In the command prompt you have to call C:\root\bin\thisroot.bat
Then if you really want PowerShell, here is the command used in my Windows terminal:

powershell.exe -NoExit -Command "&{Import-Module """C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell 095cf59e -SkipAutomaticLocation -DevCmdArguments """-arch=x64 -host_arch=x64"""}"

Thanks. The simple example compiles in cmd. Older files which ran fine in root 5, however, do not. I will dig into this separately.

Thank you for your time. Feel free to close the topic.
, Deyan

1 Like

OK, thanks for the feedback

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