Thread overview
Debugging D in windows
Jun 15, 2016
moe
Jun 15, 2016
Rainer Schuetze
Jun 15, 2016
moe
Jun 16, 2016
moe
Jun 16, 2016
moe
Jun 17, 2016
Rainer Schuetze
Jun 17, 2016
moe
Nov 07, 2018
Murilo
Dec 10, 2018
Murilo
June 15, 2016
Hi,

I am trying to debug in windows. So far I am trying to use windbg like described here: http://dlang.org/windbg.html

However, in windbg when using "g _Dmain" I get an error message: "No Debuggee specified". Can anybody tell me what I am missing here? I could not find anything online and I can not find any option to specify a debugger.

If you know about better ways to debug in windows, please let me know.
June 15, 2016

On 15.06.2016 19:53, moe wrote:
> Hi,
>
> I am trying to debug in windows. So far I am trying to use windbg like
> described here: http://dlang.org/windbg.html
>
> However, in windbg when using "g _Dmain" I get an error message: "No
> Debuggee specified". Can anybody tell me what I am missing here? I could
> not find anything online and I can not find any option to specify a
> debugger.
>
> If you know about better ways to debug in windows, please let me know.

Forget the version of windbg that comes with dmd. It must be one of Walter's nastier jokes.

If you build an executable with -m64 or -m32mscoff and -g you'll get MS compatible debug information in a PDB file. This works with most debuggers like Visual Studio, more recent versions of windbg and others. Use option -gc to get slightly changed debug info that works better with the debugger as they assume to be debugging C++.

If you need to build with -m32, the resulting debug info is some ancient CodeView format. This can converted by cv2pdb (https://github.com/rainers/cv2pdb) to a PDB file or debugged directly by mago (http://dsource.org/projects/mago_debugger). These tools are also part of the Visual D installation (http://rainers.github.io/visuald/visuald/StartPage.html).
June 15, 2016
Thanks for the info! I will try it tomorrow, when I have some time and give some feedback then.
June 16, 2016
On Wednesday, 15 June 2016 at 21:05:43 UTC, moe wrote:
> Thanks for the info! I will try it tomorrow, when I have some time and give some feedback then.

Ok, I have tried your suggestions. And I also followed these instructions: http://dlang.org/dmd-windows.html#environment


I can't get passed this error:
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
--- errorlevel 1104

I have also tried to change the environment variables to:
LIB=C:\dmd2\lib;\dm\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64

so that a path to the 'LIBCMT.lib' is included.

I still seam to be missing something, but I can't figure out what. Can you give me one more hint?
June 16, 2016
On Thursday, 16 June 2016 at 07:40:17 UTC, moe wrote:
> On Wednesday, 15 June 2016 at 21:05:43 UTC, moe wrote:
>> Thanks for the info! I will try it tomorrow, when I have some time and give some feedback then.
>
> Ok, I have tried your suggestions. And I also followed these instructions: http://dlang.org/dmd-windows.html#environment
>
>
> I can't get passed this error:
> LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
> --- errorlevel 1104
>
> I have also tried to change the environment variables to:
> LIB=C:\dmd2\lib;\dm\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64
>
> so that a path to the 'LIBCMT.lib' is included.
>
> I still seam to be missing something, but I can't figure out what. Can you give me one more hint?


I still can't get past this error. It might be worth mentioning that the problem only occurs when building for 64bit with the -m64 flag. Is this a known issue? Does D have problems with 64bit on windows?
June 17, 2016

On 16.06.2016 22:56, moe wrote:
> On Thursday, 16 June 2016 at 07:40:17 UTC, moe wrote:
>> On Wednesday, 15 June 2016 at 21:05:43 UTC, moe wrote:
>>> Thanks for the info! I will try it tomorrow, when I have some time
>>> and give some feedback then.
>>
>> Ok, I have tried your suggestions. And I also followed these
>> instructions: http://dlang.org/dmd-windows.html#environment
>>
>>
>> I can't get passed this error:
>> LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
>> --- errorlevel 1104
>>
>> I have also tried to change the environment variables to:
>> LIB=C:\dmd2\lib;\dm\lib;C:\Program Files (x86)\Microsoft Visual Studio
>> 10.0\VC\lib\amd64
>>
>> so that a path to the 'LIBCMT.lib' is included.
>>
>> I still seam to be missing something, but I can't figure out what. Can
>> you give me one more hint?
>
>
> I still can't get past this error. It might be worth mentioning that the
> problem only occurs when building for 64bit with the -m64 flag. Is this
> a known issue? Does D have problems with 64bit on windows?

The 64-bit version uses the linker and the runtime of the Visual C installation.

Check the [Environment64] section in sc.ini in the dmd2\windows\bin folder: it should set the LIB environment variable to the library folder of your Visual C installation. The dmd installer usually does this automatically, but might have failed for some reason or you have opted out of detecting it. In the latter case you should open the "VS x64 Native Tools Command Prompt" to invoke dmd.

June 17, 2016
On Friday, 17 June 2016 at 09:24:10 UTC, Rainer Schuetze wrote:
>
>
> On 16.06.2016 22:56, moe wrote:
>> On Thursday, 16 June 2016 at 07:40:17 UTC, moe wrote:
>>> [...]
>>
>>
>> I still can't get past this error. It might be worth mentioning that the
>> problem only occurs when building for 64bit with the -m64 flag. Is this
>> a known issue? Does D have problems with 64bit on windows?
>
> The 64-bit version uses the linker and the runtime of the Visual C installation.
>
> Check the [Environment64] section in sc.ini in the dmd2\windows\bin folder: it should set the LIB environment variable to the library folder of your Visual C installation. The dmd installer usually does this automatically, but might have failed for some reason or you have opted out of detecting it. In the latter case you should open the "VS x64 Native Tools Command Prompt" to invoke dmd.

Awesome!

I just downloaded the zip file and adjusted some environment variables manually. I removed it again and used the installer instead. The sc.ini file now shows all the correct path and everything works as expected.

Thanks for taking the time to answer!
November 07, 2018
On Thursday, 16 June 2016 at 07:40:17 UTC, moe wrote:
> On Wednesday, 15 June 2016 at 21:05:43 UTC, moe wrote:
>> Thanks for the info! I will try it tomorrow, when I have some time and give some feedback then.
>
> Ok, I have tried your suggestions. And I also followed these instructions: http://dlang.org/dmd-windows.html#environment
>
>
> I can't get passed this error:
> LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
> --- errorlevel 1104
>
> I have also tried to change the environment variables to:
> LIB=C:\dmd2\lib;\dm\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64
>
> so that a path to the 'LIBCMT.lib' is included.
>
> I still seam to be missing something, but I can't figure out what. Can you give me one more hint?

I was having the same problem and I solved it simply by uninstalling Visual Studio.
December 10, 2018
Hi guys, thank you for helping me out here, there is this facebook group for the D language, here we can help and teach each other. It is called Programming in D. Please join. https://www.facebook.com/groups/662119670846705/?ref=bookmarks