Cross-compilation for Windows?

I used an excelent LLVM MinGW recipe for building a LLVM/Clang/LLD based mingw-w64 toolchain for cross-compilation. It is available at GitHub - mstorsjo/llvm-mingw: An LLVM/Clang/LLD based mingw-w64 toolchain Having built it you can easily create your Windows dll under Linux as:

graph, lib, params = relay.build (mod, target = target, target_host = target_host, params = params)
cross_compiler_path = "~/opt/llvm-mingw/bin/x86_64-w64-mingw32-clang++"
lib.export_library (path_lib, tvm.contrib.cross_compiler (cross_compiler_path, output_format = "dll"))

Hope this helps.

1 Like