From 76c5773d7c388917bdd9d71a5b71feeb7ac4bde6 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 6 Aug 2022 13:41:50 -0700 Subject: [PATCH 1/3] fix: fix detection of the compiler on windows --- cli/loader/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index 029da451..e71001a4 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -377,7 +377,8 @@ impl Loader { command.env(key, value); } - if cfg!(windows) { + let compiler = config.get_compiler(); + if compiler.is_like_msvc() { command.args(&["/nologo", "/LD", "/I"]).arg(header_path); if self.debug_build { command.arg("/Od"); From 5d83c8f3b879bf99f06ac5b7150b08c8fe928ee6 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 6 Aug 2022 13:47:18 -0700 Subject: [PATCH 2/3] fix: do not use -fPIC on Windows --- cli/loader/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index e71001a4..2c268347 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -395,7 +395,6 @@ impl Loader { } else { command .arg("-shared") - .arg("-fPIC") .arg("-fno-exceptions") .arg("-g") .arg("-I") @@ -403,6 +402,10 @@ impl Loader { .arg("-o") .arg(&library_path); + if !cfg!(windows) { + command.arg("-fPIC"); + } + if self.debug_build { command.arg("-O0"); } else { From 04453f64afeaf88f12800331d2766a8d77649658 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 9 Jan 2023 11:09:51 -0800 Subject: [PATCH 3/3] fix: remove redundant get_compiler() call --- cli/loader/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index 2c268347..30cec2ca 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -377,7 +377,6 @@ impl Loader { command.env(key, value); } - let compiler = config.get_compiler(); if compiler.is_like_msvc() { command.args(&["/nologo", "/LD", "/I"]).arg(header_path); if self.debug_build {