Change:
Building the hello world program fails with the following message: It appears that rustc picks up another MingW's version of rather than the one it ships with. The same error also appears if the rust binary directory is the first item in my PATH. The only way around it is to either remove my MingW's directory from the PATH or by prefixing to the PATH. Both solutions seem to be quite hackish -- I just wanted to check if this is the desired behavior.
Yes, please see .
I understand this is closed and I also looked at the related issues but it's very unclear what the actual resolution was here. Using the following: The issue above still happens on a fresh install of Rust via rustup and using the above toolchain. Specifically, I see the error: And it's clear that the Rust toolchain is using an existing mingw32 setup.

Discussion:
return found def make_win_dist(dist_root, target_triple): <del> # Ask gcc where it keeps its' stuff </del> <ins> # Ask gcc where it keeps its stuff </ins> gcc_out = subprocess.check_output(["gcc.exe", "-print-search-dirs"]) bin_path = os.environ["PATH"].split(os.pathsep) lib_path = []

else: rustc_dlls.append("libgcc_s_seh-1.dll") <del> target_libs = ["crtbegin.o", "crtend.o", "crt2.o", "dllcrt2.o", "libadvapi32.a", "libcrypt32.a", "libgcc.a", "libgcc_eh.a", "libgcc_s.a", "libimagehlp.a", "libiphlpapi.a", "libkernel32.a", "libm.a", "libmingw32.a", "libmingwex.a", "libmsvcrt.a", "libpsapi.a", "libshell32.a", "libstdc++.a", "libuser32.a", "libws2_32.a", "libiconv.a", "libmoldname.a"] </del> <ins> target_libs = [ # MinGW libs "crtbegin.o", "crtend.o", "crt2.o", "dllcrt2.o", "libgcc.a", "libgcc_eh.a", "libgcc_s.a", "libm.a", "libmingw32.a", "libmingwex.a", "libstdc++.a", "libiconv.a", "libmoldname.a", # Windows import libs "libadvapi32.a", "libbcrypt.a", "libcomctl32.a", "libcomdlg32.a", "libcrypt32.a", "libctl3d32.a", "libgdi32.a", "libimagehlp.a", "libiphlpapi.a", "libkernel32.a", "libmsvcrt.a", "libodbc32.a", "libole32.a", "liboleaut32.a", "libopengl32.a", "libpsapi.a", "librpcrt4.a", "libsetupapi.a", "libshell32.a", "libuser32.a", "libuuid.a", "libwinhttp.a", "libwinmm.a", "libwinspool.a", "libws2_32.a", "libwsock32.a", ] </ins> # Find mingw artifacts we want to bundle target_tools = find_files(target_tools, bin_path)

shutil.copy(src, dist_bin_dir) # Copy platform tools to platform-specific bin directory <del> target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "bin") </del> <ins> target_bin_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "bin") </ins> if not os.path.exists(target_bin_dir): os.makedirs(target_bin_dir) for src in target_tools: shutil.copy(src, target_bin_dir) # Copy platform libs to platform-spcific lib directory <del> target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "gcc", "lib") </del> <ins> target_lib_dir = os.path.join(dist_root, "bin", "rustlib", target_triple, "lib") </ins> if not os.path.exists(target_lib_dir): os.makedirs(target_lib_dir) for src in target_libs:

cmd.arg(obj_filename.with_extension("metadata.o")); } <del> // Rust does its' own LTO cmd.arg("-fno-lto"); </del> if t.options.is_like_osx { // The dead_strip option to the linker specifies that functions and data // unreachable by the entry point will be removed. This is quite useful

trans: &CrateTranslation, outputs: &OutputFilenames) { let old_path = os::getenv("PATH").unwrap_or_else(||String::new()); <del> let mut new_path = os::split_paths(old_path.as_slice()); new_path.extend(sess.host_filesearch().get_tools_search_paths().into_iter()); </del> <ins> let mut new_path = sess.host_filesearch().get_tools_search_paths(); new_path.extend(os::split_paths(old_path.as_slice()).into_iter()); </ins> os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap()); time(sess.time_passes(), "linking", (), |_|

p.push(find_libdir(self.sysroot)); p.push(rustlibdir()); p.push(self.triple); <del> let mut p1 = p.clone(); p1.push("bin"); let mut p2 = p.clone(); p2.push("gcc"); p2.push("bin"); vec![p1, p2] </del> <ins> p.push("bin"); vec![p] </ins> } }