Skip to content

Commit 77117e3

Browse files
committed
Auto merge of #52177 - ljedrz:bare_gcc_warning, r=alexcrichton
Warn windows-gnu users that the bundled gcc can't compile Add a `DO NOT USE THIS gcc.exe FOR COMPILATION.txt` file to `lib\rustlib\*-pc-windows-gnu\bin` folders in `windows-gnu` installations in order to warn against attempting to use the bundled `gcc.exe` as a C compiler. I'm pretty sure that location is usually found manually, so this should be easily noticeable. This mistake has been made plenty of times and has lead to misunderstandings: Rust: [Bundled gcc (windows x64) is unable to build any c file](#24418) gtk-rs: [Compiling on windows](gtk-rs/gtk#625) bzip2-rs: [Build failure at gcc level: blocksort.c not found](trifectatechfoundation/bzip2-rs#30) Alternatives: rename the bundled `gcc.exe` to e.g. `rustc-gcc.exe` or `gcc-linker.exe`. This might require a more comprehensive change or break crates already using it as a linker. r? @alexcrichton
2 parents b3e7d70 + 232e77e commit 77117e3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bootstrap/dist.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@ fn make_win_dist(
308308
builder.copy_to_folder(&src, &target_bin_dir);
309309
}
310310

311+
// Warn windows-gnu users that the bundled GCC cannot compile C files
312+
builder.create(
313+
&target_bin_dir.join("GCC-WARNING.txt"),
314+
"gcc.exe contained in this folder cannot be used for compiling C files - it is only\
315+
used as a linker. In order to be able to compile projects containing C code use\
316+
the GCC provided by MinGW or Cygwin."
317+
);
318+
311319
//Copy platform libs to platform-specific lib directory
312320
let target_lib_dir = plat_root.join("lib").join("rustlib").join(target_triple).join("lib");
313321
fs::create_dir_all(&target_lib_dir).expect("creating target_lib_dir failed");

0 commit comments

Comments
 (0)