www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - windows linker error

reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
On Windows 7 I have built dmd (using the vcxproj), druntime 
(win64.mak) and phobos (win64.mak).

I went into sc.ini and set the LINKCMD to point to Visual Studio 
12.0's linker.

When I try to compile anything with dmd, I get

     LINK : fatal error LNK1181: cannot open input file 
'test,,nul,user32+kernel132/noi;.obj'

I'm pretty sure else is ok as I didn't see any errors while I was 
building. What can I try next?
Nov 25 2014
parent reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
On Tuesday, 25 November 2014 at 21:22:24 UTC, Vlad Levenfeld 
wrote:
 On Windows 7 I have built dmd (using the vcxproj), druntime 
 (win64.mak) and phobos (win64.mak).

 I went into sc.ini and set the LINKCMD to point to Visual 
 Studio 12.0's linker.

 When I try to compile anything with dmd, I get

     LINK : fatal error LNK1181: cannot open input file 
 'test,,nul,user32+kernel132/noi;.obj'

 I'm pretty sure else is ok as I didn't see any errors while I 
 was building. What can I try next?
Solved it by pointing to the dmc linker instead. Now I have LNK1104: cannot open file 'shell32.lib' I'm compiling with -m64... couldn't compile 32-bit phobos because of missing zlib.
Nov 25 2014
parent reply "Joakim" <dlang joakim.fea.st> writes:
On Tuesday, 25 November 2014 at 23:08:07 UTC, Vlad Levenfeld 
wrote:
 On Tuesday, 25 November 2014 at 21:22:24 UTC, Vlad Levenfeld 
 wrote:
 On Windows 7 I have built dmd (using the vcxproj), druntime 
 (win64.mak) and phobos (win64.mak).

 I went into sc.ini and set the LINKCMD to point to Visual 
 Studio 12.0's linker.

 When I try to compile anything with dmd, I get

    LINK : fatal error LNK1181: cannot open input file 
 'test,,nul,user32+kernel132/noi;.obj'

 I'm pretty sure else is ok as I didn't see any errors while I 
 was building. What can I try next?
Solved it by pointing to the dmc linker instead. Now I have LNK1104: cannot open file 'shell32.lib' I'm compiling with -m64... couldn't compile 32-bit phobos because of missing zlib.
Just so we're clear, you're trying to compile for Win64 COFF? It sounds like you don't have something about your environment set up right, as Win64 requires the MSVC toolchain and some configuration if you use the dmd zip. Did you install from the exe installer or are you using the zip? The dmc linker is not going to work, as it only does OMF. You may find this page helpful, though it may be a bit outdated: http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29
Nov 25 2014
parent reply "Vlad Levenfeld" <vlevenfeld gmail.com> writes:
On Wednesday, 26 November 2014 at 01:35:20 UTC, Joakim wrote:
 On Tuesday, 25 November 2014 at 23:08:07 UTC, Vlad Levenfeld 
 wrote:
 On Tuesday, 25 November 2014 at 21:22:24 UTC, Vlad Levenfeld 
 wrote:
 On Windows 7 I have built dmd (using the vcxproj), druntime 
 (win64.mak) and phobos (win64.mak).

 I went into sc.ini and set the LINKCMD to point to Visual 
 Studio 12.0's linker.

 When I try to compile anything with dmd, I get

   LINK : fatal error LNK1181: cannot open input file 
 'test,,nul,user32+kernel132/noi;.obj'

 I'm pretty sure else is ok as I didn't see any errors while I 
 was building. What can I try next?
Solved it by pointing to the dmc linker instead. Now I have LNK1104: cannot open file 'shell32.lib' I'm compiling with -m64... couldn't compile 32-bit phobos because of missing zlib.
Just so we're clear, you're trying to compile for Win64 COFF? It sounds like you don't have something about your environment set up right, as Win64 requires the MSVC toolchain and some configuration if you use the dmd zip. Did you install from the exe installer or are you using the zip? The dmc linker is not going to work, as it only does OMF. You may find this page helpful, though it may be a bit outdated: http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29
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). 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.
Nov 25 2014
next sibling parent "Joakim" <dlang joakim.fea.st> writes:
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
Nov 26 2014
prev sibling parent "Kagamin" <spam here.lot> writes:
On Wednesday, 26 November 2014 at 04:10:08 UTC, Vlad Levenfeld 
wrote:
 So I used the dmd visual studio project to build dmd
It can be outdated, because dmd release is built by dmc, not vc.
Nov 27 2014