Thread overview
Compiling D files on Windows
Nov 16, 2022
Larry Hemsley
Nov 16, 2022
Adam D Ruppe
Nov 16, 2022
jussij
Nov 16, 2022
torhu
Nov 16, 2022
torhu
Nov 16, 2022
rikki cattermole
Nov 20, 2022
Larry Hemsley
Nov 20, 2022
Adam D Ruppe
Nov 21, 2022
rikki cattermole
November 16, 2022
It has been a long time since I have tried to compile D files
or build a D project on Windows. I was surprised since I asked
for verbose output to see that the Windows native linker was
called. I was also surprised to see the pdb file in the project
folder.

The problem is that the IDE I was using (Zeus) uses gdb to debug
files and the debugger issued a warning that there were no debug
symbols in the executable file. Obviously, because gdb expects
code view style debug symbols to be embedded in the executable.

If any one knows of a magic switch (undocumented or documented)
that reverts to the older code view style, I would be very
thankful to know it. I do know that cl.exe does have a compiler
switch for this, but I do not know if dmd calls cl.exe to do the
linking. From the verbose output it looks like dmd calls the
Windows native linker directly.

Thanks for helping
Larry
November 16, 2022
On Wednesday, 16 November 2022 at 22:02:41 UTC, Larry Hemsley wrote:
> Obviously, because gdb expects
> code view style debug symbols to be embedded in the executable.

Are you sure about that? I thought gdb expected the dwarf format even on windows.

> I do know that cl.exe does have a compiler
> switch for this, but I do not know if dmd calls cl.exe to do the
> linking. From the verbose output it looks like dmd calls the
> Windows native linker directly.

Maybe try running cl with its verbose output and see how it calls the linker, the switch should be there passed to the linker somehow then you can have dmd pass it too with the -L switch.

November 16, 2022
On Wednesday, 16 November 2022 at 22:02:41 UTC, Larry Hemsley wrote:

> The problem is that the IDE I was using (Zeus) uses gdb to debug
> files and the debugger issued a warning that there were no debug
> symbols in the executable file.

Zeus ships with a version of gdb, so the problem you are seeing might
be related to that version of gdb.

To test for this, I'd suggest using the Windows, Start Run button to
create a command line prompt and try using an alternative version of
gdb to debug your executable directly from that command line.

But don't use a command prompt created from within Zeus itself only
because that will have the PATH set so that it finds the Zeus version
of gdb.

If by using an alternative version of gdb you can debug your executable
that will mean this is an issue with Zeus.

However, if you get the same error in both cases then at least you'll
know the problem lies elsewhere.

November 16, 2022
On Wednesday, 16 November 2022 at 22:02:41 UTC, Larry Hemsley wrote:
>
> If any one knows of a magic switch (undocumented or documented)
> that reverts to the older code view style, I would be very
> thankful to know it. I do know that cl.exe does have a compiler
> switch for this, but I do not know if dmd calls cl.exe to do the
> linking. From the verbose output it looks like dmd calls the
> Windows native linker directly.

Does it help to pass the -m32omf switch to dmd? IIRC, it will output CodeView format then.
November 16, 2022
On Wednesday, 16 November 2022 at 23:16:32 UTC, torhu wrote:
> On Wednesday, 16 November 2022 at 22:02:41 UTC, Larry Hemsley wrote:
>>
>> If any one knows of a magic switch (undocumented or documented)
>> that reverts to the older code view style, I would be very
>> thankful to know it. I do know that cl.exe does have a compiler
>> switch for this, but I do not know if dmd calls cl.exe to do the
>> linking. From the verbose output it looks like dmd calls the
>> Windows native linker directly.
>
> Does it help to pass the -m32omf switch to dmd? IIRC, it will output CodeView format then.

It seems you used to be able to do this with much older versions of the Microsoft linker by using the /PDB:NONE option, but this is no longer the case:

"It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .obj or .pdb file."

https://learn.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=msvc-170
November 17, 2022
Your best bet is probably using ldc instead, with:

  --gdwarf                               - Emit DWARF debuginfo (instead of CodeView) for MSVC targets
November 20, 2022
On 11/16/22 4:48 PM, rikki cattermole wrote:
> Your best bet is probably using ldc instead, with:
> 
>    --gdwarf                               - Emit DWARF debuginfo (instead of CodeView) for MSVC targets

Using ldc2 with the --gdwarf switch worked to get the symbols where
the debugger could use them. Unfortunately the debugger that Zeus
uses does not work very well.

I apologize for replying directly to each person that gave me
segestions. I didn't know that Thunderbird had a reply to list
option on its menu. Live and learn, I don't reply very often or
even post to this forum or any other for that matter.

Again Thanks for the Help
Larry

November 20, 2022
On Sunday, 20 November 2022 at 22:34:49 UTC, Larry Hemsley wrote:
> I apologize for replying directly to each person that gave me
> segestions

sorry for not saying something sooner, we got 5 feet of snow here friday so ive been pretty occupied digging lol
November 21, 2022
I made that mistake once.

All good.