@@ -72,13 +72,14 @@ def _append_platform_cmake_options(self, cmake_options, swift_host_triple, has_p
7272 cmake_options .define ('CMAKE_CXX_COMPILER_FORCED' , 'TRUE' )
7373 cmake_options .define ('CMAKE_BUILD_TYPE' , self .args .build_variant )
7474
75- # Explicitly choose ar and ranlib from just-built LLVM tools since tools in the host system
76- # unlikely support Wasm object format.
77- native_toolchain_path = self .native_toolchain_path (self .args .host_target )
78- cmake_options .define ('CMAKE_AR' , os .path .join (
79- native_toolchain_path , 'bin' , 'llvm-ar' ))
80- cmake_options .define ('CMAKE_RANLIB' , os .path .join (
81- native_toolchain_path , 'bin' , 'llvm-ranlib' ))
75+ if not self .args .build_runtime_with_host_compiler :
76+ # Explicitly choose ar and ranlib from just-built LLVM tools since tools in the host system
77+ # unlikely support Wasm object format.
78+ native_toolchain_path = self .native_toolchain_path (self .args .host_target )
79+ cmake_options .define ('CMAKE_AR' , os .path .join (
80+ native_toolchain_path , 'bin' , 'llvm-ar' ))
81+ cmake_options .define ('CMAKE_RANLIB' , os .path .join (
82+ native_toolchain_path , 'bin' , 'llvm-ranlib' ))
8283
8384 def _build_libxml2 (self , swift_host_triple , has_pthread , wasi_sysroot ):
8485 libxml2 = CMakeProduct (
0 commit comments