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

Fix macOS LC_ID_DYLIB for abi3 wheels #1208

Merged
merged 1 commit into from
Oct 23, 2022
Merged
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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add `--src` option to generate src layout for mixed Python/Rust projects in [#1189](https://github.com/PyO3/maturin/pull/1189)
* Add Python metadata support for `license-file` field of `Cargo.toml` in [#1195](https://github.com/PyO3/maturin/pull/1195)
* Upgrade to clap 4.0 in [#1197](https://github.com/PyO3/maturin/pull/1197). This bumps MSRV to 1.61.0.
* Fix macOS `LC_ID_DYLIB` for abi3 wheels in [#1208](https://github.com/PyO3/maturin/pull/1208)

## [0.13.6] - 2022-10-08

Expand Down
16 changes: 7 additions & 9 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,19 @@ fn compile_target(
}
}

let module_name = &context.module_name;
let so_filename = match python_interpreter {
Some(python_interpreter) => python_interpreter.get_library_name(module_name),
// abi3
None => {
format!("{base}.abi3.so", base = module_name)
}
};

// https://github.com/PyO3/pyo3/issues/88#issuecomment-337744403
if target.is_macos() {
if let BridgeModel::Bindings(..) | BridgeModel::BindingsAbi3(..) = bindings_crate {
// Change LC_ID_DYLIB to the final .so name for macOS targets to avoid linking with
// non-existent library.
// See https://github.com/PyO3/setuptools-rust/issues/106 for detail
let module_name = &context.module_name;
let so_filename = match bindings_crate {
BridgeModel::BindingsAbi3(..) => format!("{base}.abi3.so", base = module_name),
_ => python_interpreter
.expect("missing python interpreter for non-abi3 wheel build")
.get_library_name(module_name),
};
let macos_dylib_install_name =
format!("link-args=-Wl,-install_name,@rpath/{}", so_filename);
let mac_args = [
Expand Down