mstorsjo / llvm-mingw

An LLVM/Clang/LLD based mingw-w64 toolchain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building cross-compilers from Windows (host) to Linux (target)

me21 opened this issue · comments

Hello,

Your project provides support to build some compilers (cross and native) for Windows target. Would it be possible to support the other way round - build a compiler which runs on Windows (host) and generates the code for Linux AArch64 target? If not, I would appreciate some guidance on where to start.

It is definitely possible to do that - but the main effort lies in integrating the build/bootstrap of the target libc (primarily glibc in your case I guess, or musl?) together with clang. I haven't tried doing that for glibc, so I don't know exactly what that entails - so I can't really give any general guidance on that, short of actually doing it myself.

If you copy a suitable aarch64 sysroot from somewhere, it might be possible to make it work by invoking clang like clang -target aarch64-linux-gnu --sysroot=path/to/sysroot, but to get it working and picking up both all the glibc things, and also a suitable libgcc and libstdc++, can be a bit fiddly.