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.
Binutils : --target=x86_64-w64-mingw32 (multilib)
MinGW-w64-crt header files: --target=x86_64-w64-mingw32, --host=x86_64-w64-mingw32
GCC, gcc part: --target=x86_64-w64-mingw32 (multilib)
MinGW-w64-crt: --target=x86_64-w64-mingw32, --host=x86_64-w64-mingw32
GCC libgcc and libstdc++: --target=x86_64-w64-mingw32
Done
Binutils : --target=x86_64-w64-mingw32 (multilib) –host= x86_64-w64-mingw32 –disable-gdb
GCC: --target=x86_64-w64-mingw32 (multilib) –host= x86_64-w64-mingw32
Then copy the CRT build from the first target cross toolchain in this host toolchain.
Then we can use this new host toolchain and use it to build programs.
However, I try the same thing with llvm, I could not do it. cmake will do stupid checks to prevent me to just do the 2nd part.
I could not even use clang –target=x86_64-windows-gnu -fuse-ld=lld to build a host GCC since it fails to build gmp, only GCC could build that.
I think this is extremely important as a cross compiler. You want to bootstrap another toolchain from this platform to a new platform to make the new platform self host.
However, I guess it is very hard for LLVM, since it requires python and all kinds of other dependencies which the target cross toolchain does not provide.
The largest issue is clearly cmake, which prevents cross compilation.
I do not know what is the solution here.
Sent from Mail for Windows 10
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
> _______________________________________________
> LLVM Developers mailing list
> llvm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev