January 03, 2022
https://issues.dlang.org/show_bug.cgi?id=22645

          Issue ID: 22645
           Summary: Compilation fails with fatal error LNK1318: Unexpected
                    PDB-error: OK (0) ""
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: simon.vanbernem@yahoo.de

When compiling my project using DMD v2.098.0 or DMD v2.098.1 on Windows 10 64-bit, this error just appeared:

: fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0) "".
Error: linker exited with status 1318

"Unerwarteter PDB-Fehler" means "Unexpected PDB-error". The next 3 attempts to compile yielded the following errors:

libucrtd.lib(lseek.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0)
"".
Error: linker exited with status 1318

libucrtd.lib(initcon.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK
(0) "".
Error: linker exited with status 1318

libucrtd.lib(round.obj) : fatal error LNK1318: Unerwarteter PDB-Fehler: OK (0)
"".
Error: linker exited with status 1318

The obj file reported seems to pretty much be picked at random. In the first error message there simply was no lib/obj mentioned. This issue started appearing today, without installing any updates (to any program at all). The PC wasn't even shut down since yesterday, when everything worked fine. Restarting doesn't help, removing all obj files and doing a full rebuild also doesn't help (I have obj files built by MSVC that also get linked). I was on v2.098.0 before, then upgraded in hopes of fixing the issue. The very first compile after upgrading to v2.098.1 worked, every consecutive compile after that is broken again.

The command line call to dmd looks like this:

dmd -m64 -I=source -i -w -preview=fieldwise user32.lib kernel32.lib d3d11.lib d3dcompiler.lib dxguid.lib ole32.lib advapi32.lib Bcrypt.lib Iphlpapi.lib Ws2_32.lib dsound.lib -g -debug -check=assert=on -check=bounds=on -check=switch=on -checkaction=C -mscrtlib=LIBCMTD source/main.d build/platform.obj build/imgui.obj build/box2d.obj build/nfd.obj -of=build/spaced.exe

I have switched to ldc in the meantime to be able to compile.

--