Geant4 installation in windows, getting error in cmake

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_v.11.2.1
_Operating System:_Windows 10
_Compiler/Version:_VS_2022
_CMake Version:_3.29.3
‘’’
CMake Error: Cannot open file for write: C:/Users/Meher/geant4-v11.2.1-build/CMakeCache.txt.tmpaac6a
CMake Error: Unable to (re)create the private pkgRedirects directory:
C:/Users/Meher/geant4-v11.2.1-build/CMakeFiles/pkgRedirects
This may be caused by not having read/write access to the build directory.
Try specifying a location with read/write access like:
cmake -B build
If using a CMake presets file, ensure that preset parameter
‘binaryDir’ expands to a writable directory.

CMake Error: : System Error: No such file or directory
CMake Error: Unable to open cache file for save. C:/Users/Meher/geant4-v11.2.1-build/CMakeCache.txt
CMake Error: : System Error: No such file or directory
‘’’


Have you checked that you have read/write permissions to C:/Users/Meher/geant4-v11.2.1-build? The error suggests that you don’t.

I have checked Sir, still its showing like this
‘’’
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
CMake Error at CMakeLists.txt:29 (project):
Failed to run MSBuild command:

C:/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/amd64/MSBuild.exe

to get the value of VCTargetsPath:

MSBuild version 17.8.3+195e7f5a3 for .NET Framework

Build started 21-05-2024 21:43:23.



Project "C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\VCTargetsPath.vcxproj" on node 1 (default targets).

PrepareForBuild:

  Creating directory "x64\Debug\".

  Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://aka.ms/cpp/structured-output for more details.

  Creating directory "x64\Debug\VCTargetsPath.tlog\".

InitializeBuildStatus:

  Creating "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

  Touching "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild".

PostBuildEvent:

  echo VCTargetsPath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\

  :VCEnd

  VCTargetsPath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\

FinalizeBuildStatus:

  Deleting file "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild".

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(409,5): error MSB3061: Unable to delete file "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild". Access to the path 'C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild' is denied. [C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\VCTargetsPath.vcxproj]

Done Building Project "C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.



Build FAILED.



"C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\VCTargetsPath.vcxproj" (default target) (1) ->

(FinalizeBuildStatus target) -> 

  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(409,5): error MSB3061: Unable to delete file "x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild". Access to the path 'C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\x64\Debug\VCTargetsPath.tlog\unsuccessfulbuild' is denied. [C:\Users\Meher\geant4-v11.2.1-build\CMakeFiles\3.29.3\VCTargetsPath.vcxproj]



    0 Warning(s)

    1 Error(s)



Time Elapsed 00:00:02.16

Exit code: 1

Configuring incomplete, errors occurred!
‘’’

There are still permissions issues here, all I can suggest is to delete these directories and start again. Check the permissions as you recreate things - this is nothing to do with Geant4’s build scripts, but with your system setup.

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