Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only export symbols on Linux GNU builds #725

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pyoxidizer/src/templates/new-build.rs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
_ => {}
Expand Down