Dockerfile with cross-compiler targeting Windows x64

Seb seb at wilzba.ch
Fri Apr 6 04:08:41 UTC 2018


On Thursday, 5 April 2018 at 22:10:08 UTC, WebFreak001 wrote:
> On Thursday, 5 April 2018 at 11:46:42 UTC, Jacob Carlborg wrote:
>> I've created a Dockerfile [1] containing LDC, configured for 
>> cross-compiling targeting Windows x64.
>>
>> It's based on the instructions provided by kinke here [2].
>>
>> Note, it downloads the MSVC libs from Dropbox.
>>
>> [1] 
>> https://github.com/jacob-carlborg/docker-ldc-windows/blob/master/Dockerfile
>> [2] 
>> https://github.com/ldc-developers/ldc/pull/2142#issuecomment-304472412
>>
>> --
>> /Jacob Carlborg
>
> cool exactly what I always wanted... but how do you use it?

1) Remove the last line which defines the ENTRYPOINT (the one 
that the root docker image defines is better suited
2) Run this:

wget 
https://raw.githubusercontent.com/jacob-carlborg/docker-ldc-windows/master/Dockerfile
docker build -t dlanguage/ldc-windows .
docker run --rm -ti -v $(pwd):/src dlanguage/ldc-windows ldc2 
hello.d

If this gets pushed to DockerHub, just the last line will be 
enough because Docker would fetch the image automatically for you.

See also: https://hub.docker.com/r/dlanguage/ldc

(dub seems to still default to writing `.a` object files)


BTW I just tested this and it works really nicely (I even managed 
to compile the whole DScanner for Windows (!) and it runs as 
expected in a quick test in a virtual machine). Thanks!

Now how do we get this to DockerHub? :)
Any MS libs that can be bundled "legally"?


More information about the Digitalmars-d-announce mailing list