www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - DMD-2.065.0-b3 and VisualD x64 select optlink as linker

reply "Arjan" <arjan ask.me.to> writes:
I Installed the dmd-2.065.0-b3.exe on Window-7 (64bits) with 
VS2008 (64bits) professional and VS2010Express(32bits) installed.

The setup asks to which VS installs VisualD should be integrated, 
I checked VS2008 but the sc.ini file had the path refering the 
VS2010 dirs.

After correcting the sc.ini file to refer the VS2008 and SDK6.0A 
paths DMD64 cmd prompt worked correct. (invoking the correct ms 
link.exe and linking the correct libs).

Testing the VisualD plugin in VS2008 however works for 32 bits 
but fails for x64.
It somehow always uses optlink. (link.exe from dm)

How do I fix this?
Feb 10 2014
next sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 10.02.2014 14:56, Arjan wrote:
 I Installed the dmd-2.065.0-b3.exe on Window-7 (64bits) with VS2008
 (64bits) professional and VS2010Express(32bits) installed.

 The setup asks to which VS installs VisualD should be integrated, I
 checked VS2008 but the sc.ini file had the path refering the VS2010 dirs.

sc.ini is patched by the D installer to work with the latest Visual Studio version without additional settings. You can disable this in the setup. Visual D does not touch sc.ini, but reads most of the settings from it. The linker options for x64 are usually overwritten by the settings on the "Projects and Solutions->Visual D settings->DMD directories->x64" options page.
 After correcting the sc.ini file to refer the VS2008 and SDK6.0A paths
 DMD64 cmd prompt worked correct. (invoking the correct ms link.exe and
 linking the correct libs).

 Testing the VisualD plugin in VS2008 however works for 32 bits but fails
 for x64.
 It somehow always uses optlink. (link.exe from dm)

 How do I fix this?

Check the settings on the page given above. If everything seems ok, please post the buildlog or the *.build.cmd file in the output directory.
Feb 10 2014
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 10.02.2014 23:59, Arjan wrote:
 On Monday, 10 February 2014 at 19:01:49 UTC, Rainer Schuetze wrote:
 On 10.02.2014 14:56, Arjan wrote:
 I Installed the dmd-2.065.0-b3.exe on Window-7 (64bits) with VS2008
 (64bits) professional and VS2010Express(32bits) installed.

please post the buildlog or the *.build.cmd file in the output directory.

Checked the settings in "Projects and Solutions->Visual D settings->DMD directories->x64": checked "override linker settings from dmd configuration in sc.ini" linker: $(VCINSTALLDIR)\bin\link.exe => Failed to link: *.build.cmd ------------------8<--------------------- set PATH=C:\usr\local\d\x64\bin;C:\Program Files\Microsoft SDKs\Windows\v6.0A\\bin;%PATH% set DMD_LIB=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\x64 set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A\ set VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ dmd -m64 -g -debug -X -Xf"Debug DMD x64\TestX64.json" -deps="Debug DMD x64\TestX64.dep" -c -of"Debug DMD x64\TestX64.obj" main.d if errorlevel 1 goto reportError set LIB= echo. > C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK echo "Debug DMD x64\TestX64.obj" /OUT:"Debug DMD x64\TestX64.exe" /MAP:"Debug DMD x64\TestX64.map" user32.lib kernel32.lib /LIBPATH:"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64\" /LIBPATH:C:\Program\ /LIBPATH:Files\Microsoft\ /LIBPATH:SDKs\Windows\v6.0A\lib\x64\ /DEBUG /INCREMENTAL:NO /NOLOGO >> C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK "C:\Program Files (x86)\VisualD\pipedmd.exe" link.exe C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK if errorlevel 1 goto reportError if not exist "Debug DMD x64\TestX64.exe" (echo "Debug DMD x64\TestX64.exe" not created! && goto reportError) goto noError :reportError echo Building Debug DMD x64\TestX64.exe failed! :noError --------------------->8-------------------------- remarks: set PATH=C:\usr\local\d\x64\bin; <== wrong path!

What is wrong about it? I guess it is the path that you have set manually in the "Executable paths" option.
 echo "Debug DMD.... <== messes up the /LIBPATH: !

Spaces in path names are often causing headaches, but I don't see how this causes troubles here.
 buildlog:
 ---------------------8<--------------------------
 Build Log
 Building Debug DMD x64\TestX64.exe
 Command Line
 set PATH=C:\usr\local\d\x64\bin;C:\Program Files\Microsoft
 SDKs\Windows\v6.0A\\bin;%PATH%
 set DMD_LIB=c:\Program Files (x86)\Microsoft Visual Studio
 9.0\VC\\lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\x64
 set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A\
 set VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\
 dmd -m64 -g -debug -X -Xf"Debug DMD x64\TestX64.json" -deps="Debug DMD
 x64\TestX64.dep" -c -of"Debug DMD x64\TestX64.obj" main.d
 if errorlevel 1 goto reportError

 set LIB=
 echo. > C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK
 echo "Debug DMD x64\TestX64.obj" /OUT:"Debug DMD x64\TestX64.exe"
 /MAP:"Debug DMD x64\TestX64.map" user32.lib kernel32.lib
 /LIBPATH:"c:\Program Files (x86)\Microsoft Visual Studio
 9.0\VC\\lib\amd64\" /LIBPATH:C:\Program\ /LIBPATH:Files\Microsoft\
 /LIBPATH:SDKs\Windows\v6.0A\lib\x64\ /DEBUG /INCREMENTAL:NO /NOLOGO >>
 C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK

 "C:\Program Files (x86)\VisualD\pipedmd.exe" link.exe
  C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK
 if errorlevel 1 goto reportError
 if not exist "Debug DMD x64\TestX64.exe" (echo "Debug DMD
 x64\TestX64.exe" not created! && goto reportError)

 goto noError

 :reportError
 echo Building Debug DMD x64\TestX64.exe failed!

 :noError
 Output
 OPTLINK (R) for Win32  Release 8.00.15
 Copyright (C) Digital Mars 1989-2013  All rights reserved.
 http://www.digitalmars.com/ctg/optlink.html
 OPTLINK : Warning 9: Unknown Option : OUT
 OPTLINK : Error 12: Number Overflow : 
 Building Debug DMD x64\TestX64.exe failed!
 --------------------->8--------------------------

 remarks:
 The "pipedmd.exe" command uses the link.exe found first in the search path.

This seems to be the main issue: there does not seem to be a link.exe at $(VCINSTALLDIR)\bin\link.exe, so it falls back to using PATH to let the system search for it, and this then grabs optlink. What would be a correct path for your installation? Another issue is that you have probably specified the Windows SDK Lib path without quotes, so it is split into several paths due to spaces in the path names. Unfortunately, it isn't always even clear to me when path separation works on line splits, spaces or semicolon, so better use quoting.
 When I disabled the "override linker ...." the build and link succeeds!

This falls back to using the settings in sc.ini, which is usually ok, but might cause trouble when working with a different version of VS than assumed by the installer. Rainer
Feb 10 2014
next sibling parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 11.02.2014 08:51, Arjan wrote:
 Rainer,
 Thanks for the reply.

 On Tuesday, 11 February 2014 at 07:07:27 UTC, Rainer Schuetze wrote:
 remarks:
 set PATH=C:\usr\local\d\x64\bin; <== wrong path!

What is wrong about it? I guess it is the path that you have set manually in the "Executable paths" option.

I did not. Does VisualD uses the registry for storing setting like this? Might it be a leftover from a previous attempt to install/uninstall VisualD?

The Visual D installer keeps settings if you jut install on top of it, so this might be causing it. [...]
 Another issue is that you have probably specified the Windows SDK Lib
 path without quotes, so it is split into several paths due to spaces
 in the path names. Unfortunately, it isn't always even clear to me
 when path separation works on line splits, spaces or semicolon, so
 better use quoting.

Yes tried it with quotes but then the final path is still not correct, it has somewhere an escaped quote (\") in it.

Found this issue: optlink needs the trailing backslash for its obscure command line syntax, mslink treats it as an escape charater if before a quote. Current workaround is to specify short names to avoid spaces in names that needs quoting (with e.g. progra~2 instead of "Program Files").
 When I disabled the "override linker ...." the build and link succeeds!

This falls back to using the settings in sc.ini, which is usually ok, but might cause trouble when working with a different version of VS than assumed by the installer.

OK makes me wonder, does VisualD use the sc.ini file at all? When this check is set?

It reads some environment changes from it, i.e. DFLAGS to extract linker options and the LIB variable.
Feb 12 2014
prev sibling parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 11.02.2014 23:47, Arjan wrote:
 remarks:
 The "pipedmd.exe" command uses the link.exe found first in the
 search path.

This seems to be the main issue: there does not seem to be a link.exe at $(VCINSTALLDIR)\bin\link.exe, so it falls back to using PATH to let the system search for it, and this then grabs optlink. What would be a correct path for your installation?

That might be the issue indeed...

No it is not, the ms link.exe is at $(VCINSTALLDIR)\bin\link.exe. I expanded the $(VCINSTALLDIR) to see whether or not the var is wrong or wrong expanded. Same problem optlink is invoked. After adding $(VCINSTALLDIR)\bin to the search path BEFORE dmd install dir. The ms linker gets invoked... Seems the option to override the sc.ini linker does not take the path into account.???

It seems that Visual D is not able to find sc.ini at all. It tries the project folder, $(HOME)\sc.ini, <dmd-installation-path>\windows\bin\sc.ini and searching dmd.exe through the PATH including the 32-bit (?) executable paths specified in the options. Overriding the LINKCMD settings does not work if sc.ini is not found. I guess this is stupid and should be changed.
Feb 12 2014
prev sibling next sibling parent "Arjan" <arjan ask.me.to> writes:
On Monday, 10 February 2014 at 19:01:49 UTC, Rainer Schuetze 
wrote:
 On 10.02.2014 14:56, Arjan wrote:
 I Installed the dmd-2.065.0-b3.exe on Window-7 (64bits) with 
 VS2008
 (64bits) professional and VS2010Express(32bits) installed.

ok, please post the buildlog or the *.build.cmd file in the output directory.

Checked the settings in "Projects and Solutions->Visual D settings->DMD directories->x64": checked "override linker settings from dmd configuration in sc.ini" linker: $(VCINSTALLDIR)\bin\link.exe => Failed to link: *.build.cmd ------------------8<--------------------- set PATH=C:\usr\local\d\x64\bin;C:\Program Files\Microsoft SDKs\Windows\v6.0A\\bin;%PATH% set DMD_LIB=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\x64 set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A\ set VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ dmd -m64 -g -debug -X -Xf"Debug DMD x64\TestX64.json" -deps="Debug DMD x64\TestX64.dep" -c -of"Debug DMD x64\TestX64.obj" main.d if errorlevel 1 goto reportError set LIB= echo. > C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK echo "Debug DMD x64\TestX64.obj" /OUT:"Debug DMD x64\TestX64.exe" /MAP:"Debug DMD x64\TestX64.map" user32.lib kernel32.lib /LIBPATH:"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64\" /LIBPATH:C:\Program\ /LIBPATH:Files\Microsoft\ /LIBPATH:SDKs\Windows\v6.0A\lib\x64\ /DEBUG /INCREMENTAL:NO /NOLOGO >> C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK "C:\Program Files (x86)\VisualD\pipedmd.exe" link.exe C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK if errorlevel 1 goto reportError if not exist "Debug DMD x64\TestX64.exe" (echo "Debug DMD x64\TestX64.exe" not created! && goto reportError) goto noError :reportError echo Building Debug DMD x64\TestX64.exe failed! :noError --------------------->8-------------------------- remarks: set PATH=C:\usr\local\d\x64\bin; <== wrong path! echo "Debug DMD.... <== messes up the /LIBPATH: ! buildlog: ---------------------8<-------------------------- Build Log Building Debug DMD x64\TestX64.exe Command Line set PATH=C:\usr\local\d\x64\bin;C:\Program Files\Microsoft SDKs\Windows\v6.0A\\bin;%PATH% set DMD_LIB=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\x64 set WindowsSdkDir=C:\Program Files\Microsoft SDKs\Windows\v6.0A\ set VCINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ dmd -m64 -g -debug -X -Xf"Debug DMD x64\TestX64.json" -deps="Debug DMD x64\TestX64.dep" -c -of"Debug DMD x64\TestX64.obj" main.d if errorlevel 1 goto reportError set LIB= echo. > C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK echo "Debug DMD x64\TestX64.obj" /OUT:"Debug DMD x64\TestX64.exe" /MAP:"Debug DMD x64\TestX64.map" user32.lib kernel32.lib /LIBPATH:"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\\lib\amd64\" /LIBPATH:C:\Program\ /LIBPATH:Files\Microsoft\ /LIBPATH:SDKs\Windows\v6.0A\lib\x64\ /DEBUG /INCREMENTAL:NO /NOLOGO >> C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK "C:\Program Files (x86)\VisualD\pipedmd.exe" link.exe C:\usr\local\src\play\TestX64\TestX64\DEBUGD~1\TESTX6~1.LNK if errorlevel 1 goto reportError if not exist "Debug DMD x64\TestX64.exe" (echo "Debug DMD x64\TestX64.exe" not created! && goto reportError) goto noError :reportError echo Building Debug DMD x64\TestX64.exe failed! :noError Output OPTLINK (R) for Win32 Release 8.00.15 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html OPTLINK : Warning 9: Unknown Option : OUT OPTLINK : Error 12: Number Overflow :  Building Debug DMD x64\TestX64.exe failed! --------------------->8-------------------------- remarks: The "pipedmd.exe" command uses the link.exe found first in the search path. When I disabled the "override linker ...." the build and link succeeds!
Feb 10 2014
prev sibling next sibling parent "Arjan" <arjan ask.me.to> writes:
Rainer,
Thanks for the reply.

On Tuesday, 11 February 2014 at 07:07:27 UTC, Rainer Schuetze 
wrote:
 remarks:
 set PATH=C:\usr\local\d\x64\bin; <== wrong path!

What is wrong about it? I guess it is the path that you have set manually in the "Executable paths" option.

I did not. Does VisualD uses the registry for storing setting like this? Might it be a leftover from a previous attempt to install/uninstall VisualD?
 echo "Debug DMD.... <== messes up the /LIBPATH: !

Spaces in path names are often causing headaches, but I don't see how this causes troubles here.

Probably the missing quotes as you mention below.
 remarks:
 The "pipedmd.exe" command uses the link.exe found first in the 
 search path.

This seems to be the main issue: there does not seem to be a link.exe at $(VCINSTALLDIR)\bin\link.exe, so it falls back to using PATH to let the system search for it, and this then grabs optlink. What would be a correct path for your installation?

That might be the issue indeed...
 Another issue is that you have probably specified the Windows 
 SDK Lib path without quotes, so it is split into several paths 
 due to spaces in the path names. Unfortunately, it isn't always 
 even clear to me when path separation works on line splits, 
 spaces or semicolon, so better use quoting.

Yes tried it with quotes but then the final path is still not correct, it has somewhere an escaped quote (\") in it.
 When I disabled the "override linker ...." the build and link 
 succeeds!

This falls back to using the settings in sc.ini, which is usually ok, but might cause trouble when working with a different version of VS than assumed by the installer.

OK makes me wonder, does VisualD use the sc.ini file at all? When this check is set?
Feb 10 2014
prev sibling next sibling parent "Arjan" <arjan ask.me.to> writes:
 remarks:
 The "pipedmd.exe" command uses the link.exe found first in 
 the search path.

This seems to be the main issue: there does not seem to be a link.exe at $(VCINSTALLDIR)\bin\link.exe, so it falls back to using PATH to let the system search for it, and this then grabs optlink. What would be a correct path for your installation?

That might be the issue indeed...

No it is not, the ms link.exe is at $(VCINSTALLDIR)\bin\link.exe. I expanded the $(VCINSTALLDIR) to see whether or not the var is wrong or wrong expanded. Same problem optlink is invoked. After adding $(VCINSTALLDIR)\bin to the search path BEFORE dmd install dir. The ms linker gets invoked... Seems the option to override the sc.ini linker does not take the path into account.???
Feb 11 2014
prev sibling parent "Arjan" <arjan ask.me.to> writes:
Rainer,

Thanks a lot for your answers and efforts. I finally got it 
working with the work a rounds.

Maybe a diagnostics logging option could be added so it becomes 
more easy to trace certain settings origins and configuration 
problems. Or is something like that already available in VisualD?

Arjan
Feb 12 2014