googleapis / google-cloud-cpp

C++ Client Libraries for Google Cloud Services
https://cloud.google.com/
Apache License 2.0
554 stars 373 forks source link

Windows build fails with `Failed to write the updated manifest to the resource of file` #12141

Closed coryan closed 1 year ago

coryan commented 1 year ago

We are starting to see failures like:

cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=google\cloud\spanner\CMakeFiles\spanner_json_test.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1435~1.322\bin\HostX64\x64\link.exe /nologo @CMakeFiles\spanner_json_test.rsp  /out:google\cloud\spanner\json_test.exe /implib:google\cloud\spanner\json_test.lib /pdb:google\cloud\spanner\json_test.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console  && cmd.exe /C "cd /D C:\b\google\cloud\spanner && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Users/runneradmin/AppData/Local/Temp/.build/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/b/google/cloud/spanner/json_test.exe -installedDir C:/b/vcpkg_installed/x64-windows/bin -OutVariable out""
MT: command "C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe /nologo /manifest google\cloud\spanner\json_test.exe.manifest /outputresource:google\cloud\spanner\json_test.exe;#1" failed (exit code 0x1f) with the following output:

mt.exe : general error c101008d: Failed to write the updated manifest to the resource of file "google\cloud\spanner\json_test.exe". The process cannot access the file because it is being used by another process.

https://github.com/googleapis/google-cloud-cpp/actions/runs/5590756547/jobs/10220902610?pr=12140#step:10:2912 https://github.com/googleapis/google-cloud-cpp/actions/runs/5590756547/jobs/10220902708?pr=12140#step:10:1795

coryan commented 1 year ago

We could workaround this by putting a retry loop on the build step, similar to #12127

coryan commented 1 year ago

We also had these problems in Kokoro, e.g., #9567 and #5536, we worked around the problem by disabling AV software. OTOH, the Internet suggests one should disable manifest generation:

https://stackoverflow.com/questions/3775406/mt-exe-general-error-c101008d-failed-to-write-the-updated-manifest-to-the-res

These links may be useful too:

https://learn.microsoft.com/en-us/cpp/build/understanding-manifest-generation-for-c-cpp-programs?view=msvc-170 https://learn.microsoft.com/en-us/windows/win32/sbscs/mt-exe https://cmake.org/cmake/help/v3.0/variable/CMAKE_EXE_LINKER_FLAGS.html

coryan commented 1 year ago

https://github.com/googleapis/google-cloud-cpp/actions/runs/5590352328/jobs/10219969659#step:10:2053

coryan commented 1 year ago

We no longer use Kokoro, closing.