llvm-mingw icon indicating copy to clipboard operation
llvm-mingw copied to clipboard

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

Open me21 opened this issue 1 year ago • 2 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.

me21 avatar Jan 12 '24 14:01 me21

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.

mstorsjo avatar Jan 12 '24 14:01 mstorsjo

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.

mstorsjo avatar Jan 12 '24 15:01 mstorsjo