Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -433,3 +433,8 @@ required-features = ["macros"]
[[test]]
name = "test_various"
required-features = ["macros"]

[patch.crates-io]
# target-lexicon 0.13.5 does not yet include OperatingSystem::Zos;
# use the main branch until the next release.
target-lexicon = { git = "https://github.com/bytecodealliance/target-lexicon", branch = "main" }

This comment was marked as outdated.

2 changes: 2 additions & 0 deletions pyo3-build-config/src/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,8 @@ pub fn is_linking_libpython_for_target(target: &Triple) -> bool {
target.operating_system == OperatingSystem::Windows
// See https://github.com/PyO3/pyo3/issues/4068#issuecomment-2051159852
|| target.operating_system == OperatingSystem::Aix
// z/OS uses XPLINK linkage; extension modules must link libpython explicitly
|| target.operating_system == OperatingSystem::Zos
|| target.environment == Environment::Android
|| target.environment == Environment::Androideabi
|| target.operating_system == OperatingSystem::Cygwin
Expand Down
4 changes: 3 additions & 1 deletion pyo3-build-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ pub mod pyo3_build_script_impl {
let is_emscripten = target.operating_system == OperatingSystem::Emscripten;
let is_cygwin = target.operating_system == OperatingSystem::Cygwin;
let is_windows = target.operating_system == OperatingSystem::Windows;
// z/OS uses LIBPATH for runtime library discovery, not ELF rpath
let is_zos = target.operating_system == OperatingSystem::Zos;
// webassembly targets generally don't support rpath, emscripten is the only exception currently aware of:
// https://github.com/emscripten-core/emscripten/issues/22126
if is_linking_libpython && !is_windows && !is_cygwin && (!is_wasm || is_emscripten) {
if is_linking_libpython && !is_windows && !is_cygwin && !is_zos && (!is_wasm || is_emscripten) {
if let Some(lib_dir) = interpreter_config.lib_dir() {
println!("cargo:rustc-link-arg=-Wl,-rpath,{lib_dir}");
}
Expand Down
Loading