DMD Windows 64bit target - how to setup the environment?

Andre Pany andre at s-e-a-p.de
Mon Dec 25 20:04:23 UTC 2017


On Monday, 25 December 2017 at 10:57:46 UTC, realhet wrote:
> Hello,
>
> I'm very well satisfied with the DMD 32bit compiler and the 
> OptLink linker on Windows. I even made an incremental builder 
> to it, and I can see the running program in 1 second.
> Lately I sadly noticed, that the OptLink works only for 32bit 
> target, and I need to go to 64bit if I want to have access to 
> the SIMD instructions on vector operations.
> So this is what I've tried so far:
>
> - Installed visual C++ 2010.
> - Installed Windows SDK 7.1 (don't know why, 'though)
>
>   -> Error: dmd cant find "\bin\link.exe"
> - Added environment variable: set VCINSTALLDIR=c:\Program Files 
> (x86)\Microsoft Visual Studio 10.0\VC
>
>   -> Error: Can't load mspdb100.dll
> - Added set PATH=%PATH%;c:\Program Files (x86)\Microsoft Visual 
> Studio 10.0\Common7\IDE
>
>   -> Error: LNK1104: cannot open file 'libcmt.lib'
> - copied it to c:\D\dmd2\windows\lib64 (yes, I really 
> desperately want it to work lol)
>
>   -> Error: LNK1104: OLDNAMES.lib, shell32.lib
> - copied these too
>
> And finally got the error:
>   -> libcmt.lib(fdopen.obj) : fatal error LNK1112: module 
> machine type 'X86' conflicts with target machine type 'x64'
>
> So I've searched through the whole C drive and this 32bit one 
> was the only libcmt.lib.
> The linker is located at: "c:\Program Files (x86)\Microsoft 
> Visual Studio 10.0\VC\bin\link.exe"
> There is no amd64 folder near to it at all.
>
> Obviously I'm doing something wrong because a trivial task like 
> changing target to 64bit can't be so complicated. Please help 
> and tell me how to do it properly!
>
> Thanks in advance!

If it is ok for you to use LDC (win 64) then there is one major 
advantage using it over DMD.

The MS visual studio / build tool comes with a handy batch script 
vcvarsall. After calling it with the 64 parameter several 
environment variables are set which are directly recognized by 
LDC.

Just call the vcvarsall batch and LDC will work out of the box.

I created an issue for DMD to enable this feature too.

Kind regards
Andre



More information about the Digitalmars-d-learn mailing list