-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Nim Version
Any in the last 8 years.
Description
The use of a shared nimcache folder can be a source of very bizarre errors, especially when used on a CI host with jobs running in parallel. One such issue was encountered in:
Where either via some sort of corruption or other weird race condition the nimcache directory became broken and had to be remove to stop the following error from happening:
x86_64-w64-mingw32/bin/ld.exe:
C:\Users\jenkins\nimcache\koch_d\@mlib@sstd@sprivate@swin_setenv.nim.c.o:@mlib@sstd@sprivate@swin_setenv.nim.c:
(.rdata$.refptr.__imp__environ[.refptr.__imp__environ]+0x0): undefined reference to `__imp__environ'
collect2.exe: error: ld returned 1 exit status
On Linux this can be partially mitigated by pointing XDG_CACHE_HOME at something like WORKSPACE_TMP or similar, but in case of Windows it just uses os.getHomeDir():
Lines 806 to 810 in ab00c56
| proc getOsCacheDir(): string = | |
| when defined(posix): | |
| result = getEnv("XDG_CACHE_HOME", getHomeDir() / ".cache") / "nim" | |
| else: | |
| result = getHomeDir() / genSubDir.string |
The issue with that is that overriding USERPROFILE on Windows can have way more unexpected results than just overriding XDG_CACHE_HOME on Linux. This is also not the first time I've encountered issues with shared nimcache in CI.
For this reason I'd like to propose either:
- A
NIMCACHEenvironment variable to specify the directory explicitly instead of indirectly. - A modification to
getOsCacheDirthat would prevent weird errors like above from happening.
Current Output
Expected Output
Known Workarounds
Remove nimcache after every build... except that can kill another parallel job running that uses it.
Additional Information
No response