VS2013 VisualD OPTLINK : Error 2: pointing to a directory

Rainer Schuetze via Digitalmars-d-ide digitalmars-d-ide at puremagic.com
Fri Apr 10 06:34:13 PDT 2015



On 07.04.2015 10:57, ParticlePeter wrote:
> I think I found the problem, which is spaces in directory names. The
> full path to zempty project is: E:\Code\DLang\engine projects\zempty
> I changed it to: E:\Code\DLang\engineProjects\zempty and the application
> is linking fine.
> This might be a VisualD bug, it came up with the current intalled DMD
> Packed, and I didn't change the directory names for about two years.
>

Do you have "short names" disabled for your NTFS files system? Optlink 
does not understand quoted response files, so spaces in the name are 
tried to be removed by calling GetShortPathNameW. This function can fail 
depending on a registry setting.

0.3.40beta1 was supposed to have a workaround for this, but maybe it did 
not work out correctly.

Rainer

> Regards, ParticlePeter
>
>> On Monday, 6 April 2015 at 18:34:55 UTC, Rainer Schuetze wrote:
>>>
>>>
>>> On 06.04.2015 14:32, ParticlePeter wrote:
>>>> Hello Community,
>>>> I have freshly installed VS2013 on Win8-64 and VisualD 3.40, optilink
>>>> and VS Linker ( using MS-COF ) have a similar wired problem. I have no
>>>> issues linking dub ( same projects as with VisualD ) and CPP projects.
>>>>
>>>> OPTILINK:
>>>> Building Debug\myApp.exe...
>>>> Access is denied.
>>>> Access is denied.
>>>> Access is denied.
>>>> Access is denied.
>>>> Access is denied.
>>>> OPTLINK (R) for Win32  Release 8.00.17
>>>> Copyright (C) Digital Mars 1989-2013  All rights reserved.
>>>> http://www.digitalmars.com/ctg/optlink.html
>>>> OPTLINK : Error 2: File Not Found E:\Code\DLang\myLib
>>>> Building Debug\myApp.exe failed!
>>>>
>>>> MS linker with MS-COF:
>>>> Building Debug\myApp.exe...
>>>> Access is denied.
>>>> Access is denied.
>>>> Microsoft (R) Incremental Linker Version 12.00.31101.0
>>>> Copyright (C) Microsoft Corporation.  All rights reserved.
>>>> LINK : fatal error LNK1104: cannot open file 'E:\Code\DLang\myLib'
>>>> Building Debug\myApp.exe failed!
>>>>
>>>> Both the errors inform me that the linker cannot find a FILE, but the
>>>> path is a (existing!) DIRECTORY. I do not build and use myLib.lib in
>>>> the
>>>> myApp project but instead I use the source files from myLib as
>>>> additional imports. These source files are located in
>>>> E:\Code\DLang\myLib\source. I have no idea why the linker is directly
>>>> using the path E:\Code\DLang\myLib for whatever.
>>>
>>> If you just import the files, you probably also added a precompiled
>>> library to the linker inputs. Maybe this is where you added the path
>>> instead of the library file?
>>
>> I veryfied that, I use only "Libary Files : derelict.lib" and "Library
>> Search Path : $(DERELICT)\lib ), where the lib is stored.
>>
>>>> I also don't hav a clue why the access is denied. No older version of
>>>> myApp.exe is running, and I checked the write-protection attributes of
>>>> all the files and folders.
>>>>
>>>> Any idea whats going wrong ?
>>>>
>>>
>>> Could you also post the *.build.cmd and the *.buildlog.html files
>>> from the output folder?
>>
>> Yes. myLib.lib and myApp.exe are obviously not the names I use, so
>> additional explanation to my setup (e.g. $(ENGINE) and
>> $(DERELICT_SOURCE)) is further bellow. This setup worked correctly
>> with DMD 2.066.1 package and VS2013.
>>
>> Debug Command line (using optilink):
>> "$(VisualDInstallDir)pipedmd.exe" dmd -g -debug -X
>> -Xf"$(IntDir)\$(TargetName).json" -I"$(ENGINE)\source"
>> -I"$(DERELICT_SOURCE)" -deps="$(OutDir)\$(ProjectName).dep"
>> -of"$(OutDir)\$(ProjectName).exe_cv" -map
>> "$(INTDIR)\$(SAFEPROJECTNAME).map" -L/NOMAP derelict.lib
>>
>>
>> Build Log
>>
>>
>> Building Debug\zempty.exe
>>
>>
>> Command Line
>>
>> set PATH=D:\Code\DLang\dmd2\windows\bin;D:\Code\VS
>> 2013\\Common7\IDE;C:\Program Files (x86)\Windows Kits\8.1\\bin;%PATH%
>> set DMD_LIB=;E:\Code\DLang\derelictOrg\lib
>> dmd -g -debug -X -Xf"Debug\zempty.json"
>> -I"E:\Code\DLang\engine\source"
>> -I"E:\Code\DLang\derelictOrg\derelictUtil\source;E:\Code\DLang\derelictOrg\derelictGL3\source;E:\Code\DLang\derelictOrg\derelictGLFW3\source;E:\Code\DLang\derelictOrg\derelictIL\source"
>> -deps="Debug\zempty.dep" -c -of"Debug\zempty.obj" source\empty.d
>> source\main.d source\world.d
>> if errorlevel 1 goto reportError
>>
>> set LIB="D:\Code\DLang\dmd2\windows\bin\..\lib"
>> echo. > E:\Code\DLang\engine projects\zempty\Debug\zempty.build.lnkarg
>> echo
>> "Debug\zempty.obj","Debug\zempty.exe_cv","Debug\zempty.map",derelict.lib+
>> >> E:\Code\DLang\engine
>> projects\zempty\Debug\zempty.build.lnkarg
>> echo user32.lib+ >> E:\Code\DLang\engine
>> projects\zempty\Debug\zempty.build.lnkarg
>> echo kernel32.lib+ >> E:\Code\DLang\engine
>> projects\zempty\Debug\zempty.build.lnkarg
>> echo "E:\Code\DLang\derelictOrg\lib\"/NOMAP/CO/NOI/DELEXE >>
>> E:\Code\DLang\engine projects\zempty\Debug\zempty.build.lnkarg
>>
>> "D:\Code\DLang\VisualD\pipedmd.exe" -deps Debug\zempty.lnkdep
>> D:\Code\DLang\dmd2\windows\bin\link.exe @E:\Code\DLang\engine
>> projects\zempty\Debug\zempty.build.lnkarg
>> if errorlevel 1 goto reportError
>> if not exist "Debug\zempty.exe_cv" (echo "Debug\zempty.exe_cv" not
>> created! && goto reportError)
>> echo Converting debug information...
>> "D:\Code\DLang\VisualD\cv2pdb\cv2pdb.exe" "Debug\zempty.exe_cv"
>> "Debug\zempty.exe"
>> if errorlevel 1 goto reportError
>> if not exist "Debug\zempty.exe" (echo "Debug\zempty.exe" not created!
>> && goto reportError)
>>
>> goto noError
>>
>> :reportError
>> echo Building Debug\zempty.exe failed!
>>
>> :noError
>>
>> Output
>>
>> Access is denied.
>> Access is denied.
>> Access is denied.
>> Access is denied.
>> Access is denied.
>> OPTLINK (R) for Win32  Release 8.00.17
>> Copyright (C) Digital Mars 1989-2013  All rights reserved.
>> http://www.digitalmars.com/ctg/optlink.html
>> OPTLINK : Error 2: File Not Found E:\Code\DLang\engine
>> Building Debug\zempty.exe failed!
>>
>> ----------------------------------------------------------
>>
>> Additional Info about my setup:
>>
>> WIP Title of myLib: engine
>> Path to the project is E:\Code\DLang\engine
>> Win8 Env Var: $(ENGINE) points to that path
>>
>> myApp title is zempty, building zempty.exe
>> I import the sourcefiles of engine (Additional imports) with:
>> $(ENGINE)\source
>>
>> Additionally I use some DerelictOrg libs:
>> Win8 Env Var: $(DERELICT) points to E:\Code\DLang\derlictOrg
>> Win8 Env Var: $(DERELICT_SOURCE) points to miltiple folders:
>>   $(DERELICT)\DerelictUtil\source
>>   $(DERELICT)\DerelictGL3\source
>>   etc...
>> All of them are build into one derelict.lib in $(DERELICT)\lib
>


More information about the Digitalmars-d-ide mailing list