ninja: Permission denied on windows

Ninja 1.8.2 and 1.9.0 reproduced. In a project creating many static libraries with cmake,

[build] FAILED: Common/05_MCU_abstract_layer/libmal_interrupt.a 
[build] cmd.exe /C "cd . && C:\GIT\FW_Toolchain\cmake\bin\cmake.exe -E remove Common\05_MCU_abstract_layer\libmal_interrupt.a && C:\GIT\FW_TOO~1\GNUTOO~1\7-2018~1\bin\ARM-NO~2.EXE qc Common\05_MCU_abstract_layer\libmal_interrupt.a  Common/05_MCU_abstract_layer/CMakeFiles/mal_interrupt.dir/interrupt/mal_interrupt.c.obj && C:\GIT\FW_TOO~1\GNUTOO~1\7-2018~1\bin\AR17F9~1.EXE Common\05_MCU_abstract_layer\libmal_interrupt.a && cd ."
[build] C:\GIT\FW_TOO~1\GNUTOO~1\7-2018~1\bin\AR17F9~1.EXE: Common\05_MCU_abstract_layer\libmal_interrupt.a: Permission denied

The issue is spurious, not always on same file. When running serial instead parallel, the problem disappear. Also just continuing build when it fails seem to permit finishing the build. I found someone with the same problem (in german) here . I think this could come from parallel (or too fast) access to same files in windows.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Similar issue here

Error   CMake Error:
  Running

   'C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '-C' 'C:/Users/admin/Desktop/REPOS/libuv.git/out/build/x64-Debug' '-t' 'restat' 'build.ninja'

  failed with:

   ninja: error: failed recompaction: Permission denied   C:\Users\admin\Desktop\REPOS\libuv.git\   ninja   

Just to confirm that this bug is still present in 1.10.1. Any chance you guys could try rebuilding binuitils per @kromancer 's link before you do the next version, to see if that solves the problem?