Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-07 Thread kinke via Digitalmars-d-announce

On Saturday, 7 April 2018 at 14:05:15 UTC, Seb wrote:
Hmm how hard would it be to use the MinGW libraries like DMD is 
doing as a fallback since 2.079?


The MinGW ones for the Windows API may do, but the VS 2010 
libraries are not an option for LDC, we require at least 2015 
(which introduced the 'Universal CRT', probably making things 
more complicated). I'd also prefer to keep on defaulting to the 
static C runtime in order not to produce binaries depending on 
Visual C++ DLLs (hindering portability of Windows binaries).


Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-07 Thread Seb via Digitalmars-d-announce

On Saturday, 7 April 2018 at 12:24:54 UTC, kinke wrote:

Any MS libs that can be bundled "legally"?


That's the problem. If there were, they'd be bundled with the 
LDC Windows packages, so that LDC on Windows wouldn't require a 
Visual C++ installation anymore and just work out of the box.
To avoid confusion: we're talking about the static and import 
.lib files of the Visual C++ runtime & Windows SDK, not about 
the redistributable DLLs.


The libs on DropBox are from Visual Studio 2015 Update 3, while 
the LDC 1.8 druntime/Phobos libs have been compiled with latest 
VS 2017, so this divergence could become problematic at some 
point.


Hmm how hard would it be to use the MinGW libraries like DMD is 
doing as a fallback since 2.079?


https://dlang.org/changelog/2.079.0.html#lld_mingw

Rainer's excellent work on this is mostly found in 
dlang/installer:


https://github.com/dlang/installer/blob/build-mingw-libs/windows/build_mingw.bat
https://github.com/dlang/installer/blob/build-lld/windows/build_lld.bat
https://github.com/dlang/installer/pull/281
https://github.com/dlang/dmd/pull/7500

(mingw and lld are separate branches, s.t. they aren't built on 
every AppVeyor run)


Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-07 Thread kinke via Digitalmars-d-announce

On Friday, 6 April 2018 at 04:08:41 UTC, Seb 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.


Thanks for doing this.

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!


Thanks for the confirmation.


Any MS libs that can be bundled "legally"?


That's the problem. If there were, they'd be bundled with the LDC 
Windows packages, so that LDC on Windows wouldn't require a 
Visual C++ installation anymore and just work out of the box.
To avoid confusion: we're talking about the static and import 
.lib files of the Visual C++ runtime & Windows SDK, not about the 
redistributable DLLs.


The libs on DropBox are from Visual Studio 2015 Update 3, while 
the LDC 1.8 druntime/Phobos libs have been compiled with latest 
VS 2017, so this divergence could become problematic at some 
point.


Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-05 Thread Seb via Digitalmars-d-announce

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"?


Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-05 Thread WebFreak001 via Digitalmars-d-announce

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?


Re: Dockerfile with cross-compiler targeting Windows x64

2018-04-05 Thread Joakim via Digitalmars-d-announce

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


Nice, rather than downloading the pre-built ldc for Windows and 
extracting its runtime, you may be interested in cross-compiling 
the stdlib yourself.  The only obstacle may be that the build 
requires a C cross-compiler for one or two C files, but clang may 
be good enough to do that now.


If you go that route, the ldc devs would appreciate a PR filling 
out this preset configuration stub to cross-compile for Windows, 
with the info you use:


https://github.com/ldc-developers/ldc/blob/master/runtime/PresetRuntimeConfiguration.cmake#L46