From 5f5a99403a40d399ba87bc8c8f505c617958458d Mon Sep 17 00:00:00 2001 From: Jeremy Parker Date: Sat, 15 Jul 2023 15:49:15 +1000 Subject: [PATCH] Add linker directive for *-darwin to fix PyO3 Without these flags I get linking errors like this when building from nixpkgs: = note: Undefined symbols for architecture arm64: "_PyExc_ConnectionResetError", referenced from: pyo3::type_object::PyTypeInfo::type_object::hd73bc9c256c52717 in libpyo3-c59aeb8b74bb57e0.rlib(pyo3-c59aeb8b74bb57e0.pyo3.e60578ba-cgu.0.rcgu.o) See: https://pyo3.rs/main/building_and_distribution#macos --- .cargo/config.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..d47f983e47 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,11 @@ +[target.x86_64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] + +[target.aarch64-apple-darwin] +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +]