Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied on windows #1646

Open
atsju opened this issue Sep 6, 2019 · 16 comments
Open

Permission denied on windows #1646

atsju opened this issue Sep 6, 2019 · 16 comments

Comments

@atsju
Copy link

atsju commented Sep 6, 2019

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.

@atsju
Copy link
Author

atsju commented Sep 9, 2019

I reproduced on several windows 10 environments. I suspected mcafee on-scann access but this is not the case as one of the computer has no mcafee or other specific virus scan installed.
Please let me know if I must give some more information

Also in the project, many static libs depend on the same static lib.

@nicolasdespres
Copy link
Contributor

nicolasdespres commented Oct 31, 2019 via email

@atsju
Copy link
Author

atsju commented Oct 31, 2019

Thank you Nicolas.
I used the same workaround but this should be fixed. I cannot share my example but do you have a shareable minimal code to reproduce the issue ? This could help to fix it.

@nicolasdespres
Copy link
Contributor

nicolasdespres commented Oct 31, 2019 via email

@atsju
Copy link
Author

atsju commented Nov 28, 2019

A minimal project to reproduce the bug can be found in this repository. The project has mainly empty file but many diamond dependencies between static libraries.
I build on windows 10 with arm-none-eabi-gcc 7-2018-q2 on VScode.
The project may need to build several times to reproduce the issue.
Please let me know if you can reproduce and if you need more information.

@kromancer
Copy link

Maybe this is relevant, it might not be a ninja issue afterall:
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1848002

@Vox-Ben
Copy link

Vox-Ben commented Jul 28, 2020

I have this same problem, Ninja 1.10.0. Any news on a fix? Working around it by disabling threading is painful...

@leoatinnovation
Copy link

Hi Vox-Ben,

I'm also facing the same problem. what is the workaround ?

@Vox-Ben
Copy link

Vox-Ben commented Aug 10, 2020

@leoatinnovation If you pass -j 1 to Ninja it runs only on a single thread (I think the default is three, in normal operation you can set it to whatever you like - ideally probably the same number of (virtual) processor cores that your build machine has). This avoids the bug by not running multiple threads that can conflict, but it reduces the speed. I got about a 50% speed reduction over the three-thread default, if you were otherwise using more threads to start with it'd be worse.

@Vox-Ben
Copy link

Vox-Ben commented Sep 10, 2020

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?

@juangburgos
Copy link

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   

@ocroquette
Copy link

Similar issue here, using Ninja 1.10.2:

CMake Error: Running '.../ninja.exe' '-C' '... '-t' 'recompact'

  failed with:

   ninja: error: failed recompaction: Permission denied

@jonesmz

This comment was marked as abuse.

@Ashafix
Copy link

Ashafix commented May 21, 2023

Bit late to the party but in my case directory names with spaces caused the issue.
I've created a symlink
mklink /D "c:\ProgramFiles\NVIDIA_GPU_Computing_Toolkit" "c:\Program Files\NVIDIA GPU Computing Toolkit"
and the the environment variables CUDA_HOME and CUDA_PATH to the new directory
set CUDA_PATH="c:\ProgramFiles\NVIDIA_GPU_Computing_Toolkit\CUDA\v11.8"
set CUDA_HOME=%CUDA_PATH%

@Frisk4973
Copy link

help
C:\aseprite\build>C:\users\rgb_m\ninja-win\ninja.exe -f C:\aseprite
ninja: error: loading 'C:\aseprite': Access is denied.
if you're wondering why i kept the username in the path when making this comment, it's because it's not my actual name (obviously)

@clshortfuse
Copy link

I had to delete my build folder. No idea why, but fixed my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests