Skip to content

Commit 1331517

Browse files
committed
Unset WINAPI_NO_BUNDLED_LIBRARIES
Rustc no longer depends on winapi. Only cg_clif, cg_gcc and rustfmt still use it, none of which are libraries to compile against. And in case of both cg_clif and cg_gcc it never ends up in an artifact we ship. For cg_clif it only shows up when the jit mode is enabled, which is not the case for the version we ship. For cg_gcc it is used by a test executable, which isn't shipped either.
1 parent 3f62540 commit 1331517

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,41 +1294,6 @@ impl Builder<'_> {
12941294
// Set this for all builds to make sure doc builds also get it.
12951295
cargo.env("CFG_RELEASE_CHANNEL", &self.config.channel);
12961296

1297-
// This one's a bit tricky. As of the time of this writing the compiler
1298-
// links to the `winapi` crate on crates.io. This crate provides raw
1299-
// bindings to Windows system functions, sort of like libc does for
1300-
// Unix. This crate also, however, provides "import libraries" for the
1301-
// MinGW targets. There's an import library per dll in the windows
1302-
// distribution which is what's linked to. These custom import libraries
1303-
// are used because the winapi crate can reference Windows functions not
1304-
// present in the MinGW import libraries.
1305-
//
1306-
// For example MinGW may ship libdbghelp.a, but it may not have
1307-
// references to all the functions in the dbghelp dll. Instead the
1308-
// custom import library for dbghelp in the winapi crates has all this
1309-
// information.
1310-
//
1311-
// Unfortunately for us though the import libraries are linked by
1312-
// default via `-ldylib=winapi_foo`. That is, they're linked with the
1313-
// `dylib` type with a `winapi_` prefix (so the winapi ones don't
1314-
// conflict with the system MinGW ones). This consequently means that
1315-
// the binaries we ship of things like rustc_codegen_llvm (aka the rustc_codegen_llvm
1316-
// DLL) when linked against *again*, for example with procedural macros
1317-
// or plugins, will trigger the propagation logic of `-ldylib`, passing
1318-
// `-lwinapi_foo` to the linker again. This isn't actually available in
1319-
// our distribution, however, so the link fails.
1320-
//
1321-
// To solve this problem we tell winapi to not use its bundled import
1322-
// libraries. This means that it will link to the system MinGW import
1323-
// libraries by default, and the `-ldylib=foo` directives will still get
1324-
// passed to the final linker, but they'll look like `-lfoo` which can
1325-
// be resolved because MinGW has the import library. The downside is we
1326-
// don't get newer functions from Windows, but we don't use any of them
1327-
// anyway.
1328-
if !mode.is_tool() {
1329-
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
1330-
}
1331-
13321297
// verbose cargo output is very noisy, so only enable it with -vv
13331298
for _ in 0..self.verbosity.saturating_sub(1) {
13341299
cargo.arg("--verbose");

0 commit comments

Comments
 (0)