Thread overview
[Issue 22645] Linking fails with fatal error LNK1318: Unexpected PDB-error: OK (0) ""
[Issue 22645] Compilation fails with fatal error LNK1318: Unexpected PDB-error: OK (0) ""
January 03, 2022
https://issues.dlang.org/show_bug.cgi?id=22645

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |backend
                 CC|                            |moonlightsentinel@disroot.o
                   |                            |rg

--- Comment #1 from moonlightsentinel@disroot.org ---
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.

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

moonlightsentinel@disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Compilation fails with      |Linking fails with fatal
                   |fatal error LNK1318:        |error LNK1318: Unexpected
                   |Unexpected PDB-error: OK    |PDB-error: OK (0) ""
                   |(0) ""                      |

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

--- Comment #2 from simon.vanbernem@yahoo.de ---
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.

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

--- Comment #3 from moonlightsentinel@disroot.org ---
(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)

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

--- Comment #4 from simon.vanbernem@yahoo.de ---
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.

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

--- Comment #5 from simon.vanbernem@yahoo.de ---
(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.

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

--- Comment #6 from moonlightsentinel@disroot.org ---
(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.

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

--- Comment #7 from simon.vanbernem@yahoo.de ---
> Sure. For the future, note that dusmite can reduce projects (mostly)
> automatic.

Very nice tool, didn't know about that!

--