MINGW-packages
MINGW-packages copied to clipboard
mingw-w64-cross-clang: prefixed cross-compiling wrappers for clang
Related to discussion #8736.
Based on wrappers from llvm-mingw. Also adds a package that provides "foreign" compiler-rt libs.
The clang wrapper could be simplified (have some of the options removed) if the package is only provided for CLANG*. I haven't tested them under MINGW*.
This seems to be working quite well. I can use this to cross-compile python. The packaging is a bit odd, but it seems to do the job.
Wonder how will this work with things like cmake, meson and ninja? Can I use mingw64 cmake with aarch64-w64-mingw32-clang to cross compile ARM64 binaries on x86_64?
Wonder how will this work with things like cmake, meson and ninja? Can I use mingw64 cmake with aarch64-w64-mingw32-clang to cross compile ARM64 binaries on x86_64?
Note I haven't bothered tested the GCC-based MSYSTEMs with this, they should work but who knows...
But with clang64, absolutely! All the major build systems have a mechanism to configure them to cross-compile. In fact, I had good luck with cmake not even bothering configuring a toolchain file, and instead just specifying options:
-DCMAKE_{ASM,C,CXX}_COMPILER_TARGET="aarch64-w64-mingw32" \
-DCMAKE_{ASM,C,CXX}_COMPILER_WORKS=ON \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_SYSROOT="/clangarm64" \
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_{LIBRARY,INCLUDE,PACKAGE}=ONLY \
You may not even need to override "compiler works" for normal packages, I was trying to cross-compile libc++ at the time for a prefix lacking it, so the C++ compiler didn't entirely work yet.
The way I'm doing a "standalone" compiler-rt build here is apparently deprecated. I'll have to investigate how they intend it to be done now, hopefully it doesn't require downloading the llvm
sources.
How about installing all architectures supported by us on every architecture instead of creating new compiler-rt packages? It's 35 MiB right now so that would add 70 MiB which doesn't seem so bad considering size and price of today's storage.
How difficult would that be? Is that possible from the existing mingw-w64-headers-git install or would we need to install the 'foreign' -headers-git like I do for the cross-compiler-rt package here? (compiler-rt only seems to need the headers, thankfully, as it is a static library. Don't know about the sanitizers, haven't tried to do those for this cross compilation thing yet).
Right, forgot about mingw-w64. That would make it even harder than current approach...