Geant4 Windows 10 installation guide

The instructions for how to install Geant4 on Windows http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/InstallationGuide/html/installguide.html includes the step, “confirm that you have the MSVC compiler available by running the cl command.” After I have confirmed that my ‘cl’ command is not available, what do I do?

If I continue in the installation process and run

cmake -DCMAKE_INSTALL_PREFIX=“C:\Geant4\geant4_10_06-install” “C:\Geant4\geant4_10_06”

The error message says, " cl
is not a full path and was not found in the PATH.

To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).

Tell CMake where to find the compiler by setting either the environment
variable “CC” or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH."

I need more explicit directions how to do this.

Thanks

Just to confirm you are running the Developer Command prompt that comes with Visual Studio, which looks like this:

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.23
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************

C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress>

rather than the ‘normal’ Command Prompt, which looks like this:

Microsoft Windows [Version 10.0.18363.900]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\>

I am running the Developer Command prompt, and I still get the error.

Can you please run echo %PATH:;=&echo.% from the Developer Command prompt and post the output.

echo %PATH:;=&echo.%
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\Performance Tools
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\vs2019
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86
C:\Program Files (x86)\Windows Kits\10\bin\x86
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools
C:\Program Files\LLNL\VisIt 3.0.0
C:\Program Files\Microsoft HPC Pack 2008 R2\Bin
C:\Program Files (x86)\Intel\iCLS Client
C:\Program Files\Intel\iCLS Client
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0
C:\Program Files (x86)\Intel\Intel® Management Engine Components\DAL
C:\Program Files\Intel\Intel® Management Engine Components\DAL
C:\Program Files (x86)\Intel\Intel® Management Engine Components\IPT
C:\Program Files\Intel\Intel® Management Engine Components\IPT
C:\WINDOWS\System32\OpenSSH
D:\Program Files\MATLAB\R2020b\runtime\win64
D:\Program Files\MATLAB\R2020b\bin
D:\Program Files\MATLAB\R2019a\runtime\win64
D:\Program Files\MATLAB\R2019a\bin
C:\Program Files\PuTTY
C:\Program Files (x86)\Wolfram Research\WolframScript
C:\Program Files\CMake\bin
C:\Users\etbas\AppData\Local\Microsoft\WindowsApps

C:\Geant4\geant4_10_06-build>

I think someone with more knowledge of Windows and Visual Studio will have to help debug this further. My PATH looks to be similar (apart from me having the 2017 version)

>echo %PATH:;=&echo.%
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE\VC\VCPackages
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE\CommonExtensions\Microsoft\TestWindow
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\MSBuild\15.0\bin\Roslyn
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86
C:\Program Files (x86)\Windows Kits\10\bin\x86
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\\MSBuild\15.0\bin
C:\Windows\Microsoft.NET\Framework\v4.0.30319
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE\
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\Tools\
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
C:\Program Files\Python37\Scripts\
C:\Program Files\Python37\
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\

but notice I have 2 additional paths at the start, and this is where the cl command lives on my system

**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.9.23
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************

C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27040 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

usage: cl [ option... ] filename... [ /link linkoption... ]

C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress>where cl
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x86\cl.exe

Do you have a VC folder? Looking at your PATH I guess it would be here

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC

Yes I have a VC folder.

I followed this guide https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/
to add those two paths to my path and now my computer recognizes the cl command.

And the build is successful. Thanks for the help.

1 Like

I am trying to install Geant4 on a work computer that I do not have admin rights to so I am very limited in what changes I can do to paths and such. I’ve even been unable to install CMake properly, but found a workaround using a Conda environment. I am getting the error:

aeglick\Documents\GEANT4.10.07\geant4-source"
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:33 (project):
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:33 (project):
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "C://CMakeFiles/CMakeOutput.log".
See also "C://CMakeFiles/CMakeError.log".
CMake Error: Cannot open file for write: C://CMakeCache.txt.tmp
CMake Error: : System Error: Permission denied
CMake Error: Unable to open cache file for save. C://CMakeCache.txt
CMake Error: : System Error: Permission denied

Is this due to how I installed CMake using Conda or is there something else going on? I’ve never used Windows before so I’m not clear where to even look to find the cause of this error.