Comment #0 by simon.vanbernem — 2022-01-03T09:27:01Z
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.
Comment #1 by moonlightsentinel — 2022-01-03T12:47:21Z
Could you provide the source files or ideally a reduced example? It'll be hard to diagnose the problem solely based on the error message.
Comment #2 by simon.vanbernem — 2022-01-03T13:08:29Z
I can try to create a minimal example, but tbh I don't have a lot of hope of this reproducing:
Just using the same flags on a simple program doesn't repro. Having different objs in the error on each run seems like there is some parallelism involved, and the fact that it worked (sometimes) after a version upgrade (and now also 2 times after using ldc for a while 2) sounds like the compiler is caching bad state that causes the issue. So even if I sent you the entire project, what are the chances of having an issue with parallelism and caching behaviour repro for other people? It doesn't even repro for me for the same code all the time.
I hoped the error could be diagnosed somewhat easily without a repro, because the PDB-Error here is 0 and the error message is just empty. That sounds to me like some part of the linker uses something other than this error code to diagnose an error, but that something is not enough information to determine there is an error, so the linker exits even though there is no PDB-error.
If you think there is value to it I can continue to try to find a minimal example or send you the projects, but I personally hoped that inspecting the way PDB errors are handled might already yield something.
Comment #3 by moonlightsentinel — 2022-01-03T13:20:52Z
(In reply to simon.vanbernem from comment #2)
> If you think there is value to it I can continue to try to find a minimal
> example or send you the projects, but I personally hoped that inspecting the
> way PDB errors are handled might already yield something.
A minimal example would definitly help. Note that the error messages are issued by LINK.exe (provided by VS), not dmd itself.
Does LINK.exe fail reliably when you rerun the linker manually?
(Use `-v` to get the command line issued by dmd)
Comment #4 by simon.vanbernem — 2022-01-03T13:32:11Z
If I use the link command that -v gives me, the linker fails because it can't find phobos64.lib. If I fix the arguments by giving the full path, at first it linked successfully, repeatedly. I then ran dmd once. It failed. I then ran link.exe again. It now also failed, repeatedly.
Comment #5 by simon.vanbernem — 2022-01-04T13:47:44Z
(In reply to moonlightsentinel from comment #3)
> (In reply to simon.vanbernem from comment #2)
> > If you think there is value to it I can continue to try to find a minimal
> > example or send you the projects, but I personally hoped that inspecting the
> > way PDB errors are handled might already yield something.
>
> A minimal example would definitly help. Note that the error messages are
> issued by LINK.exe (provided by VS), not dmd itself.
>
> Does LINK.exe fail reliably when you rerun the linker manually?
> (Use `-v` to get the command line issued by dmd)
I have uploaded my project to my onedrive here: https://1drv.ms/u/s!AsdZfH5hzKtphP4Do8VJERxBR94P8w?e=PM6fXl. Getting to the error (if it repros for you) should be as easy as unzipping and running the compile.bat file in the toplevel folder.
I didn't upload the project directly as an attachment here, because I don't want my code to just be on the internet indefinitely. The onedrive link will stay valid for two weeks.
I did not try to reduce the amount of code involved in the project. It is at 40k lines and before starting to invest a lot of time to randomly delete code all over the place and see when it still fails, I will just switch compilers.
Comment #6 by moonlightsentinel — 2022-01-04T13:50:23Z
(In reply to simon.vanbernem from comment #5)
> I have uploaded my project to my onedrive here:
> https://1drv.ms/u/s!AsdZfH5hzKtphP4Do8VJERxBR94P8w?e=PM6fXl. Getting to the
> error (if it repros for you) should be as easy as unzipping and running the
> compile.bat file in the toplevel folder.
Thanks!
> I did not try to reduce the amount of code involved in the project. It is at
> 40k lines and before starting to invest a lot of time to randomly delete
> code all over the place and see when it still fails, I will just switch
> compilers.
Sure. For the future, note that dusmite can reduce projects (mostly) automatic.
Comment #7 by simon.vanbernem — 2022-01-04T13:55:08Z
> Sure. For the future, note that dusmite can reduce projects (mostly)
> automatic.
Very nice tool, didn't know about that!
Comment #8 by robert.schadek — 2024-12-13T19:20:13Z