How to use LLD linker?
Rainer Schuetze
r.sagitario at gmx.de
Fri Jul 6 10:55:47 UTC 2018
On 06/07/2018 05:48, SrMordred wrote:
> On Saturday, 30 June 2018 at 10:48:49 UTC, Suliman wrote:
>> Correct me if I am wrong, but I have read news that dmd now can be
>> used without C++ Build Tools.
>>
>> I trying to build simple project. And getting Error:
>>
>> Warning: no Visual C++ installation detected
>> 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 8: Illegal Filename
>> ...
>>
>> Error: C:\D\dmd2\windows\bin\link.exe failed with status: 1
>> ldc2 failed with exit code 1.
>>
>> Same with dmd.
>>
>> How to use LLD linker?
>
> Well I just installed the VS 2017 to try the ldc and get (maybe) the
> same error.
>
> dub run --config=application --arch=x86_64 --build=debug --compiler=ldc2
> Performing "debug" build using ldc2 for x86_64.
> lib ~master: building configuration "application"...
> 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 8: Illegal Filename
> /NOLOGO /DEBUG /OPT:REF /OPT:ICF /DEFAULTLIB:libcmt
> /DEFAULTLIB:libvcruntime
> "/OUT:.dub\build\application-debug-windows-x86_64-ldc_2081-FC0CCB721F0C7E0D58B93FB1E50E3401\lib.exe"
> ".dub\obj\lib.obj" "d:\ldc2\lib\ldc_rt.builtins.lib"
> /LIBPATH:d:/ldc2/bin/../lib phobos2-ldc.lib druntime-ldc.lib
> kernel32.lib user32.lib gdi32.lib
> winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib
> advapi32.lib
>
> ^
> Error: d:\D\dmd2\windows\bin\link.exe failed with status: 1
> ldc2 failed with exit code 1.
>
The problem is that the Digital Mars linker is called but the Microsoft
linker is run, because they share the same name link.exe. For
dmd/x64/32mscoff or LDC in general the latter is expected to be used.
Usually dmd and ldc know how to find the appropriate one, but dub might
just expect it to be found through the PATH environment variable.
So, try to set your PATH so that the MS linker is found first.
More information about the Digitalmars-d-learn
mailing list