0003 - Self-inflicted gunshot wound #1
As is inevitable, I already shot myself in the foot, causing a build error on all projects simultaneously. Fortunately, I was able to diagnose the issue and ultimately fix it in ~1 hour, with no prior knowledge whatsoever.
Context
I cloned the project repo, installed Visual Studio 2013, and registered my Source mod as a game in Steam (by adding it to my local sourcemods folder). For my setup, I decided to add a symlink from my project's [...]/mp/game/mod_hl2mp
folder into [...]/Steam/steamspps/sourcemods/sourcedive
, so that changes made to the project would reflect immediately on Steam.
The mistake and its symptoms
Then, I changed the name of the parent folder that contains the project, from source-sdk-2013
to sourcedive
. I assumed that everything within this folder would be self-contained – as in having no dependencies or references outside itself.
As it turns out, I was wrong.
Building the games solution immediately began failing. Every project in the solution failed to build, constantly, with near-identical error messages:
Error 101 error MSB3073: The command "if EXIST ..\lib\public\.\mathlib.lib ( for /f "delims=" %%A in ('attrib "..\lib\public\.\mathlib.lib"') do set valveTmpIsReadOnly="%%A"
) else ( if not EXIST ..\lib\public\. mkdir ..\lib\public\. )
set valveTmpIsReadOnlyLetter=%valveTmpIsReadOnly:~6,1%
if "%valveTmpIsReadOnlyLetter%"=="R" (
attrib -r ..\lib\public\.\mathlib.lib
..\devtools\bin\gnu\touch.exe -d "1999-01-01" ..\lib\public\.\mathlib.lib
attrib +r ..\lib\public\.\mathlib.lib
)
if exist "..\devtools\bin\vpc.exe" "..\devtools\bin\vpc.exe" -crc2 "mathlib.vcxproj"
if ERRORLEVEL 1 exit /b 1
:VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 122 5
My first thoughts were:
- Could
mathlib.lib
be missing? Could we not have the "user" permissions to modify its "file" permissions? - Could
touch.exe
be missing? - Could
vpc.exe
be missing?
Unfortunately, those questions led me nowhere. The programs and files existed (thanks, Everything)[1], and I was able to reproduce the commands described in the error message with no issue.
One thing that caught my eye, however, was the use of relative paths (eg. ..\devtools\bin\vpc.exe
). When I reproduced the commands on my own terminal, I used absolute paths for my own convenience. I navigated to the project's folder, and reproduced the commands there.
vpc.exe
is Valve Project Creator, a self-describing tool. This time, I could see that it was the reason the build was failing (as opposed to, say, touch.exe
), as it errored with the following message:
Unable to load C:\Users\gctri\Desktop\source-sdk-2013\mp\src\devtools\bin\vpc.exe for comparison.
I noticed that it still references the old name, source-sdk-2013
, as opposed to the new name, sourcedive
. Given that all these projects are Visual Studio-based, I decided to take a look at each individual project file.
My suspicions were right, and there were multiple references to the old name. I promptly found+replaced the old name for the new one, and tried again. This time, I got a different error message for many of the projects:
Stale: 'tier1.vcxproj' Requires Rebuild. [Unable to load C:\Users\gctri\Desktop\source-sdk-2013\mp\src\devtools\bin\vpc.exe for comparison.]
Parsing: tier1.vpc
Saving... Project: 'tier1' File: 'tier1.vcxproj'
I had made sure that there was no other reference to the old name, yet there it was again.
What gives?
The solution
As it turns out, when vpc.exe
runs with the -crc2
flag, it creates some files with extension *.vpc_crc
which yet again stored a copy of the absolute path with the old name. Using Everything, I found all of those files, and once again promptly found+replace the old name for the new one.
The solution then built, ran, and debugged as expected. 😄
Footnotes
[1] = You can install Everything by running winget install voidtools.everything
, which is the modern (and my preferred) method of installing programs on Windows.