I want to build llvm + clang + lld + compiler-rt on Linux to build a windows host toolchain for example.
In GNU toolchain, it is 2 step.
I want to build llvm + clang + lld + compiler-rt on Linux to build a windows host toolchain for example.
In GNU toolchain, it is 2 step.
This is very do-able. I often cross-compile a Windows version of the
toolchain from a Linux build machine, but I admittedly don't use MinGW
in the process -- I use MSVC and Windows SDK headers and libraries
I've copied to the Linux machine. LLVM includes a WinMsvc.cmake
toolchain script to help facilitate this, and I make extensive use of
it in my own toolchain-automating project
(https://github.com/jvstech/llvm-toolchain) because it's so much
easier [for me] than trying to build with MinGW. The only thing I
don't build is Compiler-RT -- not because it can't be done, but
because the MSVC and Windows SDK provide the equivalent functionality
already. It does require a bit more configuration than what I perform
in my project, but I've done it before.
If you'd like to stick with MinGW, another project I recommend is
https://github.com/mstorsjo/llvm-mingw -- which I have used in the
past, as well. Additionally, there is
https://github.com/martell/mingw-w64-clang which is similar, but
hasn't been updated in a while. Regardless, I've also used this
project as a reference for how to do manually what you're trying to
accomplish.
Bottom line: yes, it can be a pain, but it can be and has been done before.
- Jon