windows linker error

Joakim via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 26 07:25:49 PST 2014


On Wednesday, 26 November 2014 at 04:10:08 UTC, Vlad Levenfeld 
wrote:
>
> I'm compiling the latest build from github.
>
> (I normally stay up to date with the current builds on 64bit 
> Debian and everything works more or less without a hitch there, 
> but now I need to get some of my tools working in a Windows 
> environment)
>
> I'm not really sure what my options are regarding the COFF or 
> what they mean, 64-bit is really the only requirement (mostly 
> because I can't get the 32-bit stuff to compile).
>
> I've got Visual Studio Premium, I tried to install from the exe 
> at one point and got Visual D in the process (and this did 
> work, except that the code I need is built against the latest 
> dmd/druntime/phobos builds).

I see, so the problem appears to be that you're trying to compile 
D from git to produce Win64 builds.  COFF is the binary format 
used by Microsoft for their MSVC runtime, and dmd only supports 
Win64 with COFF, the Microsoft linker, and MSVC.  If you're okay 
with 32-bit dmd from git, which by default uses the Digital Mars 
C runtime, the Digital Mars linker called optlink, and the OMF 
binary format, these instructions should work for you, as they 
did for me:

http://wiki.dlang.org/Building_DMD#Windows_2

> Installing it from the instructions, IIRC, also worked for me, 
> but again, the version.
>
> So I used the dmd visual studio project to build dmd, then 
> built druntime and phobos with Digital Mars make;
>
> I had previously tried to use dmc to build dmd but couldn't get 
> it to work.
>
> Anyway, I manage to build successfully but then I get this 
> linker error when I try to run dmd on some test.d consisting of 
> void main (){}.
>
> I've gone into sc.ini and pulled out the ;VC2012 comments to 
> expose the LIB instruction (to fix a different problem) and 
> this is the point that I've gotten stuck at.

If you still want to get Win64 from git working, I advise you to 
use a release build of dmd from the zip and set it up to get code 
compiling for Win64, ie make sure you understand what environment 
variables need to be set to use the MSVC runtime and linker.  
Then, compile dmd from git using dmc and the instructions linked 
above, before using the same Win64 environment variables to 
compile your code.

If you still have problems, you may want to look at the scripts 
and Win64-specific patches that Brad uses on the auto-tester to 
continuously build dmd for Win64:

https://github.com/braddr/d-tester/tree/master/client/src


More information about the Digitalmars-d-learn mailing list