Thread overview
[GTK-D] dub run leads to lld-link: error: could not open libcmt.lib: no such file or directory
May 13, 2020
BoQsc
May 26, 2020
jmh530
May 26, 2020
jmh530
May 26, 2020
jmh530
May 13, 2020
A simple example I tried to run.

#!/usr/bin/env dub
/+ dub.sdl:
	name "hello"
	dependency "gtk-d" version="~>3.9.0"
+/

import gtk.MainWindow;
import gtk.Label;
import gtk.Main;

void main(string[] args)
{
    Main.init(args);
    MainWindow win = new MainWindow("Hello World");
    win.setDefaultSize(200, 100);
    win.add(new Label("Hello World"));
    win.showAll();
    Main.run();
}


This is how I tried to run it.

C:\Users\vaida\Desktop\Command prompt shell>dub run --single gui.d
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to date.
gtk-d:gstreamer 3.9.0: target for configuration "library" is up to date.
gtk-d:peas 3.9.0: target for configuration "library" is up to date.
gtk-d:sv 3.9.0: target for configuration "library" is up to date.
gtk-d:vte 3.9.0: target for configuration "library" is up to date.
hello ~master: building configuration "application"...
Linking...
lld-link: error: could not open libcmt.lib: no such file or directory
lld-link: error: could not open OLDNAMES.lib: no such file or directory
Error: linker exited with status 1
C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.
May 26, 2020
On Wednesday, 13 May 2020 at 15:26:48 UTC, BoQsc wrote:
> [snip]
>> Linking...
> lld-link: error: could not open libcmt.lib: no such file or directory
> lld-link: error: could not open OLDNAMES.lib: no such file or directory
> Error: linker exited with status 1
> C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.

I just ran into this issue as well. I haven't had a chance to fix it on my end, but this is what I've found.

This line
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
means that it is compiling a 64bit program on Windows.

On Windows, if you are trying to compile a 64bit program, then it will try to link with lld if it cannot find a Microsoft linker [1]. The failure is likely due your Microsoft linker (or lld) either not being installed properly or wrong version or configured improperly. If you don't have Visual Studio Community installed, that might be a first step. Another short-term fix might be to try compiling with the -m32 dflag (need to put in your dub.sdl/json).

[1] https://dlang.org/dmd-windows.html#linking
May 26, 2020
On Tuesday, 26 May 2020 at 15:16:25 UTC, jmh530 wrote:
> [snip]
> Another short-term fix might be to try compiling with the -m32 dflag (need to put in your dub.sdl/json).
>

Sorry, easier is
dub test --arch=x86

May 26, 2020
On Tuesday, 26 May 2020 at 15:18:42 UTC, jmh530 wrote:
> On Tuesday, 26 May 2020 at 15:16:25 UTC, jmh530 wrote:
>> [snip]
>> Another short-term fix might be to try compiling with the -m32 dflag (need to put in your dub.sdl/json).
>>
>
> Sorry, easier is
> dub test --arch=x86

You may also have to make sure that bin64 is in the path.

https://dlang.org/changelog/2.091.0.html#windows