www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compile/link Win64

reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
I never seem to be able to remember how to get 64-bit going on windows.

I've extracted the zip for DMD 2.064.2, I ran the "vcvarsall.bat", but 
trying to compile this trivial hello world:

import std.stdio;
void main()
{
	writeln("Hello");
}

 [path_to]dmd.2.064.2\dmd2\windows\bin\dmd -m64 hello.d
Gives me this: LINK : fatal error LNK1104: cannot open file 'shell32.lib' --- errorlevel 1104 On a slightly more complicated program (a simple mysql-native test program), I get this: LINK : fatal error LNK1104: cannot open file 'ws2_32.lib' --- errorlevel 1104 I also tried uncommenting the appropriate line in sc.ini: ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe to: LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe But that had no effect.
Jan 10 2014
next sibling parent reply "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Friday, 10 January 2014 at 20:02:49 UTC, Nick Sabalausky wrote:
 LINK : fatal error LNK1104: cannot open file 'shell32.lib'
What are your LIB and LIBPATH environment variables set to?
Jan 10 2014
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 1/10/2014 3:06 PM, Vladimir Panteleev wrote:
 On Friday, 10 January 2014 at 20:02:49 UTC, Nick Sabalausky wrote:
 LINK : fatal error LNK1104: cannot open file 'shell32.lib'
What are your LIB and LIBPATH environment variables set to?
echo %LIB%
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\lib;
echo %LIBPATH%
C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB
Jan 10 2014
parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Friday, 10 January 2014 at 20:18:55 UTC, Nick Sabalausky wrote:
 On 1/10/2014 3:06 PM, Vladimir Panteleev wrote:
 On Friday, 10 January 2014 at 20:02:49 UTC, Nick Sabalausky 
 wrote:
 LINK : fatal error LNK1104: cannot open file 'shell32.lib'
What are your LIB and LIBPATH environment variables set to?
echo %LIB%
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\lib;
echo %LIBPATH%
C:\Windows\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ATLMFC\LIB
That's not right. If you're building for x64, the LIB paths should contain amd64 library directories. Are you running the vcvarsall batch file with the right parameter ("amd64")?
Jan 12 2014
prev sibling parent reply "Brad Anderson" <eco gnuk.net> writes:
On Friday, 10 January 2014 at 20:02:49 UTC, Nick Sabalausky wrote:
 I never seem to be able to remember how to get 64-bit going on 
 windows.

 I've extracted the zip for DMD 2.064.2, I ran the 
 "vcvarsall.bat", but trying to compile this trivial hello world:

 import std.stdio;
 void main()
 {
 	writeln("Hello");
 }

 [path_to]dmd.2.064.2\dmd2\windows\bin\dmd -m64 hello.d
Gives me this: LINK : fatal error LNK1104: cannot open file 'shell32.lib' --- errorlevel 1104 On a slightly more complicated program (a simple mysql-native test program), I get this: LINK : fatal error LNK1104: cannot open file 'ws2_32.lib' --- errorlevel 1104 I also tried uncommenting the appropriate line in sc.ini: ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe to: LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe But that had no effect.
I don't have VC2008 so I unfortunately could not test while I was working on the installer/sc.ini update. Rainer says 2008 does work though. With modern VC there is a vcvars32.bat and vcvars64.bat to choose whether to use the 32-bit or 64-bit toolchain. What is the value of %WindowsSdkDir% within your vcvars.bat command prompt?
Jan 10 2014
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 1/10/2014 3:19 PM, Brad Anderson wrote:
 I don't have VC2008 so I unfortunately could not test while I was
 working on the installer/sc.ini update. Rainer says 2008 does work
 though. With modern VC there is a vcvars32.bat and vcvars64.bat to
 choose whether to use the 32-bit or 64-bit toolchain. What is the value
 of %WindowsSdkDir% within your vcvars.bat command prompt?
Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that.
Jan 10 2014
next sibling parent reply "Brad Anderson" <eco gnuk.net> writes:
On Friday, 10 January 2014 at 20:26:35 UTC, Nick Sabalausky wrote:
 On 1/10/2014 3:19 PM, Brad Anderson wrote:
 I don't have VC2008 so I unfortunately could not test while I 
 was
 working on the installer/sc.ini update. Rainer says 2008 does 
 work
 though. With modern VC there is a vcvars32.bat and 
 vcvars64.bat to
 choose whether to use the 32-bit or 64-bit toolchain. What is 
 the value
 of %WindowsSdkDir% within your vcvars.bat command prompt?
Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that.
Appears to be a common problem with VC2008: http://stackoverflow.com/questions/1102689/windowssdkdir-is-not-set-correctly-in-visual-studio-2008
Jan 10 2014
parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Friday, 10 January 2014 at 20:32:53 UTC, Brad Anderson wrote:
 Hmm, that's strange, %WindowsSdkDir% isn't set. I thought 
 vcvarsall.bat was supposed to set up all of that.
Appears to be a common problem with VC2008: http://stackoverflow.com/questions/1102689/windowssdkdir-is-not-set-correctly-in-visual-studio-2008
According to this post[1], he is using VC2005 (VS8), not 2008. 2005 comes with its own copy of the SDK, under VC/PlatformSDK. http://forum.dlang.org/post/lapkjf$pio$1 digitalmars.com
Jan 16 2014
prev sibling parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 1/10/2014 3:26 PM, Nick Sabalausky wrote:
 On 1/10/2014 3:19 PM, Brad Anderson wrote:
 I don't have VC2008 so I unfortunately could not test while I was
 working on the installer/sc.ini update. Rainer says 2008 does work
 though. With modern VC there is a vcvars32.bat and vcvars64.bat to
 choose whether to use the 32-bit or 64-bit toolchain. What is the value
 of %WindowsSdkDir% within your vcvars.bat command prompt?
Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that.
It's also not set if I go into VS's [idiotic] "Visual Studio Command Prompt" either. :/
Jan 10 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 10.01.2014 21:34, Nick Sabalausky wrote:
 On 1/10/2014 3:26 PM, Nick Sabalausky wrote:
 On 1/10/2014 3:19 PM, Brad Anderson wrote:
 I don't have VC2008 so I unfortunately could not test while I was
 working on the installer/sc.ini update. Rainer says 2008 does work
 though. With modern VC there is a vcvars32.bat and vcvars64.bat to
 choose whether to use the 32-bit or 64-bit toolchain. What is the value
 of %WindowsSdkDir% within your vcvars.bat command prompt?
Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that.
It's also not set if I go into VS's [idiotic] "Visual Studio Command Prompt" either. :/
IIRC this variable is read from the registry by vcvars*.bat, but uninstalling any SDK deletes the registry entry. So if you had multiple SDK versions installed, but removed one, the variable will no longer be set.
Jan 10 2014
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 1/10/2014 3:56 PM, Rainer Schuetze wrote:
 On 10.01.2014 21:34, Nick Sabalausky wrote:
 On 1/10/2014 3:26 PM, Nick Sabalausky wrote:
 On 1/10/2014 3:19 PM, Brad Anderson wrote:
 I don't have VC2008 so I unfortunately could not test while I was
 working on the installer/sc.ini update. Rainer says 2008 does work
 though. With modern VC there is a vcvars32.bat and vcvars64.bat to
 choose whether to use the 32-bit or 64-bit toolchain. What is the value
 of %WindowsSdkDir% within your vcvars.bat command prompt?
Hmm, that's strange, %WindowsSdkDir% isn't set. I thought vcvarsall.bat was supposed to set up all of that.
It's also not set if I go into VS's [idiotic] "Visual Studio Command Prompt" either. :/
IIRC this variable is read from the registry by vcvars*.bat, but uninstalling any SDK deletes the registry entry. So if you had multiple SDK versions installed, but removed one, the variable will no longer be set.
Hmm, I hadn't ever uninstalled it. Regardless, *now* I've just uninstalled and reinstalled the Windows SDK, and re-ran vcvarsall.bat. The %WindowsSdkDir% is now set, but I'm still getting the same problem. The %WindowsSdkDir% is set to "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A", but there doesn't appear to be much in there (Just a "Bootstrapper\Packages" directory with not much inside it either). I don't think it installed correctly. There doesn't appear to be any other In any case, the issue I was hunting down turned out to be Posix-related instead of 64-bit-related anyway, so I'm not going to deal with this anymore for the time being.
Jan 10 2014
parent reply "Erik van Velzen" <erik evanv.nl> writes:
On Friday, 10 January 2014 at 21:47:23 UTC, Nick Sabalausky wrote:
 Hmm, I hadn't ever uninstalled it.

 Regardless, *now* I've just uninstalled and reinstalled the 
 Windows SDK, and re-ran vcvarsall.bat. The %WindowsSdkDir% is 
 now set, but I'm still getting the same problem.

 The %WindowsSdkDir% is set to "C:\Program Files (x86)\Microsoft 
 SDKs\Windows\v8.0A", but there doesn't appear to be much in 
 there (Just a "Bootstrapper\Packages" directory with not much 
 inside it either). I don't think it installed correctly. There 
 doesn't appear to be any other Windows SDK installation AFAICT 

The lastest Windows SDK installs to C:\Program Files (x86)\Windows Kits\8.1\
Jan 12 2014
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On 1/12/2014 5:37 PM, Erik van Velzen wrote:
 On Friday, 10 January 2014 at 21:47:23 UTC, Nick Sabalausky wrote:
 Hmm, I hadn't ever uninstalled it.

 Regardless, *now* I've just uninstalled and reinstalled the Windows
 SDK, and re-ran vcvarsall.bat. The %WindowsSdkDir% is now set, but I'm
 still getting the same problem.

 The %WindowsSdkDir% is set to "C:\Program Files (x86)\Microsoft
 SDKs\Windows\v8.0A", but there doesn't appear to be much in there
 (Just a "Bootstrapper\Packages" directory with not much inside it
 either). I don't think it installed correctly. There doesn't appear to

 microsoft tools...
The lastest Windows SDK installs to C:\Program Files (x86)\Windows Kits\8.1\
"\Program Files (x86)\Windows Kits\" doesn't exist :( As I suspected, it must not have installed correctly.
Jan 15 2014
parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Wednesday, 15 January 2014 at 22:21:18 UTC, Nick Sabalausky 
wrote:
 "\Program Files (x86)\Windows Kits\" doesn't exist :(

 As I suspected, it must not have installed correctly.
Nick, did you notice my reply from 4 days ago? http://forum.dlang.org/post/lumcuftlvokawuneqftb forum.dlang.org I believe that under certain conditions, the MS linker will just skip over libraries of certain bitness, so I suspect that might be your problem. I don't think the platform/Windows SDK is related to the problem in your first post because Visual Studio 2005 (VS8), which is what you had in your paths, comes with its own copy (the PlatformSDK directory).
Jan 16 2014