xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.14k stars 782 forks source link

Error and xmake freeze during project configuration with glfw package: `cannot remove directory Unknown Error (145)` #5622

Closed yh-sb closed 2 months ago

yh-sb commented 2 months ago

Xmake Version

2.9.5

Operating System Version and Architecture

Windows 11 23H2 22631.4037

Describe Bug

5/5 reproduce:

  1. Remove .xamke directory: C:\Users\Y\AppData\Local\.xmake
  2. Configure the project xmake f -p mingw -y and see error:

    checking for architecture ... x86_64
    checking for mingw directory ... C:\Program Files\mydevtools\MinGW-w64
    updating repositories .. ok
    checking for Microsoft Visual Studio (x64) version ... 2022
    checking for Microsoft C/C++ Compiler (x64) version ... 19.40.33812
    => download https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz .. ok
    => download https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz .. ok
    => install glfw#1 3.4 .. failed
    
    cannot remove directory C:\Users\Y\AppData\Local\Temp\.xmake\240915.dir\glfw\release Unknown Error (145)
    if you want to get more verbose errors, please see:
    -> C:\Users\Y\AppData\Local\.xmake\cache\packages\2409\g\glfw_1\3.4\installdir.failed\logs\install.txt
    => install glfw 3.4 .. failed
    
    cannot remove directory C:\Users\Y\AppData\Local\Temp\.xmake\240915.dir\glfw\release Unknown Error (145)
    if you want to get more verbose errors, please see:
    -> C:\Users\Y\AppData\Local\.xmake\cache\packages\2409\g\glfw\3.4\installdir.failed\logs\install.txt
    => download https://github.com/xmake-mirror/python-windows/releases/download/3.12.3/python-3.12.3.win64.zip .. ok
    => install python 3.12.3 .. ok
    => download https://github.com/Dav1dde/glad/archive/v0.1.36.tar.gz .. ok
    => install glad v0.1.36 .. ok
    error: install failed!

    Very often the xmake f -p mingw -f hangs in the end at line => install python 3.12.3 .. ok. So, the only way to exit is to press Ctrl+C. It hangs even GitHub Actions for hours, so I need to cancel workflow manually.

Content of C:\Users\Y\AppData\Local\.xmake\cache\packages\2409\g\glfw\3.4\installdir.failed\logs\install.txt:

cannot remove directory C:\Users\Y\AppData\Local\Temp\.xmake\240915.dir\glfw\release Unknown Error (145)

Sometimes I see duplicated error messages. Maybe there is problem with multithreading?

  => install glfw#1 3.4 .. failed

cannot remove directory C:\Users\Y\AppData\Local\Temp\.xmake\240915.dir\glfw\release Unknown Error (145)
if you want to get more verbose errors, please see:
  -> C:\Users\Y\AppData\Local\.xmake\cache\packages\2409\g\glfw_1\3.4\installdir.failed\logs\install.txt
  => install glfw 3.4 .. failed

cannot remove directory C:\Users\Y\AppData\Local\Temp\.xmake\240915.dir\glfw\release Unknown Error (145)
if you want to get more verbose errors, please see:
  -> C:\Users\Y\AppData\Local\.xmake\cache\packages\2409\g\glfw\3.4\installdir.failed\logs\install.txt

Important notes:

Expected Behavior

xmake f -p mingw -y finishes successfully.

Project Configuration

add_rules("mode.debug", "mode.release", "plugin.compile_commands.autoupdate", {outputdir = "build"})
set_defaultmode("debug")
set_targetdir("$(buildir)")

add_requires("glfw 3.4", "glad", "imgui v1.91.0", {configs = {glfw_opengl3 = true}})

target("opengl-app")
    add_packages("glfw", "glad", "imgui")
    add_files("main.cpp")

Additional Information and Error Logs

Issue is never reproduced if I add -vD options

waruqi commented 2 months ago

try it again. xmake update -s dev

yh-sb commented 2 months ago

Fixed. Thank you.

Just in case, I still see duplicated download ... glfw, install glfw#1 3.4 .. ok and install glfw 3.4 .. ok messages, but no errors anymore.

checking for architecture ... x86_64
checking for mingw directory ... C:\Program Files\mydevtools\MinGW-w64
updating repositories .. ok
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.40.33812
  => download https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz .. ok
  => download https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz .. ok
  => download https://github.com/xmake-mirror/python-windows/releases/download/3.12.3/python-3.12.3.win64.zip .. ok
  => install glfw#1 3.4 .. ok
  => download https://github.com/ocornut/imgui/archive/refs/tags/v1.91.0.tar.gz .. ok
  => install glfw 3.4 .. ok
  => install imgui v1.91.0 .. ok
  => install python 3.12.3 .. ok      
  => download https://github.com/Dav1dde/glad/archive/v0.1.36.tar.gz .. ok
  => install glad v0.1.36 .. ok
waruqi commented 2 months ago

This is not a bug, you have two different configurations of glfw packages that need to be installed in your project.

glfw with glfw_opengl3 config

add_requires("glfw 3.4", {configs = {glfw_opengl3 = true}})
  -> glfw 3.4 [glfw_opengl3:y]

and from imgui.glfw without configs

  -> glfw#1 3.4 [from:imgui]