www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Compiling with -m64 on Windows uses wrong link location

reply "Josh" <moonburntm gmail.com> writes:
I have Visual Studio 2012 and Windows SDK for Windows 8.1 
installed. I then used the DMD installer, which appears to have 
correctly found them:

----------------------------------------------------------------------------
; Windows installer replaces the following lines with the actual 
paths
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 
11.0\VC\
WindowsSdkDir=D:\Program Files (x86)\Windows Kits\8.1\

; Windows installer uncomments the version detected
;VC2013 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
;VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe

; needed with /DEBUG to find mspdb*.dll (only for VS2012 or 
VS2013)
;VC2013 
PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE;%VCINSTALLDIR%\bin
PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE
----------------------------------------------------------------------------

The problem is, when I compile something with -m64, I get the 
error:
Can't run 'C:\Program Files (x86)\Microsoft Visual Studio 
10.0\VC\bin\amd64\link.exe', check PATH

It's looking in ...\Microsoft Visual Studio 10.0, rather than 
...\Microsoft Visual Studio 11.0 which is specified in sc.ini. Is 
there another step that I need to do?

Thanks,

Josh
Nov 01 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 01.11.2014 14:25, Josh wrote:
 I have Visual Studio 2012 and Windows SDK for Windows 8.1 installed. I
 then used the DMD installer, which appears to have correctly found them:

 ----------------------------------------------------------------------------

 ; Windows installer replaces the following lines with the actual paths
 VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
 WindowsSdkDir=D:\Program Files (x86)\Windows Kits\8.1\

 ; Windows installer uncomments the version detected
 ;VC2013 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 ;VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
 ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe

 ; needed with /DEBUG to find mspdb*.dll (only for VS2012 or VS2013)
 ;VC2013
 PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE;%VCINSTALLDIR%\bin

 PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE
 ----------------------------------------------------------------------------


 The problem is, when I compile something with -m64, I get the error:
 Can't run 'C:\Program Files (x86)\Microsoft Visual Studio
 10.0\VC\bin\amd64\link.exe', check PATH

 It's looking in ...\Microsoft Visual Studio 10.0, rather than
 ....\Microsoft Visual Studio 11.0 which is specified in sc.ini. Is there
 another step that I need to do?

 Thanks,

 Josh
That should work as is. Some ideas: - you might have another sc.ini in the working directory or your HOME directory which is picked up before the one alongside dmd.exe - for historic reasons LINKCMD64 setting/environment variable might also be used, maybe you have set this elsewhere in your sc.ini If you run dmd with option -v, it will show the used sc.ini and the command line used to call the linker.
Nov 01 2014
parent reply "Josh" <moonburntm gmail.com> writes:
On Saturday, 1 November 2014 at 16:22:33 UTC, Rainer Schuetze 
wrote:
 On 01.11.2014 14:25, Josh wrote:
 I have Visual Studio 2012 and Windows SDK for Windows 8.1 
 installed. I
 then used the DMD installer, which appears to have correctly 
 found them:

 ----------------------------------------------------------------------------

 ; Windows installer replaces the following lines with the 
 actual paths
 VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 
 11.0\VC\
 WindowsSdkDir=D:\Program Files (x86)\Windows Kits\8.1\

 ; Windows installer uncomments the version detected
 ;VC2013 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 ;VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
 ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe

 ; needed with /DEBUG to find mspdb*.dll (only for VS2012 or 
 VS2013)
 ;VC2013
 PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE;%VCINSTALLDIR%\bin

 PATH=%PATH%;%VCINSTALLDIR%\bin\x86_amd64;%VCINSTALLDIR%\..\Common7\IDE
 ----------------------------------------------------------------------------


 The problem is, when I compile something with -m64, I get the 
 error:
 Can't run 'C:\Program Files (x86)\Microsoft Visual Studio
 10.0\VC\bin\amd64\link.exe', check PATH

 It's looking in ...\Microsoft Visual Studio 10.0, rather than
 ....\Microsoft Visual Studio 11.0 which is specified in 
 sc.ini. Is there
 another step that I need to do?

 Thanks,

 Josh
That should work as is. Some ideas: - you might have another sc.ini in the working directory or your HOME directory which is picked up before the one alongside dmd.exe - for historic reasons LINKCMD64 setting/environment variable might also be used, maybe you have set this elsewhere in your sc.ini If you run dmd with option -v, it will show the used sc.ini and the command line used to call the linker.
I only have 1 sc.ini, and -v showed the correct path. Setting the LINKCMD64 variable in sc.ini fixed the issue, although it seems kind of redundant as I copied LINKCMD and just added 64: ; Windows installer uncomments the version detected ;VC2013 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe LINKCMD64=%VCINSTALLDIR%\bin\x86_amd64\link.exe ;VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe Thanks for that Rainer.
Nov 01 2014
parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 01.11.2014 20:00, Josh wrote:
 I only have 1 sc.ini, and -v showed the correct path. Setting the
 LINKCMD64 variable in sc.ini fixed the issue, although it seems kind of
 redundant as I copied LINKCMD and just added 64:

 ; Windows installer uncomments the version detected
 ;VC2013 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 LINKCMD=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 LINKCMD64=%VCINSTALLDIR%\bin\x86_amd64\link.exe
 ;VC2010 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
 ;VC2008 LINKCMD=%VCINSTALLDIR%\bin\amd64\link.exe
I suspect that you have set the LINKCMD64 variable in your system environment from trying earlier versions of dmd before. You can check this running "set LINKCMD64" from the command line.
 Thanks for that Rainer.
Good to hear it got you going.
Nov 02 2014