Geant4 Windows install using Conda environment

I am attempting to install Geant4 on a windows machine using conda because I don’t have administrative rights to this computer to install cmake any other way (it’s a work computer). I am getting an error I don’t understand. What is nmake? This is my first windows computer and I don’t know how to install Geant on it.

(base) C:\Users\aeglick\Documents\GEANT4.10.07\build>cmake -DCMAKE_CXX_COMPILER="C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/mingw-w64/bin/gcc.exe" -DCMAKE_C_COMPILER="C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/mingw-w64/bin/c++.exe"  -DMAKE_INSTALL_PREFIX="%HOMEPATH%Users\aeglick\Documents\GEANT4.10.07\geant4-install" "%HOMEPATH%Users\aeglick\Documents\GEANT4.10.07\geant4-source\geant4"
 -- Building for: NMake Makefiles   
 -- The C compiler identification is unknown
 -- The CXX compiler identification is GNU 5.3.0
 -- Check for working C compiler: C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/mingw-w64/bin/c++.exe       
CMake Error: Generator: execution of make failed. Make command was: nmake /nologo cmTC_c53df\fast &&                    
-- Check for working C compiler: C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/mingw-w64/bin/c++.exe - broken
CMake Error at C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):   
The C compiler
"C:/Users/aeglick/AppData/Local/Continuum/anaconda2/Library/mingw-w64/bin/c++.exe" 
is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/Users/aeglick/Documents/GEANT4.10.07/build/CMakeFiles/CMakeTmp

Run Build Command(s):nmake /nologo cmTC_c53df\fast && The system cannot find the file specified 
Generator: execution of make failed. Make command was: nmake /nologo cmTC_c53df\fast &&

CMake will not be able to correctly generate this project
Call Stack (most recent call first): 
CMakeLists.txt:30 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/aeglick/Documents/GEANT4.10.07/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/aeglick/Documents/GEANT4.10.07/build/CMakeFiles/CMakeError.log".  

I found some minor solutions that have allowed CMake to get further along, but nothing has worked absolutely. I now have the following in my CMakeLists.txt file:

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# - Make overrides for default flags, so they appear in interfaces
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
   ${CMAKE_SOURCE_DIR}/cmake/Modules/G4MakeRules_cxx.cmake)
set(CMAKE_CXX_COMPILER "C:/Users/aeglick/Anaconda3/Library/mingw-w64/bin/gcc.exe")
set(CMAKE_C_COMPILER "C:/Users/aeglick/Anaconda3/Library/mingw-w64/bin/cc.exe")  

However that inclusion of paths for gcc and cc cause a new error:

-- Checking C++ feature CXXSTDLIB_FILESYSTEM_NATIVE - Failed
-- Checking C++ feature CXXSTDLIB_FILESYSTEM_STDCXXFS - Failed
-- Checking C++ feature CXXSTDLIB_FILESYSTEM_CXXFS - Failed 
CMake Error at cmake/Modules/G4BuildSettings.cmake:249 (message):
No support for C++ filesystem found for compiler 'GNU', '5.3.0' 
Call Stack (most recent call first):
cmake/Modules/G4CMakeMain.cmake:53 (include) 
CMakeLists.txt:58 (include) 

How do I point to the CXXSTDLIB?

Conda/mingw on Windows isn’t a compiler/platform that we test or support, so I’m not sure I can provide much useful info, but here are some hints (and obviously further feedback, error reports are welcome):

  • In the first post, it looks like you’re using Geant4 10.7, whereas in the last 11.0-beta. I’d strongly recommend sticking with 10.7.2 as 11.0-beta is a beta, and also requires C++17 features which the GCC seemingly supplied by Conda/mingw (v5.3.0) is not able to support.
  • NMake is part of Visual Studio so will likely not be present if you don’t have that installed.
  • Conda/Anaconda and CMake should be able to install/use the Ninja build tool, with cmake -GNinja ... to generate the build scripts, ninja to build.
  • As Geant4’s only tested on Windows with Visual Studio, it’s possible further CMake checks/GCC compilation may fail due to assumptions the build scripts make about this combination, but, see how it goes.
  • There’s a stronger caveat still on Geant4Py as this, to my knowledge, has never been compiled/tested on Windows so it may well build but simply not run, or run but fail.

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