www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - ldc2 64 bit windows linking problem

reply Carl Sturtivant <sturtivant gmail.com> writes:
Just got ldc2 for this machine/platform, want to use 
-link-internally .
Added the bin directory to my Path. lcd2 compiles but lld-link 
cannot find its libs. Any suggestions?

A simple `ldc2 -link-internally hello.d` produces
lld-link: error: could not open 'kernel32.lib': no such file or 
directory
lld-link: error: could not open 'user32.lib': no such file or 
directory
lld-link: error: could not open 'gdi32.lib': no such file or 
directory
lld-link: error: could not open 'winspool.lib': no such file or 
directory
lld-link: error: could not open 'shell32.lib': no such file or 
directory
lld-link: error: could not open 'ole32.lib': no such file or 
directory
lld-link: error: could not open 'oleaut32.lib': no such file or 
directory
lld-link: error: could not open 'uuid.lib': no such file or 
directory
lld-link: error: could not open 'comdlg32.lib': no such file or 
directory
lld-link: error: could not open 'advapi32.lib': no such file or 
directory
lld-link: error: could not open 'oldnames.lib': no such file or 
directory
lld-link: error: could not open 'legacy_stdio_definitions.lib': 
no such file or directory
lld-link: error: could not open 'libcmt.lib': no such file or 
directory
lld-link: error: could not open 'libvcruntime.lib': no such file 
or directory
lld-link: error: could not open 'shell32.lib': no such file or 
directory
lld-link: error: could not open 'ws2_32.lib': no such file or 
directory
lld-link: error: could not open 'wsock32.lib': no such file or 
directory
lld-link: error: could not open 'kernel32.lib': no such file or 
directory
lld-link: error: could not open 'advapi32.lib': no such file or 
directory
Error: linking with LLD failed
Jun 28 2020
parent reply kinke <noone nowhere.com> writes:
On Sunday, 28 June 2020 at 21:56:26 UTC, Carl Sturtivant wrote:
 Just got ldc2 for this machine/platform, want to use 
 -link-internally .
 Added the bin directory to my Path. lcd2 compiles but lld-link 
 cannot find its libs. Any suggestions?
Yeah, please mention the used LDC version explicitly as that part has seen a bigger rework in v1.22 (as mentioned in the changelog), and then run with -v, checking the trailing lines right before the linker command ('Prepending to environment variables', the MSVC toolchain auto-detection & setup). If auto-detection somehow finds an unsuited installation, you can enforce a dir via LDC_VSDIR (see README.txt). In case your environment variables play a role, dumping them via `set` and posting them might provide insights.
Jun 28 2020
next sibling parent Carl Sturtivant <sturtivant gmail.com> writes:
On Sunday, 28 June 2020 at 22:18:29 UTC, kinke wrote:
 On Sunday, 28 June 2020 at 21:56:26 UTC, Carl Sturtivant wrote:
 Just got ldc2 for this machine/platform, want to use 
 -link-internally .
 Added the bin directory to my Path. lcd2 compiles but lld-link 
 cannot find its libs. Any suggestions?
Yeah, please mention the used LDC version explicitly as that part has seen a bigger rework in v1.22 (as mentioned in the changelog), and then run with -v, checking the trailing lines right before the linker command ('Prepending to environment variables', the MSVC toolchain auto-detection & setup). If auto-detection somehow finds an unsuited installation, you can enforce a dir via LDC_VSDIR (see README.txt). In case your environment variables play a role, dumping them via `set` and posting them might provide insights.
Apologies, it's version 1.22.0 I see no line 'Prepending ...' before the linker related output from -v. Here's the relevant text. GC stats 0M used, 5M free, 5M total code hello2 lld-link /NOLOGO /OPT:REF /OPT:ICF /DEFAULTLIB:libcmt /DEFAULTLIB:libvcruntime /OUT:hello2.exe hello2.obj C:/Users/carl/ldc2-1.22.0-windows-x64/bin/../lib\ldc_rt.builtins.lib /LIBPATH:C:/Users/carl/ldc2-1.22.0-windows-x64/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 oldnames.lib legacy_stdio_definitions.lib The libs are present in C:\Users\carl\ldc2-1.22.0-windows-x64\lib\mingw
Jun 28 2020
prev sibling parent Carl Sturtivant <sturtivant gmail.com> writes:
On Sunday, 28 June 2020 at 22:18:29 UTC, kinke wrote:
 On Sunday, 28 June 2020 at 21:56:26 UTC, Carl Sturtivant wrote:
 Just got ldc2 for this machine/platform, want to use 
 -link-internally .
 Added the bin directory to my Path. lcd2 compiles but lld-link 
 cannot find its libs. Any suggestions?
Yeah, please mention the used LDC version explicitly as that part has seen a bigger rework in v1.22 (as mentioned in the changelog), and then run with -v, checking the trailing lines right before the linker command ('Prepending to environment variables', the MSVC toolchain auto-detection & setup). If auto-detection somehow finds an unsuited installation, you can enforce a dir via LDC_VSDIR (see README.txt). In case your environment variables play a role, dumping them via `set` and posting them might provide insights.
OK, sorry for wasting your time. It seems VS was once installed on this machine and later removed, but some stray environment variables were left behind. Once deleted, everything just worked.
Jun 28 2020