fix(agent): through the work drive, clang runs its compile in-process and finds its linker there #47
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!47
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Beanstalk:fix/win-clang-drive"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
#46 works as far as it goes. On futondestroyer's PC (nightly-86, rp_d3667d4312a3f2db, Longshot #910) the sandbox sees the work drive (
BEANSTALK_WORK_DRIVE Z:), andclang-23.exe --versionruns: directly, through the launcher, and withCreateProcessW.GetLongPathNameWsucceeds too. Butmake_game.py's compile-and-link check still failed:That's the real path again, not
Z:\. clang's driver resolves its own path through the drive back to the real folder ("canonical prefixes",GetExecutablePath→getMainExecutable→real_path). It then starts its compile (-cc1) and its linker from that real path, and LLVM's start is refused there exactly as before.--versionnever starts either, which is why the probe passed.The driver decides canonical prefixes before it reads
CCC_OVERRIDE_OPTIONS(clang/tools/driver/driver.cpp, around lines 282–325), so-no-canonical-prefixescan't be added through that variable. Two things it decides after reading it can:-fintegrated-cc1: run the compile in the same process, so nothing is started from the real path;-B<drive>\tools\llvm-mingw\bin: look up the linker (ld.lld) there first, so it starts from the drive.What changed
WinDrive.ClangOverride:#+-fintegrated-cc1 +-B<llvm-mingw on the drive>\bin. The#makes clang apply it silently. It returns null when llvm-mingw isn't on the drive, or when its path has a space, because the variable splits on spaces.WinSandbox.Prepare: when the drive is used, sandboxed commands get that asCCC_OVERRIDE_OPTIONS, unless it's already set.make_game.pydoes, once with the override and once without. It also printsCCC_OVERRIDE_OPTIONS.Testing
dotnet build agent/App -c Release: 0 warnings.@@probe spawn compile … exit 0) and fails without it. Its report shows how farmain's build gets. Another tool started by its canonical path could still fail the same way; the probe and the build log would show that.