Build clang on windows platform

Hi,

I was trying to build a clang toolchain for a windows machine, i have gone through the following step’s.

  • all this step-up done in ubuntu’s platform.
  1. Successfully Build windows tool -------> x86_64-w64-mingw32-
  2. Successfully Build clang for Linux(X86) platform
  3. With the help of this Tool’s try to Build clang for Windows platform,

~/build && cmake -G “Unix Makefiles” -DCMAKE_BUILD_TYPE=“Release”
-DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True
-DCMAKE_INSTALL_PREFIX=“$(INSTALL_DIR_RELEASE)”
-DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False
-DDEFAULT_SYSROOT=“$(INSTALL_DIR_RELEASE)/sysroot”
-DLLVM_DEFAULT_TARGET_TRIPLE=“x86_64-w64-mingw32”
-DLLVM_TARGETS_TO_BUILD=“” -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=“RISCV”
…/llvm
4. make -jnproc

  • Build was successful, but clang is built for Linux(X86) platform.

** Can anyone please help me to Built clang for Windows(X86) platform.

Thanks
khan.

With the LLVM_DEFAULT_TARGET_TRIPLE option, you built a compiler that
cross-compiles to the target specified by default (but the compiler
itself runs on the host machine). If your want a clang.exe that runs
on the windows machine, you can either cmake+build LLVM on that
machine or use a cross-compiler (and linker) on the Ubuntu platform
(x86_64-w64-mingw32-gcc or using the clang with
LLVM_DEFAULT_TARGET_TRIPLE that you just compiled)

Michael