Cross compilation idea.
noone at nowhere.com
Sun Aug 2 21:15:12 UTC 2020
On Saturday, 1 August 2020 at 10:26:12 UTC, Rel wrote:
> 1) Cross linker. Zig uses LLVM's linker which is called LLD.
> Can LDC use LLD to target all suppored operating systems?
Almost, as already mentioned (proper Apple targets support is
underway AFAIK, and our custom Android TLS emulation doesn't work
with LLD out of the box either). LLD is integrated in official
LDC builds (-link-internally), but Posix systems require quite a
lot of extra flags when invoking the linker directly instead of a
preconfigured C compiler as linker driver.
> 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?
We have been doing so for a while with the Windows package, which
includes MinGW-based libs and makes cross-compilation to Windows
a trivial thing on all hosts. For Posix targets, I clearly prefer
a C cross-toolchain (à la `apt-get install
> 3) Cross druntime and phobos. I guess LDC could distribute
> prebuilt versions of druntime and phobos for most used
> operating system.
That's what we do, see
https://wiki.dlang.org/Cross-compiling_with_LDC. You just need to
download the according package, extract the libs and extend the
ldc2.conf file. Automating these last steps (doable manually in
1-2 mins once you've already done it once) has been discussed
(multiple times) before.
More information about the digitalmars-d-ldc