Cross compilation idea.

user1234 user1234 at 12.de
Sat Aug 1 10:33:37 UTC 2020


On Saturday, 1 August 2020 at 10:26:12 UTC, Rel wrote:
> Lately I've been looking at Zig programming language. Besides 
> other interesting features like error handling and 
> automatically importing C headers, one feature made me really 
> excited. Zig includes a minified version of musl's, glibc's and 
> mingw's CRT, so it can cross compile stuff very easy. And for 
> whatever reason it includes a C cross compiler as well (I guess 
> they already had libclang bundled for importing C headers, so 
> it was kinda easy to use it to compile C).
>
> As far as I understand there are few things that forbids LDC 
> from cross compiling as easy as Zig:
> 1) Cross linker. Zig uses LLVM's linker which is called LLD. 
> Can LDC use LLD to target all suppored operating systems?
> 2) Cross libc. Zig bundles minified version of musl, glibc and 
> mingw (I didn't quite understood if it can cross compile to 
> macosx). Do you think LDC could do the same or reuse the work 
> done by the Zig team?
> 3) Cross druntime and phobos. I guess LDC could distribute 
> prebuilt versions of druntime and phobos for most used 
> operating system. Or just build and cache it the first time the 
> user tries to cross compile to new target the first time. What 
> do you think?

IIRC the windows versions of the devel tools such as D-Scanner or 
DCD, available for download, are generated on CI services that 
run on Ubtuntu VMs and based on cross LDC abilities to 
cross-compile.

So this might be mostly "ok" already. Maybe not for musl but 
cross compilation works to some extent.


More information about the digitalmars-d-ldc mailing list