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

failed recompaction: Permission denied #2493

Open
Selviniahh opened this issue Sep 5, 2024 · 1 comment
Open

failed recompaction: Permission denied #2493

Selviniahh opened this issue Sep 5, 2024 · 1 comment

Comments

@Selviniahh
Copy link

Selviniahh commented Sep 5, 2024

I only get this error failed recompaction: Permission denied if I want to force running cmake twice. Here's my minimal cmake file and the minimal project itself

untitled.zip

project(untitled)
set(CMAKE_CXX_STANDARD 20)

# Increment counter
file(READ "${CMAKE_SOURCE_DIR}/Counter.txt" COUNTER)
MATH(EXPR COUNTER "${COUNTER}+1")
file(WRITE "${CMAKE_SOURCE_DIR}/Counter.txt" "${COUNTER}")

add_executable(untitled main.cpp)
# Create a custom target to run CMake again
add_custom_command(TARGET untitled POST_BUILD
        COMMAND cmake CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
        CMAKE_C_COMPILER=${CMAKE_C_COMPILER} CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -G "${CMAKE_GENERATOR}"
        -S ${CMAKE_SOURCE_DIR} -B ${CMAKE_BINARY_DIR})

message(${CMAKE_COMMAND})

ninja's output with -v note that, with MinGW and native ninja on windows, it's same.

FAILED: untitled.exe 
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\clang64\bin\clang++.exe -g  CMakeFiles/untitled.dir/main.cpp.obj -o untitled.exe -Wl,--out-implib,libuntitled.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && C:\WINDOWS\system32\cmd.exe /C "cd /D C:\Users\xqwys\CLionProjects\untitled\cmake-build-debug-mingw-clang && C:\Users\xqwys\AppData\Local\Programs\CLion\bin\cmake\win\x64\bin\cmake.exe -G Ninja -S C:/Users/xqwys/CLionProjects/untitled -B C:/Users/xqwys/CLionProjects/untitled/cmake-build-debug-mingw-clang""
C:/Users/xqwys/AppData/Local/Programs/CLion/bin/cmake/win/x64/bin/cmake.exe
-- Configuring done (0.2s)
-- Generating done (0.0s)
CMake Error:
  Running

   'C:/msys64/mingw64/bin/ninja.exe' '-C' 'C:/Users/xqwys/CLionProjects/untitled/cmake-build-debug-mingw-clang' '-t' 'recompact'

  failed with:

   ninja: error: failed recompaction: Permission denied



CMake Error:
  Running

   'C:/msys64/mingw64/bin/ninja.exe' '-C' 'C:/Users/xqwys/CLionProjects/untitled/cmake-build-debug-mingw-clang' '-t' 'restat' 'build.ninja'

  failed with:

   ninja: error: failed recompaction: Permission denied



CMake Generate step failed.  Build files cannot be regenerated correctly.
ninja: build stopped: subcommand failed.```



@Selviniahh
Copy link
Author

Today I just realized every time I get the same error at first try and when I just try to build the intermediates again WITHOUT DOING ANYTHING it just works, yeah that's all It's just works.

I made a video: https://www.youtube.com/watch?v=weA4eTKaESU

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

No branches or pull requests

1 participant