ldc icon indicating copy to clipboard operation
ldc copied to clipboard

Bundled Dub can't call LDC on Windows

Open CyberShadow opened this issue 1 year ago • 5 comments

$ wine ~/data/software/dmd/ldc2-1.32.2-windows-x64/ldc2-1.32.2-windows-x64/bin/dub.exe test
Error Failed to invoke the compiler Z:\home\vladimir\data\software\dmd\ldc2-1.32.2-windows-x64\ldc2-1.32.2-windows-x64\bin\ldc2.exe to determine the build platform: ldc2.exe: Unknown command line argument '-quiet'.  Try: 'Z:\home\vladimir\data\software\dmd\ldc2-1.32.2-windows-x64\ldc2-1.32.2-windows-x64\bin\ldc2.exe --help'
ldc2.exe: Did you mean '-i'?

I am running it via Wine but I'm not sure if that matters or not.

Worth noting that it works if I specify the full path to ldmd2.exe:

$ wine ~/data/software/dmd/ldc2-1.32.2-windows-x64/ldc2-1.32.2-windows-x64/bin/dub.exe test --compiler='Z:\home\vladimir\data\software\dmd\ldc2-1.32.2-windows-x64\ldc2-1.32.2-windows-x64\bin\ldmd2.exe'
             Generating test runner configuration 'ae-test-library' for 'library' (sourceLibrary).
...

CyberShadow avatar Jul 20 '23 12:07 CyberShadow

Isn't this a DUB bug? Indeed LDC and LDMD both do not have a -quiet cmdline flag.

JohanEngelen avatar Jul 20 '23 17:07 JohanEngelen

I am not sure. As a user I would expect that Dub would call the LDC binary in its own directory. I know it has some code to that effect.

I think it also has something which makes it default to the compiler that it was built with.

So, I think the problem is with this "integration" with the LDC package, if you could call it that.

The fact that this slip-up ended up in a published package also possibly indicates some missing integration test?

CyberShadow avatar Jul 20 '23 17:07 CyberShadow

Indeed LDC and LDMD both do not have a -quiet cmdline flag.

I think ldmd needs -quiet because dmd has -quiet (although it seems undocumented).

CyberShadow avatar Jul 20 '23 17:07 CyberShadow

Oh, actually ldmd2 does have -quiet, it's just (also) undocumented.

The problem is that Dub is trying to call ldc2 with the DMD (or ldmd2) syntax.

CyberShadow avatar Jul 20 '23 17:07 CyberShadow

Yep, this seems like a Wine-specific (?) dub issue; this definitely works on native Windows (with ldc2.exe being the default driver, not ldmd2.exe). Edit: I.e. it's somehow using the DMDCompiler implementation, not LDCCompiler.

kinke avatar Jul 20 '23 19:07 kinke