From f7001fea537f5709988294ceb0b6e62aaa6bf548 Mon Sep 17 00:00:00 2001 From: Schamper <1254028+Schamper@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:36:26 +0100 Subject: [PATCH] Only export symbols on Linux GNU builds --- pyoxidizer/src/templates/new-build.rs.hbs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyoxidizer/src/templates/new-build.rs.hbs b/pyoxidizer/src/templates/new-build.rs.hbs index a5d41b41a..239ff5756 100644 --- a/pyoxidizer/src/templates/new-build.rs.hbs +++ b/pyoxidizer/src/templates/new-build.rs.hbs @@ -121,15 +121,16 @@ fn main() { } let target_os = std::env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not defined"); + let target_env = std::env::var("CARGO_CFG_TARGET_ENV").expect("CARGO_CFG_TARGET_ENV not defined"); // Export symbols from built binaries. This is needed to ensure libpython's // symbols are exported. Without those symbols being exported, loaded extension // modules won't find the libpython symbols and won't be able to run. - match target_os.as_str() { - "linux" => { + match (target_os.as_str(), target_env.as_str()) { + ("linux", "gnu") => { println!("cargo:rustc-link-arg=-Wl,-export-dynamic"); } - "macos" => { + ("macos", _) => { println!("cargo:rustc-link-arg=-rdynamic"); } _ => {}