PyO3 / pyo3

Rust bindings for the Python interpreter
https://pyo3.rs
Apache License 2.0
12.19k stars 752 forks source link

Undefined symbols for architecture arm64 #1800

Closed n8henrie closed 2 years ago

n8henrie commented 3 years ago

🐛 Bug Reports

When reporting a bug, please provide the following information. If this is not a bug report you can just discard this template.

🌍 Environment

💥 Reproducing

$ cat Cargo.toml
[package]
name = "foo"
version = "0.1.0"
edition = "2018"

[lib]
name = "foo"
crate-type = ["cdylib"]

[dependencies.pyo3]
version = "0.14.2"
features = ["extension-module"]
$ cat src/lib.rs
use pyo3::prelude::*;

#[pyfunction]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
    Ok((a + b).to_string())
}

#[pymodule]
fn foo(_py: Python, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test() {
        assert_ne!(sum_as_string(10, 20).unwrap(), "29");
        assert_eq!(sum_as_string(10, 20).unwrap(), "30");
    }
}
$ ./.venv/bin/python -m pip install --upgrade maturin
Collecting maturin
  Using cached maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.5 MB)
Collecting toml~=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
$ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling proc-macro-hack v0.5.19
   Compiling syn v1.0.74
   Compiling pyo3-build-config v0.14.2 (https://github.com/PyO3/pyo3#336e87ec)
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling unindent v0.1.7
   Compiling quote v1.0.9
   Compiling parking_lot_core v0.8.3
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2 (https://github.com/PyO3/pyo3#336e87ec)
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2 (https://github.com/PyO3/pyo3#336e87ec)
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2 (https://github.com/PyO3/pyo3#336e87ec)
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 6.09s
$ cargo test
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.110fvvgslxwl7xjc.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.12kh3itm9hwj9eya.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.16g57alsqnv4g7f.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.1a0ghimskmekwiuk.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.1av1bln3bhfp9nj.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.1f7ufrshnyieunmq.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.1grj2h43vo039nxn.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.1w6b9uzfz2s5unib.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.23ga6qr0715pwz5y.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.24e8nkkcbbxnt787.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2a30e9rsdwwu0myc.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2bfqaxllo29w3ifh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2crziipwfs2kz1rl.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2ehls50ircwkdmom.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2f1e1rxz18gsu2mj.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2fdsczpl1dm1fip.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2g4fb0qea2p4q6xm.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2guxm18uiabqkc4g.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2jufnvyjxohkzt7x.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2knf917igqi0yh23.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2p5zghtzgwcs84b3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2ryebkgzo7xg8qnt.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2w9t2gyroz08k6r5.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2zqka4hc0y9fowwt.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2zxc1obih7i5hr7t.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.2zygjmkbd28bfn6s.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.31ff4xyicc3wnhmg.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.32mlaq0jdx1jm6es.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.386vuxnbh48s9wou.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3cd74yt2oylhtzgz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3exvfe10ewcn52er.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3g5mqpn1qg0wh1a9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3h0owt6q12tqs9k1.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3lmvouff0a9ask7g.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3m044sb2289k1a45.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3nlmoppukou4iz9o.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3sp1r43kboysk609.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.3z1hnn9k793ut1vv.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.404rd2jigivih456.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.41g3d6jr8g5e13dg.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.44bcgq52s2fm83bo.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.46y4g6gr7pgrmj5p.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4a8upifjlrchwi95.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4ibyiowjhkywlxz5.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4kb8d8qea0l2v9xb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4u279idye23i71pz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4vdhqlwluf10xra6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4vw02eizd1tr7ojw.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4wsoqwueg83w4bj4.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4xwdfbwtcu6drnpn.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4zb71mjndf679w95.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.4zebmmyhpove6ig9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.50i6cvni8o6e604x.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.50m5yqhkl1tj8tt7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.51bwrx5e8skq6vdz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.53gw0dkzu34phl59.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.54uz16ierizblqjb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.58htorl2ddld3vy6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.5efmic2dvfz0pyna.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.7vrbjuouu484zpk.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.d8kk98i9kjuql8j.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.gc7opmckjdvlw86.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.io5k9a5m56skmi7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.m0svsb223gbvcdi.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.ov0hczhn18vqy4g.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.pp1aw1mhc4kqgka.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.q1smzop47y4w3d2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.snh43turx8z4g5z.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.vfssu1qsbtfwmz3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879.44z81xxn3zvsfpbf.rcgu.o" "-L" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libtest-06ff11d645105e2b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libterm-f05ecaeca66814e6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgetopts-6ad0d034fc8e15c7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunicode_width-c4beacdc35405cb8.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_std-fc0f4647def297a8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libpyo3-194c7c6b45ae4486.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libparking_lot-3d6f176468cb3e55.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libparking_lot_core-1a66328f5320fcf8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libsmallvec-b1d3333bf059e064.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/liblock_api-09ae7dbe1cd82c80.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libscopeguard-62e7a6d9289eec1f.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libinstant-4e05ab198a32da16.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libcfg_if-254a4227ea494762.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/liblibc-2d65d84e2d4e9c71.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libunindent-dda6001dcdbb754c.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libpaste-61320a4b949429d0.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/libindoc-758ee8d2665c486a.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-000cdec9267bfd7b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-2669f3cbce8358f4.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-86461a1c60728ccb.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-f17574752cb5ddba.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-3bb606c936cc0d28.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-8139a4b0cda20184.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-ea0823eca3e9abf9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-4f19e1259f6028e7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-435daca85b8e10b5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-d73085abefd284c6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-e6a09ca0044b34e5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-e07333f48f53c71e.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-2a49b0d9fbc7a459.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-b66dda66aafe36c9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-34d0b58da984bf31.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-01275baa20724171.rlib" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Undefined symbols for architecture arm64:
            "_PyExc_TypeError", referenced from:
                _$LT$pyo3..exceptions..PyTypeError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::h3351d28f1f012e04 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.1.rcgu.o)
            "_PyExc_BaseException", referenced from:
                _$LT$pyo3..exceptions..PyBaseException$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::h3e7fd002a901032a in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.1.rcgu.o)
            "_PyBytes_AsString", referenced from:
                pyo3::types::bytes::PyBytes::as_bytes::hcb83c311a32d8877 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyErr_Print", referenced from:
                pyo3::err::panic_after_error::h86153d46e74bf037 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyBytes_Size", referenced from:
                pyo3::types::bytes::PyBytes::as_bytes::hcb83c311a32d8877 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyErr_NormalizeException", referenced from:
                pyo3::err::PyErr::normalized::h9588758d1ccab3f5 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyErr_PrintEx", referenced from:
                pyo3::err::PyErr::print::h797d38ccce2cbbaf in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyErr_NewException", referenced from:
                pyo3::err::PyErr::new_type::hfb51b941f04ed644 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyErr_Restore", referenced from:
                pyo3::err::PyErr::restore::h1dbbf8b88416361d in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyGILState_Release", referenced from:
                _$LT$pyo3..gil..GILGuard$u20$as$u20$core..ops..drop..Drop$GT$::drop::hf2f8a6f21e2d4dfe in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.10.rcgu.o)
            "_PyErr_Fetch", referenced from:
                pyo3::err::PyErr::fetch::h48d0241c5aeeaf12 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.15.rcgu.o)
            "_PyUnicode_AsUTF8AndSize", referenced from:
                pyo3::types::string::PyString::to_str::h7219ef1704e18050 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.2.rcgu.o)
            "_PyGILState_Ensure", referenced from:
                pyo3::gil::GILGuard::acquire_unchecked::hb63c5f585f222b6d in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.10.rcgu.o)
            "_PyEval_ThreadsInitialized", referenced from:
                pyo3::gil::GILGuard::acquire::_$u7b$$u7b$closure$u7d$$u7d$::hb0a84271271719f2 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.10.rcgu.o)
            "_PyUnicode_AsEncodedString", referenced from:
                pyo3::types::string::PyString::to_string_lossy::hdc219ee0b91d0d09 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.2.rcgu.o)
            "_Py_IsInitialized", referenced from:
                pyo3::gil::GILGuard::acquire::_$u7b$$u7b$closure$u7d$$u7d$::hb0a84271271719f2 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.10.rcgu.o)
            "_PyExc_SystemError", referenced from:
                _$LT$pyo3..exceptions..PySystemError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::h788c3eab76189041 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.1.rcgu.o)
            "_PyObject_Repr", referenced from:
                pyo3::types::any::PyAny::repr::hb17f942fc5a28d64 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.11.rcgu.o)
            "__Py_Dealloc", referenced from:
                pyo3::ffi::object::Py_DECREF::h99cb8d1a6d9fe0a4 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.5.rcgu.o)
            "_PyUnicode_FromStringAndSize", referenced from:
                pyo3::types::string::PyString::new::h875d8b9d6e9e8e21 in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.2.rcgu.o)
            "_PyObject_GetAttr", referenced from:
                pyo3::types::any::PyAny::getattr::_$u7b$$u7b$closure$u7d$$u7d$::h26dc56d4a757defc in libpyo3-194c7c6b45ae4486.rlib(pyo3-194c7c6b45ae4486.pyo3.960x274q-cgu.11.rcgu.o)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `foo`

To learn more, run the command again with --verbose.

Things I've tried with / without in various combinations:

[target.aarch64-apple-darwin]
rustflags = [
  "-C", "link-arg=-undefined",
  "-C", "link-arg=dynamic_lookup",
]

This results in a different error:

dyld: Symbol not found: _PyExc_BaseException
  Referenced from: /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879
  Expected in: flat namespace
 in /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.uLGa46f6aT/foo/target/debug/deps/foo-bf9e8350fad87879` (signal: 6, SIGABRT: process abort signal)

Also no change with:

[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]

I've tried to cargo clean before cargo test with all of these, and tried with cargo test --no-default-features as well.

Thanks for a cool library, I'm excited to start delving into it. FWIW this was building and testing fine on Windows yesterday :) It looks like there is some active work going on to make this easier on MacOS, so I hope this is more constructive than just adding to noise or confusion.

Further reading:

davidhewitt commented 3 years ago

Right, so if I'm reading this correctly, maturin develop works to build the library. But you are having difficulty running tests.

maturin actually passes the cargo config automatically, but I suspect that the cargo config will cause problems with testing. To confirm, can you try:

  1. Remove the cargo configuration file and confirm maturin develop still builds successfully
  2. Make sure your Cargo.toml looks like this:

      [package]
      name = "foo"
      version = "0.1.0"
      edition = "2018"
    
      [lib]
      name = "foo"
      crate-type = ["cdylib"]
    
      [dependencies]
      pyo3 = "0.14.2"
    
      [features]
      extension-module = ["pyo3/extension-module"]
      default = ["extension-module"]

    This is necessary so that we're sure that pyo3's extension-module feature will not be requested when cargo test --no-default-features is run.

  3. Now try cargo test --no-default-features
n8henrie commented 3 years ago

Thank you so much for a rapid response!

Progress! I was able to get the minimal example to test without errors!

I'm still seeing the error: linking withccfailed: exit status: 1 error above in my real use-case though, but I noted that it is now ending with

= note: ld: library not found for -lpython3.9
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

which made me wonder.

Sure enough, I wiped out my virtualenv and created a new virtualenv using system python (I usually use pyenv for projects to keep the python version reproducible) and it then works!

I've tried to wrap this up into a little shell script for reproducibility, named tryagain.sh:

#!/bin/bash

set -Eeuf -o pipefail

pushd $(mktemp -d)

cargo new --lib foo
pushd foo

cat << 'EOF' > Cargo.toml
[package]
name = "foo"
version = "0.1.0"
edition = "2018"

[lib]
name = "foo"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.14.2"

[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]
EOF

cat << 'EOF' > ./src/lib.rs
use pyo3::prelude::*;

#[pyfunction]
fn sum_as_string(a: usize, b: usize) -> PyResult<String> {
    Ok((a + b).to_string())
}

#[pymodule]
fn foo(_py: Python, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(sum_as_string, m)?)?;
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test() {
        assert_ne!(sum_as_string(10, 20).unwrap(), "29");
        assert_eq!(sum_as_string(10, 20).unwrap(), "30");
    }
}
EOF

"${BASE_PYTHON}" -m venv .venv
. ./.venv/bin/activate
pip install --upgrade maturin
maturin develop
./.venv/bin/python -c 'import foo; print(foo.sum_as_string(123, 456))'
cargo test --no-default-features

BASE_PYTHON=/opt/homebrew/bin/python3 works great:

$ BASE_PYTHON=/opt/homebrew/bin/python3 ./tryagain.sh
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn ~
     Created library `foo` package
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn/foo /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn ~
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting maturin
  Using cached maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.5 MB)
Collecting toml~=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn/foo/.venv/bin/python3.9 -m pip install --upgrade pip' command.
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling pyo3-build-config v0.14.2
   Compiling proc-macro-hack v0.5.19
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling smallvec v1.6.1
   Compiling unindent v0.1.7
   Compiling scopeguard v1.1.0
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 6.55s
579
   Compiling pyo3-build-config v0.14.2
   Compiling pyo3-macros-backend v0.14.2
   Compiling pyo3 v0.14.2
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.rubRasS1Bn/foo)
    Finished test [unoptimized + debuginfo] target(s) in 3.64s
     Running unittests (target/debug/deps/foo-1c4d5e927fcdf368)

running 1 test
test tests::test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

BASE_PYTHON=/usr/bin/python3 fails:

$ BASE_PYTHON=/usr/bin/python3 bash -x ./tryagain.sh
+ set -Eeuf -o pipefail
++ mktemp -d
+ pushd /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ ~
+ cargo new --lib foo
     Created library `foo` package
+ pushd foo
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ ~
+ cat
+ cat
+ /usr/bin/python3 -m venv .venv
+ . ./.venv/bin/activate
++ deactivate nondestructive
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
++ '[' -n '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo/.venv
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ PATH=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo/.venv/bin:/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ export PATH
++ '[' -n '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ '[' 'x(.venv) ' '!=' x ']'
++ PS1='(.venv) '
++ export PS1
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
+ pip install --upgrade maturin
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting maturin
  Using cached https://files.pythonhosted.org/packages/c3/d7/ccc6a225fde990e2e148a2abe04b12051a7f294af36c24c70d5f4d4d3ba9/maturin-0.11.2.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting toml~=0.10.0 (from maturin)
Building wheels for collected packages: maturin
  Building wheel for maturin (PEP 517) ... done
  Created wheel for maturin: filename=maturin-0.11.2-cp38-cp38-macosx_10_14_arm64.whl size=5465097 sha256=3bcf269fead227a2172acaec4eb38b09189877a64479cd0b281cb0ab376841d7
  Stored in directory: /Users/n8henrie/Library/Caches/pip/wheels/49/2c/52/a3e6516684b174db7024ee4d40f1572f0e3afc8f726bd285a2
Successfully built maturin
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
WARNING: You are using pip version 19.2.3, however version 21.2.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
+ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.8 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling pyo3-build-config v0.14.2
   Compiling proc-macro-hack v0.5.19
   Compiling syn v1.0.74
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling scopeguard v1.1.0
   Compiling unindent v0.1.7
   Compiling smallvec v1.6.1
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 7.14s
+ ./.venv/bin/python -c 'import foo; print(foo.sum_as_string(123, 456))'
579
+ cargo test --no-default-features
   Compiling pyo3-build-config v0.14.2
   Compiling pyo3-macros-backend v0.14.2
   Compiling pyo3 v0.14.2
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo)
    Finished test [unoptimized + debuginfo] target(s) in 4.05s
     Running unittests (target/debug/deps/foo-1c4d5e927fcdf368)
dyld: Library not loaded: @rpath/Python3.framework/Versions/3.8/Python3
  Referenced from: /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo/target/debug/deps/foo-1c4d5e927fcdf368
  Reason: image not found
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.9jGt7C48TJ/foo/target/debug/deps/foo-1c4d5e927fcdf368` (signal: 6, SIGABRT: process abort signal)

Also fails with pyenv:

$ BASE_PYTHON=~/.pyenv/versions/3.9.6/bin/python bash -x ./tryagain.sh
+ set -Eeuf -o pipefail
++ mktemp -d
+ pushd /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw ~
+ cargo new --lib foo
     Created library `foo` package
+ pushd foo
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw ~
+ cat
+ cat
+ /Users/n8henrie/.pyenv/versions/3.9.6/bin/python -m venv .venv
+ . ./.venv/bin/activate
++ deactivate nondestructive
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
++ '[' -n '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/.venv
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ PATH=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/.venv/bin:/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ export PATH
++ '[' -n '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ PS1='(.venv) '
++ export PS1
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
+ pip install --upgrade maturin
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting maturin
  Using cached maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.5 MB)
Collecting toml~=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/.venv/bin/python -m pip install --upgrade pip' command.
+ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling pyo3-build-config v0.14.2
   Compiling proc-macro-hack v0.5.19
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.6.1
   Compiling unindent v0.1.7
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 6.55s
+ ./.venv/bin/python -c 'import foo; print(foo.sum_as_string(123, 456))'
579
+ cargo test --no-default-features
   Compiling pyo3-build-config v0.14.2
   Compiling pyo3-macros-backend v0.14.2
   Compiling pyo3 v0.14.2
   Compiling pyo3-macros v0.14.2
   Compiling foo v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.11n0aozoykkp8vp0.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.13ekfwl8xqye36nv.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.147bs2bm2085us5c.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.14pn2f8nwk1t6qae.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1804nb930xd29yb5.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1ascli86ea7rwynh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1f1vg5piv6jwzbg0.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1lbtx8u6ljt7eze6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1p30v8s9jw6zr82e.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1sr2wyn3ju8pec2h.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1tssx2hfyfnwoxvf.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1x63xp44dls90leh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.1xngabboe78qonlj.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.238mkxmd9qi1ksmr.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.25fjticj0u2acjk7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.27s2j6ayzwc044gf.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.27vswwsgoymotpy.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.29td8lio2j5bphyb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2bnx8jhomny7gpi2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2drx0qxri4864104.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2dw969bl93scn68y.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2ff0qy7ji71iddxq.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2np04k9y69nqj9zj.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2o8dshf8be93fes3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2r4cxzmaw02yjgge.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2vbgh7qou9lj2v5h.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.2w82l6o3f7dme3hh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.30t7khvabixohglr.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.31l6qohtxrs80dud.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.34cgpycuy81wrkb9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.36u8ly51qkskt353.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.39xv1mxm2nhcu0sq.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3a7iyoficy4fp277.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3bg6jkdsil3wllq4.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3d806voc4gehh1ty.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3qgw0vsrsi45mhcg.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3qkmo00crqgjxiwl.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.3xp9s52vi53is3ki.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.44mn2vzryauqjnii.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.467cf3ny8a6p963k.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.47l9495zz2h183x6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.482zq7iwkiewhwcf.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4an3dkv107jvuh1x.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4auzszq5mhquvisb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4h0jjasv96wb1bek.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4ilhpzcvb1w1a4wn.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4k7d2bozdm010jfa.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4u5a5mgqpwpju7ds.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4uafbkikuqof7e8l.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4xx9ocr0whpoy83c.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.4ya7ku4gwkheiknu.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.50d5dxu2uthufns3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.51zvx0f0pxy9smvv.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.53czapz2sn2mvsun.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.55bx7448urxw4iyi.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.584eyyuxox7hf2ai.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.58whg9y7i7iw84ow.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.59m6hup70m7qjznt.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.5alca8k8ib2diyzc.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.7ectbpalmjgo5pk.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.9ifrlwvu2ifcneb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.b7f6h9ghtesdhur.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.der3qkfpuyrxftq.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.dr7luk0ziodv0du.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.fb3gc9qnp52h2d0.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.iqmarm2qn5yuvtn.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.jkgl05uljj98pih.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.ndmed2z1v0092ue.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.nt3j9o15ogab9pp.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368.23pkn328j1jei416.rcgu.o" "-L" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps" "-L" "/Users/n8henrie/.pyenv/versions/3.9.6/lib" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libtest-06ff11d645105e2b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libterm-f05ecaeca66814e6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgetopts-6ad0d034fc8e15c7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunicode_width-c4beacdc35405cb8.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_std-fc0f4647def297a8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libpyo3-44857f8da2fa9343.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libparking_lot-3d6f176468cb3e55.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libparking_lot_core-1a66328f5320fcf8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libsmallvec-b1d3333bf059e064.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/liblock_api-09ae7dbe1cd82c80.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libscopeguard-62e7a6d9289eec1f.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libinstant-4e05ab198a32da16.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libcfg_if-254a4227ea494762.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/liblibc-2d65d84e2d4e9c71.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libunindent-dda6001dcdbb754c.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libpaste-61320a4b949429d0.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/libindoc-758ee8d2665c486a.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-000cdec9267bfd7b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-2669f3cbce8358f4.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-86461a1c60728ccb.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-f17574752cb5ddba.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-3bb606c936cc0d28.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-8139a4b0cda20184.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-ea0823eca3e9abf9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-4f19e1259f6028e7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-435daca85b8e10b5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-d73085abefd284c6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-e6a09ca0044b34e5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-e07333f48f53c71e.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-2a49b0d9fbc7a459.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-b66dda66aafe36c9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-34d0b58da984bf31.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-01275baa20724171.rlib" "-lpython3.9" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.2llp70QyMw/foo/target/debug/deps/foo-1c4d5e927fcdf368" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: library not found for -lpython3.9
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `foo`

To learn more, run the command again with --verbose.

It's good to see (via the python3 -c line) that the library is running in all 3 cases!

I've tried re-adding the [target.aarch64-apple-darwin] part to ~/.cargo/config and re-testing, and I see the same behavior -- homebrew python works, system python and pyenv python fail.

I see a similar error mentioned here, but it doesn't seem relevant as I'm running all commands as my current user (no sudo).

Sorry if this is now a separate issue -- I'd be happy to start a new issue if you'd like. Keeping here for now, as it's still giving me what seems like an architecture-specific error when running cargo test.

n8henrie commented 3 years ago

I added export PYO3_PRINT_CONFIG=1 and export PYO3_PYTHON=${BASE_PYTHON} to my script above; it now fails at maturin develop with all configurations (even with homebrew python, which was succeeding previously). For example using homebrew python:

error: failed to run custom build command for pyo3 v0.14.2

Caused by: process didn't exit successfully: /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/target/debug/build/pyo3-e7640a89dd93619b/build-script-build (exit status: 101) --- stdout cargo:rerun-if-env-changed=PYO3_CROSS cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG

-- PYO3_PRINT_CONFIG=1 is set, printing configuration and halting compile -- implementation=CPython version=3.9 shared=true abi3=false lib_name=python3.9 lib_dir=/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib executable=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/.venv/bin/python pointer_width=64 build_flags=WITH_THREAD warning: build failed, waiting for other jobs to finish... error: build failed 💥 maturin failed Caused by: Failed to build a native library through cargo Caused by: Failed to build a native library through cargo Caused by: Cargo build finished with "exit status: 101": cargo rustc --message-format json --manifest-path Cargo.toml --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/foo.cpython-39-darwin.so

$ BASE_PYTHON=/opt/homebrew/bin/python3 bash -x ./tryagain.sh
+ set -Eeuf -o pipefail
+ export PYO3_PRINT_CONFIG=1
+ PYO3_PRINT_CONFIG=1
+ export PYO3_PYTHON=/opt/homebrew/bin/python3
+ PYO3_PYTHON=/opt/homebrew/bin/python3
++ mktemp -d
+ pushd /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2 ~
+ cargo new --lib foo
     Created library `foo` package
+ pushd foo
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2 ~
+ cat
+ cat
+ /opt/homebrew/bin/python3 -m venv .venv
+ . ./.venv/bin/activate
++ deactivate nondestructive
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
++ '[' -n '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/.venv
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ PATH=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/.venv/bin:/Users/n8henrie/.nix-profile/bin:/Users/n8henrie/.pyenv/bin:/Users/n8henrie/.pyenv/shims:/Users/n8henrie/.cargo/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/openjdk/bin:/Users/n8henrie/.rbenv/shims:/opt/homebrew/opt/opencv3/bin:/opt/homebrew/heroku/bin:/opt/homebrew/opt/go/libexec/bin:/Users/n8henrie/go/bin:/opt/homebrew/opt/ruby23/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/python@3.9/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/make/libexec/gnubin:/opt/homebrew/opt/inetutils/libexec/gnubin:/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-which/libexec/gnubin:/opt/homebrew/opt/gnu-units/libexec/gnubin:/opt/homebrew/opt/gnu-time/libexec/gnubin:/opt/homebrew/opt/gnu-tar/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin:/opt/homebrew/opt/gnu-getopt/libexec/gnubin:/opt/homebrew/opt/findutils/libexec/gnubin:/opt/homebrew/opt/coreutils/libexec/gnubin::/Users/n8henrie/.local/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/n8henrie/Library/Python/3.9/bin
++ export PATH
++ '[' -n '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ PS1='(.venv) '
++ export PS1
++ '[' -n /opt/homebrew/bin/bash -o -n '' ']'
++ hash -r
+ pip install --upgrade maturin
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting maturin
  Using cached maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.5 MB)
Collecting toml~=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/.venv/bin/python3.9 -m pip install --upgrade pip' command.
+ maturin develop
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling pyo3-build-config v0.14.2
   Compiling proc-macro-hack v0.5.19
   Compiling syn v1.0.74
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling scopeguard v1.1.0
   Compiling unindent v0.1.7
   Compiling smallvec v1.6.1
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
error: failed to run custom build command for `pyo3 v0.14.2`

Caused by:
  process didn't exit successfully: `/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/target/debug/build/pyo3-e7640a89dd93619b/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PYO3_CROSS
  cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
  cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
  cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG

  -- PYO3_PRINT_CONFIG=1 is set, printing configuration and halting compile --
  implementation=CPython
  version=3.9
  shared=true
  abi3=false
  lib_name=python3.9
  lib_dir=/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib
  executable=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PO3xJrs7c2/foo/.venv/bin/python
  pointer_width=64
  build_flags=WITH_THREAD
warning: build failed, waiting for other jobs to finish...
error: build failed
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib -- -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-args=-Wl,-install_name,@rpath/foo.cpython-39-darwin.so`

EDIT: The problem should have been obvious: -- PYO3_PRINT_CONFIG=1 is set, printing configuration and halting compile --. Removing the PYO3_PRINT_CONFIG and just leaving PYO3_PYTHON restores the prior behavior, where homebrew works and the others don't. Sorry about that.

davidhewitt commented 3 years ago

It's expected for the compilation to stop with PYO3_PRINT_CONFIG=1 - the only way to get output to the user from the PyO3 build script is to stop the compilation.

Looks like system python and pyenv are failing for different reasons.

With ystem python it looks like your setup is not finding the system Python shared library at runtime - you need to make sure your environment is setup appropriately to do this, maybe these resources can help with that:

With pyenv it looks like the python shared library isn't being found at link time. Can you use PYO3_PRINT_CONFIG with that configuration and check the lib_dir which the config reports? There should be a libpython3.9.dylib in there, I guess...

n8henrie commented 3 years ago

It's expected for the compilation to stop with PYO3_PRINT_CONFIG=1 - the only way to get output to the user from the PyO3 build script is to stop the compilation.

Yes, your response beat my edit. Your error message was very obvious, sorry I missed that.

Can you use PYO3_PRINT_CONFIG with that configuration and check the lib_dir which the config reports?

  -- PYO3_PRINT_CONFIG=1 is set, printing configuration and halting compile --
  implementation=CPython
  version=3.9
  shared=true
  abi3=false
  lib_name=python3.9
  lib_dir=/Users/n8henrie/.pyenv/versions/3.9.6/lib
  executable=/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.PcfraYz14r/foo/.venv/bin/python
  pointer_width=64
  build_flags=WITH_THREAD
$ ls /Users/n8henrie/.pyenv/versions/3.9.6/lib
pkgconfig  python3.9
$ fd libpython3.9.dylib /Users/n8henrie/.pyenv/versions/3.9.6/lib
$ fd 'libpython.*.dylib' /Users/n8henrie/.pyenv/versions/3.9.6/lib
$ fd 'libpython.*.dylib' /Users/n8henrie/.pyenv/versions/3.9.6/
/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/libpython3.9.dylib
/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin/libpython3.9.dylib
n8henrie commented 3 years ago

dyld: Library not loaded: @rpath/Python3.framework/Versions/3.8/Python3 With ystem python it looks like your setup is not finding the system Python shared library at runtime

It looks like maybe there is no python3 framework with which to link on big sur?

$ otool -L /usr/bin/python3 /usr/bin/python
/usr/bin/python3 (architecture x86_64):
        /usr/lib/libxcselect.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.120.1)
/usr/bin/python3 (architecture arm64e):
        /usr/lib/libxcselect.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.120.1)
/usr/bin/python (architecture x86_64):
        /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.120.1)
/usr/bin/python (architecture arm64e):
        /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.120.1)
$ ls -ld /System/Library/Frameworks/Python*
drwxr-xr-x 5 root wheel 160 Jan  1  2020 /System/Library/Frameworks/Python.framework
$ fd -l libpython /usr/lib
lrwxr-xr-x 1 root wheel 18 Jan  1  2020 /usr/lib/libpython.dylib -> libpython2.7.dylib
lrwxr-xr-x 1 root wheel 68 Jan  1  2020 /usr/lib/libpython2.7.dylib -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/Python
messense commented 3 years ago

I usually install Python from pyenv using PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install X.Y.Z which doesn't build the Python.framework thing and never encountered this kind of issues.

n8henrie commented 3 years ago

With regards to the pyenv failure, it looks like it's because I've installed my pyenv pythons with the --enable-framework flag (which I had to do to allow linking to some of the MacOS libraries IIRC).

I just tried adding --enable-shared, and I get:

configure: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead
n8henrie commented 3 years ago

For pyenv, I tried adding to the script

export LD_LIBRARY_PATH=$(dirname "${BASE_PYTHON}")/../Python.framework/Versions/3.9/lib

which correctly maps to the folder containing libpython3.9.dylib, but it still fails with:

 = note: ld: library not found for -lpython3.9
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

I then tried with a folder containing libpython3.9.a, also no luck:

export LD_LIBRARY_PATH=$(dirname "${BASE_PYTHON}")/../Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin

I then found this issue and so tried

export LD_LIBRARY_PATH=$(dirname "${BASE_PYTHON}")/../lib

which failed with the same error.

EDIT: (I added a line immediately after to ls "${LD_LIBRARY_PATH}" to confirm I got the path right in all cases.)

davidhewitt commented 3 years ago

As far as I know LD_LIBRARY_PATH is a runtime rather thank link-time thing, so I'm unsuprised that didn't help.

Can you dump the contents of python -m sysconfig for one of your pyenv installs? I would be curious to know if there's some configuration PyO3 can use to resolve this case, or whether it looks like it's always going to need user help to supply the right library path.

davidhewitt commented 3 years ago

It looks like maybe there is no python3 framework with which to link on big sur?

It's possible. What does /System/Library/Frameworks/Python.framework contain? There's definitely no 3.x version in there?

(I think with the system python you did link successfully to something, so it should just be a case of finding the library (lib_dir from PYO3_PRINT_CONFIG?) and using LD_LIBRARY_PATH to include that at link load time)

n8henrie commented 3 years ago

As far as I know LD_LIBRARY_PATH is a runtime rather thank link-time thing, so I'm unsuprised that didn't help.

I exported it at the beginning of the same script above, which does everything from virtualenv creation to maturin develop to cargo test --no-default-features, so it should be present at runtime as well. Right?

It's possible. What does /System/Library/Frameworks/Python.framework contain? There's definitely no 3.x version in there?

$ ls /System/Library/Frameworks/Python.framework
Python  Resources  Versions
$ ls /System/Library/Frameworks/Python.framework/Versions
2.3  2.5  2.6  2.7  Current

Can you dump the contents of python -m sysconfig for one of your pyenv installs?

$ ~/.pyenv/versions/3.9.6/bin/python -m sysconfig
Platform: "macosx-11.4-arm64"
Python version: "3.9"
Current installation scheme: "posix_prefix"

Paths: 
    data = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9"
    include = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include/python3.9"
    platinclude = "/Users/n8henrie/.pyenv/versions/3.9.6/include/python3.9"
    platlib = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9/site-packages"
    platstdlib = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9"
    purelib = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9/site-packages"
    scripts = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/bin"
    stdlib = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9"

Variables: 
    ABIFLAGS = ""
    AC_APPLE_UNIVERSAL_BUILD = "0"
    AIX_BUILDDATE = "0"
    AIX_GENUINE_CPLUSPLUS = "0"
    ALT_SOABI = "0"
    ANDROID_API_LEVEL = "0"
    AR = "ar"
    ARFLAGS = "rcs"
    BASECFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic"
    BASECPPFLAGS = ""
    BASEMODLIBS = ""
    BINDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/bin"
    BINLIBDEST = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9"
    BLDLIBRARY = ""
    BLDSHARED = "clang -bundle -undefined dynamic_lookup -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    BUILDEXE = ".exe"
    BUILDPYTHON = "python.exe"
    BUILD_GNU_TYPE = "arm-apple-darwin20.5.0"
    BYTESTR_DEPS = "\"
    CC = "clang"
    CCSHARED = ""
    CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
    CFLAGSFORSHARED = ""
    CFLAGS_ALIASING = "-fno-strict-aliasing"
    CONFIGFILES = "configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
    CONFIGURE_CFLAGS = "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
    CONFIGURE_CFLAGS_NODIST = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden"
    CONFIGURE_CPPFLAGS = "-I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include"
    CONFIGURE_LDFLAGS = "-L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    CONFIGURE_LDFLAGS_NODIST = ""
    CONFIG_ARGS = "'--prefix=/Users/n8henrie/.pyenv/versions/3.9.6' '--enable-optimizations' '--enable-framework=/Users/n8henrie/.pyenv/versions/3.9.6' '--libdir=/Users/n8henrie/.pyenv/versions/3.9.6/lib' '--with-openssl=/opt/homebrew/opt/openssl@1.1' 'CC=clang' 'CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include  ' 'LDFLAGS=-L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib' 'CPPFLAGS=-I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include' 'PKG_CONFIG_PATH=/opt/homebrew/opt/openssl@1.1/lib/pkgconfig/:'"
    CONFINCLUDEDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include"
    CONFINCLUDEPY = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include/python3.9"
    COREPYTHONPATH = ""
    COVERAGE_INFO = "/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6/coverage.info"
    COVERAGE_REPORT = "/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6/lcov-report"
    COVERAGE_REPORT_OPTIONS = "--no-branch-coverage --title "CPython lcov report""
    CPPFLAGS = "-I. -I./Include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include"
    CXX = "clang++"
    DESTDIRS = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9 /Users/n8henrie/.pyenv/versions/3.9.6/lib /Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9 /Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9/lib-dynload"
    DESTLIB = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9"
    DESTPATH = ""
    DESTSHARED = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9/lib-dynload"
    DFLAGS = ""
    DIRMODE = "755"
    DIST = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummy"
    DISTDIRS = "Include Lib Misc Ext-dummy"
    DISTFILES = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
    DLINCLDIR = "."
    DLLLIBRARY = ""
    DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 = "0"
    DOUBLE_IS_BIG_ENDIAN_IEEE754 = "0"
    DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = "1"
    DTRACE = ""
    DTRACE_DEPS = "\"
    DTRACE_HEADERS = ""
    DTRACE_OBJS = ""
    DYNLOADFILE = "dynload_shlib.o"
    ENABLE_IPV6 = "1"
    ENSUREPIP = "upgrade"
    EXE = ""
    EXEMODE = "755"
    EXPORTSFROM = ""
    EXPORTSYMS = ""
    EXTRATESTOPTS = ""
    EXTRA_CFLAGS = ""
    EXT_SUFFIX = ".cpython-39-darwin.so"
    FILEMODE = "644"
    FLOAT_WORDS_BIGENDIAN = "0"
    FLOCK_NEEDS_LIBBSD = "0"
    GETPGRP_HAVE_ARG = "0"
    GITBRANCH = ""
    GITTAG = ""
    GITVERSION = ""
    GNULD = "no"
    HAVE_ACCEPT4 = "0"
    HAVE_ACOSH = "1"
    HAVE_ADDRINFO = "1"
    HAVE_ALARM = "1"
    HAVE_ALIGNED_REQUIRED = "0"
    HAVE_ALLOCA_H = "1"
    HAVE_ALTZONE = "0"
    HAVE_ASINH = "1"
    HAVE_ASM_TYPES_H = "0"
    HAVE_ATANH = "1"
    HAVE_BIND_TEXTDOMAIN_CODESET = "0"
    HAVE_BLUETOOTH_BLUETOOTH_H = "0"
    HAVE_BLUETOOTH_H = "0"
    HAVE_BROKEN_MBSTOWCS = "0"
    HAVE_BROKEN_NICE = "0"
    HAVE_BROKEN_PIPE_BUF = "0"
    HAVE_BROKEN_POLL = "0"
    HAVE_BROKEN_POSIX_SEMAPHORES = "0"
    HAVE_BROKEN_PTHREAD_SIGMASK = "0"
    HAVE_BROKEN_SEM_GETVALUE = "1"
    HAVE_BROKEN_UNSETENV = "0"
    HAVE_BUILTIN_ATOMIC = "1"
    HAVE_CHFLAGS = "1"
    HAVE_CHOWN = "1"
    HAVE_CHROOT = "1"
    HAVE_CLOCK = "1"
    HAVE_CLOCK_GETRES = "1"
    HAVE_CLOCK_GETTIME = "1"
    HAVE_CLOCK_SETTIME = "1"
    HAVE_COMPUTED_GOTOS = "1"
    HAVE_CONFSTR = "1"
    HAVE_CONIO_H = "0"
    HAVE_COPYSIGN = "1"
    HAVE_COPY_FILE_RANGE = "0"
    HAVE_CRYPT_H = "0"
    HAVE_CRYPT_R = "0"
    HAVE_CTERMID = "1"
    HAVE_CTERMID_R = "1"
    HAVE_CURSES_FILTER = "1"
    HAVE_CURSES_H = "1"
    HAVE_CURSES_HAS_KEY = "1"
    HAVE_CURSES_IMMEDOK = "1"
    HAVE_CURSES_IS_PAD = "0"
    HAVE_CURSES_IS_TERM_RESIZED = "1"
    HAVE_CURSES_RESIZETERM = "1"
    HAVE_CURSES_RESIZE_TERM = "1"
    HAVE_CURSES_SYNCOK = "1"
    HAVE_CURSES_TYPEAHEAD = "1"
    HAVE_CURSES_USE_ENV = "1"
    HAVE_CURSES_WCHGAT = "1"
    HAVE_DECL_ISFINITE = "1"
    HAVE_DECL_ISINF = "1"
    HAVE_DECL_ISNAN = "1"
    HAVE_DECL_RTLD_DEEPBIND = "0"
    HAVE_DECL_RTLD_GLOBAL = "1"
    HAVE_DECL_RTLD_LAZY = "1"
    HAVE_DECL_RTLD_LOCAL = "1"
    HAVE_DECL_RTLD_MEMBER = "0"
    HAVE_DECL_RTLD_NODELETE = "1"
    HAVE_DECL_RTLD_NOLOAD = "1"
    HAVE_DECL_RTLD_NOW = "1"
    HAVE_DECL_TZNAME = "0"
    HAVE_DEVICE_MACROS = "1"
    HAVE_DEV_PTC = "0"
    HAVE_DEV_PTMX = "1"
    HAVE_DIRECT_H = "0"
    HAVE_DIRENT_D_TYPE = "1"
    HAVE_DIRENT_H = "1"
    HAVE_DIRFD = "1"
    HAVE_DLFCN_H = "1"
    HAVE_DLOPEN = "1"
    HAVE_DUP2 = "1"
    HAVE_DUP3 = "0"
    HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH = "1"
    HAVE_DYNAMIC_LOADING = "1"
    HAVE_ENDIAN_H = "0"
    HAVE_EPOLL = "0"
    HAVE_EPOLL_CREATE1 = "0"
    HAVE_ERF = "1"
    HAVE_ERFC = "1"
    HAVE_ERRNO_H = "1"
    HAVE_EXECV = "1"
    HAVE_EXPLICIT_BZERO = "0"
    HAVE_EXPLICIT_MEMSET = "0"
    HAVE_EXPM1 = "1"
    HAVE_FACCESSAT = "1"
    HAVE_FCHDIR = "1"
    HAVE_FCHMOD = "1"
    HAVE_FCHMODAT = "1"
    HAVE_FCHOWN = "1"
    HAVE_FCHOWNAT = "1"
    HAVE_FCNTL_H = "1"
    HAVE_FDATASYNC = "0"
    HAVE_FDOPENDIR = "1"
    HAVE_FDWALK = "0"
    HAVE_FEXECVE = "0"
    HAVE_FINITE = "0"
    HAVE_FLOCK = "1"
    HAVE_FORK = "1"
    HAVE_FORKPTY = "1"
    HAVE_FPATHCONF = "1"
    HAVE_FSEEK64 = "0"
    HAVE_FSEEKO = "1"
    HAVE_FSTATAT = "1"
    HAVE_FSTATVFS = "1"
    HAVE_FSYNC = "1"
    HAVE_FTELL64 = "0"
    HAVE_FTELLO = "1"
    HAVE_FTIME = "1"
    HAVE_FTRUNCATE = "1"
    HAVE_FUTIMENS = "1"
    HAVE_FUTIMES = "1"
    HAVE_FUTIMESAT = "0"
    HAVE_GAI_STRERROR = "1"
    HAVE_GAMMA = "0"
    HAVE_GCC_ASM_FOR_MC68881 = "0"
    HAVE_GCC_ASM_FOR_X64 = "0"
    HAVE_GCC_ASM_FOR_X87 = "0"
    HAVE_GCC_UINT128_T = "1"
    HAVE_GETADDRINFO = "1"
    HAVE_GETC_UNLOCKED = "1"
    HAVE_GETENTROPY = "1"
    HAVE_GETGRGID_R = "1"
    HAVE_GETGRNAM_R = "1"
    HAVE_GETGROUPLIST = "1"
    HAVE_GETGROUPS = "1"
    HAVE_GETHOSTBYNAME = "1"
    HAVE_GETHOSTBYNAME_R = "0"
    HAVE_GETHOSTBYNAME_R_3_ARG = "0"
    HAVE_GETHOSTBYNAME_R_5_ARG = "0"
    HAVE_GETHOSTBYNAME_R_6_ARG = "0"
    HAVE_GETITIMER = "1"
    HAVE_GETLOADAVG = "1"
    HAVE_GETLOGIN = "1"
    HAVE_GETNAMEINFO = "1"
    HAVE_GETPAGESIZE = "1"
    HAVE_GETPEERNAME = "1"
    HAVE_GETPGID = "1"
    HAVE_GETPGRP = "1"
    HAVE_GETPID = "1"
    HAVE_GETPRIORITY = "1"
    HAVE_GETPWENT = "1"
    HAVE_GETPWNAM_R = "1"
    HAVE_GETPWUID_R = "1"
    HAVE_GETRANDOM = "0"
    HAVE_GETRANDOM_SYSCALL = "0"
    HAVE_GETRESGID = "0"
    HAVE_GETRESUID = "0"
    HAVE_GETSID = "1"
    HAVE_GETSPENT = "0"
    HAVE_GETSPNAM = "0"
    HAVE_GETWD = "1"
    HAVE_GLIBC_MEMMOVE_BUG = "0"
    HAVE_GRP_H = "1"
    HAVE_HSTRERROR = "1"
    HAVE_HTOLE64 = "0"
    HAVE_HYPOT = "1"
    HAVE_IEEEFP_H = "0"
    HAVE_IF_NAMEINDEX = "1"
    HAVE_INET_ATON = "1"
    HAVE_INET_PTON = "1"
    HAVE_INITGROUPS = "1"
    HAVE_INTTYPES_H = "1"
    HAVE_IO_H = "0"
    HAVE_IPA_PURE_CONST_BUG = "0"
    HAVE_KILL = "1"
    HAVE_KILLPG = "1"
    HAVE_KQUEUE = "1"
    HAVE_LANGINFO_H = "1"
    HAVE_LARGEFILE_SUPPORT = "0"
    HAVE_LCHFLAGS = "1"
    HAVE_LCHMOD = "1"
    HAVE_LCHOWN = "1"
    HAVE_LGAMMA = "1"
    HAVE_LIBDL = "1"
    HAVE_LIBDLD = "0"
    HAVE_LIBIEEE = "0"
    HAVE_LIBINTL_H = "0"
    HAVE_LIBREADLINE = "1"
    HAVE_LIBRESOLV = "0"
    HAVE_LIBSENDFILE = "0"
    HAVE_LIBUTIL_H = "0"
    HAVE_LINK = "1"
    HAVE_LINKAT = "1"
    HAVE_LINUX_CAN_BCM_H = "0"
    HAVE_LINUX_CAN_H = "0"
    HAVE_LINUX_CAN_J1939_H = "0"
    HAVE_LINUX_CAN_RAW_FD_FRAMES = "0"
    HAVE_LINUX_CAN_RAW_H = "0"
    HAVE_LINUX_CAN_RAW_JOIN_FILTERS = "0"
    HAVE_LINUX_MEMFD_H = "0"
    HAVE_LINUX_NETLINK_H = "0"
    HAVE_LINUX_QRTR_H = "0"
    HAVE_LINUX_RANDOM_H = "0"
    HAVE_LINUX_TIPC_H = "0"
    HAVE_LINUX_VM_SOCKETS_H = "0"
    HAVE_LINUX_WAIT_H = "0"
    HAVE_LOCKF = "1"
    HAVE_LOG1P = "1"
    HAVE_LOG2 = "1"
    HAVE_LONG_DOUBLE = "1"
    HAVE_LSTAT = "1"
    HAVE_LUTIMES = "1"
    HAVE_MADVISE = "1"
    HAVE_MAKEDEV = "1"
    HAVE_MBRTOWC = "1"
    HAVE_MEMFD_CREATE = "0"
    HAVE_MEMORY_H = "1"
    HAVE_MEMRCHR = "0"
    HAVE_MKDIRAT = "1"
    HAVE_MKFIFO = "1"
    HAVE_MKFIFOAT = "0"
    HAVE_MKNOD = "1"
    HAVE_MKNODAT = "0"
    HAVE_MKTIME = "1"
    HAVE_MMAP = "1"
    HAVE_MREMAP = "0"
    HAVE_NCURSES_H = "1"
    HAVE_NDIR_H = "0"
    HAVE_NETPACKET_PACKET_H = "0"
    HAVE_NET_IF_H = "1"
    HAVE_NICE = "1"
    HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION = "0"
    HAVE_OPENAT = "1"
    HAVE_OPENPTY = "1"
    HAVE_PATHCONF = "1"
    HAVE_PAUSE = "1"
    HAVE_PIPE2 = "0"
    HAVE_PLOCK = "0"
    HAVE_POLL = "1"
    HAVE_POLL_H = "1"
    HAVE_POSIX_FADVISE = "0"
    HAVE_POSIX_FALLOCATE = "0"
    HAVE_POSIX_SPAWN = "1"
    HAVE_POSIX_SPAWNP = "1"
    HAVE_PREAD = "1"
    HAVE_PREADV = "1"
    HAVE_PREADV2 = "0"
    HAVE_PRLIMIT = "0"
    HAVE_PROCESS_H = "0"
    HAVE_PROTOTYPES = "1"
    HAVE_PTHREAD_CONDATTR_SETCLOCK = "0"
    HAVE_PTHREAD_DESTRUCTOR = "0"
    HAVE_PTHREAD_GETCPUCLOCKID = "0"
    HAVE_PTHREAD_H = "1"
    HAVE_PTHREAD_INIT = "0"
    HAVE_PTHREAD_KILL = "1"
    HAVE_PTHREAD_SIGMASK = "1"
    HAVE_PTY_H = "0"
    HAVE_PWRITE = "1"
    HAVE_PWRITEV = "1"
    HAVE_PWRITEV2 = "0"
    HAVE_READLINK = "1"
    HAVE_READLINKAT = "1"
    HAVE_READV = "1"
    HAVE_REALPATH = "1"
    HAVE_RENAMEAT = "1"
    HAVE_RL_APPEND_HISTORY = "1"
    HAVE_RL_CATCH_SIGNAL = "1"
    HAVE_RL_COMPLETION_APPEND_CHARACTER = "1"
    HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = "1"
    HAVE_RL_COMPLETION_MATCHES = "1"
    HAVE_RL_COMPLETION_SUPPRESS_APPEND = "1"
    HAVE_RL_PRE_INPUT_HOOK = "1"
    HAVE_RL_RESIZE_TERMINAL = "1"
    HAVE_ROUND = "1"
    HAVE_RTPSPAWN = "0"
    HAVE_SCHED_GET_PRIORITY_MAX = "1"
    HAVE_SCHED_H = "1"
    HAVE_SCHED_RR_GET_INTERVAL = "0"
    HAVE_SCHED_SETAFFINITY = "0"
    HAVE_SCHED_SETPARAM = "0"
    HAVE_SCHED_SETSCHEDULER = "0"
    HAVE_SEM_GETVALUE = "1"
    HAVE_SEM_OPEN = "1"
    HAVE_SEM_TIMEDWAIT = "0"
    HAVE_SEM_UNLINK = "1"
    HAVE_SENDFILE = "1"
    HAVE_SETEGID = "1"
    HAVE_SETEUID = "1"
    HAVE_SETGID = "1"
    HAVE_SETGROUPS = "1"
    HAVE_SETHOSTNAME = "1"
    HAVE_SETITIMER = "1"
    HAVE_SETLOCALE = "1"
    HAVE_SETPGID = "1"
    HAVE_SETPGRP = "1"
    HAVE_SETPRIORITY = "1"
    HAVE_SETREGID = "1"
    HAVE_SETRESGID = "0"
    HAVE_SETRESUID = "0"
    HAVE_SETREUID = "1"
    HAVE_SETSID = "1"
    HAVE_SETUID = "1"
    HAVE_SETVBUF = "1"
    HAVE_SHADOW_H = "0"
    HAVE_SHM_OPEN = "1"
    HAVE_SHM_UNLINK = "1"
    HAVE_SIGACTION = "1"
    HAVE_SIGALTSTACK = "1"
    HAVE_SIGFILLSET = "1"
    HAVE_SIGINFO_T_SI_BAND = "1"
    HAVE_SIGINTERRUPT = "1"
    HAVE_SIGNAL_H = "1"
    HAVE_SIGPENDING = "1"
    HAVE_SIGRELSE = "1"
    HAVE_SIGTIMEDWAIT = "0"
    HAVE_SIGWAIT = "1"
    HAVE_SIGWAITINFO = "0"
    HAVE_SNPRINTF = "1"
    HAVE_SOCKADDR_ALG = "0"
    HAVE_SOCKADDR_SA_LEN = "1"
    HAVE_SOCKADDR_STORAGE = "1"
    HAVE_SOCKETPAIR = "1"
    HAVE_SPAWN_H = "1"
    HAVE_SSIZE_T = "1"
    HAVE_STATVFS = "1"
    HAVE_STAT_TV_NSEC = "0"
    HAVE_STAT_TV_NSEC2 = "1"
    HAVE_STDARG_PROTOTYPES = "1"
    HAVE_STDINT_H = "1"
    HAVE_STDLIB_H = "1"
    HAVE_STD_ATOMIC = "1"
    HAVE_STRDUP = "1"
    HAVE_STRFTIME = "1"
    HAVE_STRINGS_H = "1"
    HAVE_STRING_H = "1"
    HAVE_STRLCPY = "1"
    HAVE_STROPTS_H = "0"
    HAVE_STRSIGNAL = "1"
    HAVE_STRUCT_PASSWD_PW_GECOS = "1"
    HAVE_STRUCT_PASSWD_PW_PASSWD = "1"
    HAVE_STRUCT_STAT_ST_BIRTHTIME = "1"
    HAVE_STRUCT_STAT_ST_BLKSIZE = "1"
    HAVE_STRUCT_STAT_ST_BLOCKS = "1"
    HAVE_STRUCT_STAT_ST_FLAGS = "1"
    HAVE_STRUCT_STAT_ST_GEN = "1"
    HAVE_STRUCT_STAT_ST_RDEV = "1"
    HAVE_STRUCT_TM_TM_ZONE = "1"
    HAVE_SYMLINK = "1"
    HAVE_SYMLINKAT = "1"
    HAVE_SYNC = "1"
    HAVE_SYSCONF = "1"
    HAVE_SYSEXITS_H = "1"
    HAVE_SYS_AUDIOIO_H = "0"
    HAVE_SYS_BSDTTY_H = "0"
    HAVE_SYS_DEVPOLL_H = "0"
    HAVE_SYS_DIR_H = "0"
    HAVE_SYS_ENDIAN_H = "0"
    HAVE_SYS_EPOLL_H = "0"
    HAVE_SYS_EVENT_H = "1"
    HAVE_SYS_FILE_H = "1"
    HAVE_SYS_IOCTL_H = "1"
    HAVE_SYS_KERN_CONTROL_H = "1"
    HAVE_SYS_LOADAVG_H = "0"
    HAVE_SYS_LOCK_H = "1"
    HAVE_SYS_MEMFD_H = "0"
    HAVE_SYS_MKDEV_H = "0"
    HAVE_SYS_MMAN_H = "1"
    HAVE_SYS_MODEM_H = "0"
    HAVE_SYS_NDIR_H = "0"
    HAVE_SYS_PARAM_H = "1"
    HAVE_SYS_POLL_H = "1"
    HAVE_SYS_RANDOM_H = "1"
    HAVE_SYS_RESOURCE_H = "1"
    HAVE_SYS_SELECT_H = "1"
    HAVE_SYS_SENDFILE_H = "0"
    HAVE_SYS_SOCKET_H = "1"
    HAVE_SYS_STATVFS_H = "1"
    HAVE_SYS_STAT_H = "1"
    HAVE_SYS_SYSCALL_H = "1"
    HAVE_SYS_SYSMACROS_H = "0"
    HAVE_SYS_SYS_DOMAIN_H = "1"
    HAVE_SYS_TERMIO_H = "0"
    HAVE_SYS_TIMES_H = "1"
    HAVE_SYS_TIME_H = "1"
    HAVE_SYS_TYPES_H = "1"
    HAVE_SYS_UIO_H = "1"
    HAVE_SYS_UN_H = "1"
    HAVE_SYS_UTSNAME_H = "1"
    HAVE_SYS_WAIT_H = "1"
    HAVE_SYS_XATTR_H = "1"
    HAVE_TCGETPGRP = "1"
    HAVE_TCSETPGRP = "1"
    HAVE_TEMPNAM = "1"
    HAVE_TERMIOS_H = "1"
    HAVE_TERM_H = "1"
    HAVE_TGAMMA = "1"
    HAVE_TIMEGM = "1"
    HAVE_TIMES = "1"
    HAVE_TMPFILE = "1"
    HAVE_TMPNAM = "1"
    HAVE_TMPNAM_R = "0"
    HAVE_TM_ZONE = "1"
    HAVE_TRUNCATE = "1"
    HAVE_TZNAME = "0"
    HAVE_UCS4_TCL = "0"
    HAVE_UNAME = "1"
    HAVE_UNISTD_H = "1"
    HAVE_UNLINKAT = "1"
    HAVE_USABLE_WCHAR_T = "0"
    HAVE_UTIL_H = "1"
    HAVE_UTIMENSAT = "1"
    HAVE_UTIMES = "1"
    HAVE_UTIME_H = "1"
    HAVE_UUID_CREATE = "0"
    HAVE_UUID_ENC_BE = "0"
    HAVE_UUID_GENERATE_TIME_SAFE = "0"
    HAVE_UUID_H = "0"
    HAVE_UUID_UUID_H = "1"
    HAVE_WAIT3 = "1"
    HAVE_WAIT4 = "1"
    HAVE_WAITID = "1"
    HAVE_WAITPID = "1"
    HAVE_WCHAR_H = "1"
    HAVE_WCSCOLL = "1"
    HAVE_WCSFTIME = "1"
    HAVE_WCSXFRM = "1"
    HAVE_WMEMCMP = "1"
    HAVE_WORKING_TZSET = "1"
    HAVE_WRITEV = "1"
    HAVE_X509_VERIFY_PARAM_SET1_HOST = "1"
    HAVE_ZLIB_COPY = "1"
    HAVE__GETPTY = "0"
    HOST_GNU_TYPE = "arm-apple-darwin20.5.0"
    INCLDIRSTOMAKE = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include /Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include /Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include/python3.9 /Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include/python3.9"
    INCLUDEDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include"
    INCLUDEPY = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/include/python3.9"
    INSTALL = "/opt/homebrew/bin/ginstall -c"
    INSTALL_DATA = "/opt/homebrew/bin/ginstall -c -m 644"
    INSTALL_PROGRAM = "/opt/homebrew/bin/ginstall -c"
    INSTALL_SCRIPT = "/opt/homebrew/bin/ginstall -c"
    INSTALL_SHARED = "/opt/homebrew/bin/ginstall -c -m 755"
    INSTSONAME = "Python.framework/Versions/3.9/Python"
    IO_H = "Modules/_io/_iomodule.h"
    IO_OBJS = "\"
    LDCXXSHARED = "clang++ -bundle -undefined dynamic_lookup"
    LDFLAGS = "-L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    LDLIBRARY = "Python.framework/Versions/3.9/Python"
    LDLIBRARYDIR = ""
    LDSHARED = "clang -bundle -undefined dynamic_lookup -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    LDVERSION = "3.9"
    LIBC = ""
    LIBDEST = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9"
    LIBDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/lib"
    LIBFFI_INCLUDEDIR = ""
    LIBM = ""
    LIBOBJDIR = "Python/"
    LIBOBJS = ""
    LIBPC = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/pkgconfig"
    LIBPL = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin"
    LIBPYTHON = ""
    LIBRARY = "libpython3.9.a"
    LIBRARY_OBJS = "\"
    LIBRARY_OBJS_OMIT_FROZEN = "\"
    LIBS = "-ldl   -framework CoreFoundation"
    LIBSUBDIRS = "tkinter tkinter/test tkinter/test/test_tkinter \"
    LINKCC = "clang"
    LINKFORSHARED = "-Wl,-stack_size,1000000  -framework CoreFoundation Python.framework/Versions/3.9/Python"
    LIPO_32BIT_FLAGS = ""
    LIPO_INTEL64_FLAGS = ""
    LLVM_PROF_ERR = "no"
    LLVM_PROF_FILE = "LLVM_PROFILE_FILE="code-%p.profclangr""
    LLVM_PROF_MERGER = "/usr/bin/xcrun llvm-profdata merge -output=code.profclangd *.profclangr"
    LN = "ln"
    LOCALMODLIBS = ""
    MACHDEP = "darwin"
    MACHDEP_OBJS = ""
    MACHDESTLIB = "/Users/n8henrie/.pyenv/versions/3.9.6/lib/python3.9"
    MACOSX_DEPLOYMENT_TARGET = "11.4"
    MAINCC = "clang"
    MAJOR_IN_MKDEV = "0"
    MAJOR_IN_SYSMACROS = "0"
    MAKESETUP = "./Modules/makesetup"
    MANDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/share/man"
    MKDIR_P = "/opt/homebrew/bin/gmkdir -p"
    MODBUILT_NAMES = "posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _peg_parser  _symtable  xxsubtype"
    MODDISABLED_NAMES = ""
    MODLIBS = ""
    MODOBJS = "Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o  Modules/_peg_parser.o  Modules/symtablemodule.o  Modules/xxsubtype.o"
    MODULE_OBJS = "\"
    MULTIARCH = "darwin"
    MULTIARCH_CPPFLAGS = "-DMULTIARCH=\"darwin\""
    MVWDELCH_IS_EXPRESSION = "1"
    NO_AS_NEEDED = ""
    OBJECT_OBJS = "\"
    OPENSSL_INCLUDES = "-I/opt/homebrew/opt/openssl@1.1/include"
    OPENSSL_LDFLAGS = "-L/opt/homebrew/opt/openssl@1.1/lib"
    OPENSSL_LIBS = "-lssl -lcrypto"
    OPT = "-DNDEBUG -g -fwrapv -O3 -Wall"
    OTHER_LIBTOOL_OPT = ""
    PACKAGE_BUGREPORT = "0"
    PACKAGE_NAME = "0"
    PACKAGE_STRING = "0"
    PACKAGE_TARNAME = "0"
    PACKAGE_URL = "0"
    PACKAGE_VERSION = "0"
    PARSER_HEADERS = "\"
    PARSER_OBJS = "\ \ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o"
    PEGEN_HEADERS = "\"
    PEGEN_OBJS = "\"
    PGO_PROF_GEN_FLAG = "-fprofile-instr-generate"
    PGO_PROF_USE_FLAG = "-fprofile-instr-use=code.profclangd"
    PLATLIBDIR = "lib"
    POBJS = "\"
    POSIX_SEMAPHORES_NOT_ENABLED = "0"
    PROFILE_TASK = "-m test --pgo"
    PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT = "0"
    PTHREAD_SYSTEM_SCHED_SUPPORTED = "1"
    PURIFY = ""
    PY3LIBRARY = ""
    PYLONG_BITS_IN_DIGIT = "0"
    PYTHON = "python"
    PYTHONFRAMEWORK = "Python"
    PYTHONFRAMEWORKDIR = "Python.framework"
    PYTHONFRAMEWORKINSTALLDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework"
    PYTHONFRAMEWORKPREFIX = "/Users/n8henrie/.pyenv/versions/3.9.6"
    PYTHONPATH = ""
    PYTHON_FOR_BUILD = "./python.exe -E"
    PYTHON_HEADERS = "\"
    PYTHON_OBJS = "\"
    PY_BUILTIN_HASHLIB_HASHES = ""md5,sha1,sha256,sha512,sha3,blake2""
    PY_BUILTIN_MODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-use=code.profclangd -I./Include/internal -I. -I./Include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -DPy_BUILD_CORE_BUILTIN"
    PY_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
    PY_CFLAGS_NODIST = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-use=code.profclangd -I./Include/internal"
    PY_COERCE_C_LOCALE = "1"
    PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-use=code.profclangd -I./Include/internal -I. -I./Include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -DPy_BUILD_CORE"
    PY_CORE_LDFLAGS = "-L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    PY_CPPFLAGS = "-I. -I./Include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include"
    PY_FORMAT_SIZE_T = ""z""
    PY_LDFLAGS = "-L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/n8henrie/.pyenv/versions/3.9.6/lib -L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libffi/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"
    PY_LDFLAGS_NODIST = ""
    PY_SSL_DEFAULT_CIPHERS = "1"
    PY_SSL_DEFAULT_CIPHER_STRING = "0"
    PY_STDMODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-instr-use=code.profclangd -I./Include/internal -I. -I./Include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/n8henrie/.pyenv/versions/3.9.6/include -I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libffi/include"
    Py_DEBUG = "0"
    Py_ENABLE_SHARED = "0"
    Py_HASH_ALGORITHM = "0"
    Py_TRACE_REFS = "0"
    QUICKTESTOPTS = "-x test_subprocess test_io test_lib2to3 \"
    READELF = ":"
    RESSRCDIR = "Mac/Resources/framework"
    RETSIGTYPE = "void"
    RUNSHARED = "DYLD_FRAMEWORK_PATH=/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6"
    SCRIPTDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib"
    SETPGRP_HAVE_ARG = "0"
    SGI_ABI = "@SGI_ABI@"
    SHELL = "/bin/sh"
    SHLIBS = "-ldl   -framework CoreFoundation"
    SHLIB_SUFFIX = ".so"
    SHM_NEEDS_LIBRT = "0"
    SIGNED_RIGHT_SHIFT_ZERO_FILLS = "0"
    SITEPATH = ""
    SIZEOF_DOUBLE = "8"
    SIZEOF_FLOAT = "4"
    SIZEOF_FPOS_T = "8"
    SIZEOF_INT = "4"
    SIZEOF_LONG = "8"
    SIZEOF_LONG_DOUBLE = "8"
    SIZEOF_LONG_LONG = "8"
    SIZEOF_OFF_T = "8"
    SIZEOF_PID_T = "4"
    SIZEOF_PTHREAD_KEY_T = "8"
    SIZEOF_PTHREAD_T = "8"
    SIZEOF_SHORT = "2"
    SIZEOF_SIZE_T = "8"
    SIZEOF_TIME_T = "8"
    SIZEOF_UINTPTR_T = "8"
    SIZEOF_VOID_P = "8"
    SIZEOF_WCHAR_T = "4"
    SIZEOF__BOOL = "1"
    SO = ".cpython-39-darwin.so"
    SOABI = "cpython-39-darwin"
    SRCDIRS = "Parser Parser/pegen Objects Python Modules Modules/_io Programs"
    SRC_GDB_HOOKS = "./Tools/gdb/libpython.py"
    STDC_HEADERS = "1"
    STRICT_SYSV_CURSES = "/* Don't use ncurses extensions */"
    STRIPFLAG = "-s"
    SUBDIRS = ""
    SUBDIRSTOO = "Include Lib Misc"
    SYSLIBS = ""
    SYS_SELECT_WITH_SYS_TIME = "1"
    TCLTK_INCLUDES = ""
    TCLTK_LIBS = ""
    TESTOPTS = ""
    TESTPATH = ""
    TESTPYTHON = "DYLD_FRAMEWORK_PATH=/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6 ./python.exe"
    TESTPYTHONOPTS = ""
    TESTRUNNER = "DYLD_FRAMEWORK_PATH=/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6 ./python.exe ./Tools/scripts/run_tests.py"
    TESTTIMEOUT = "1200"
    TIMEMODULE_LIB = "0"
    TIME_WITH_SYS_TIME = "1"
    TM_IN_SYS_TIME = "0"
    TZPATH = "/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo"
    UNICODE_DEPS = "\"
    UNIVERSALSDK = ""
    UPDATE_FILE = "python3.9 ./Tools/scripts/update_file.py"
    USE_COMPUTED_GOTOS = "0"
    VERSION = "3.9"
    WINDOW_HAS_FLAGS = "1"
    WITH_DECIMAL_CONTEXTVAR = "1"
    WITH_DOC_STRINGS = "1"
    WITH_DTRACE = "0"
    WITH_DYLD = "1"
    WITH_LIBINTL = "0"
    WITH_NEXT_FRAMEWORK = "1"
    WITH_PYMALLOC = "1"
    WITH_VALGRIND = "0"
    X87_DOUBLE_ROUNDING = "0"
    XMLLIBSUBDIRS = "xml xml/dom xml/etree xml/parsers xml/sax"
    abiflags = ""
    abs_builddir = "/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6"
    abs_srcdir = "/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/python-build.20210704044506.1056/Python-3.9.6"
    base = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9"
    datarootdir = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/share"
    exec_prefix = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9"
    installed_base = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9"
    installed_platbase = "/Users/n8henrie/.pyenv/versions/3.9.6"
    platbase = "/Users/n8henrie/.pyenv/versions/3.9.6"
    platlibdir = "lib"
    prefix = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9"
    projectbase = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/bin"
    py_version = "3.9.6"
    py_version_nodot = "39"
    py_version_short = "3.9"
    srcdir = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/python3.9/config-3.9-darwin"
    userbase = "/Users/n8henrie/Library/Python/3.9"
davidhewitt commented 3 years ago
    PYTHONFRAMEWORKINSTALLDIR = "/Users/n8henrie/.pyenv/versions/3.9.6/Python.framework"

This one's interesting. Can you show me where libpython is located inside that directory?

Also, it looks like dumping sysconfig for your system Python might also reveal where the Python framework is configured for that python too?

n8henrie commented 3 years ago

Thanks for your time with this!

Can you show me where libpython is located inside that directory?

I think this shows it: https://github.com/PyO3/pyo3/issues/1800#issuecomment-900483765

Also, it looks like dumping sysconfig for your system Python might also reveal where the Python framework is configured for that python too?

EDIT: Looks like it might be: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8

$ /usr/bin/python3 -m sysconfig
Platform: "macosx-10.14.6-arm64"
Python version: "3.8"
Current installation scheme: "osx_framework_library"

Paths: 
    data = "/Library/Python/3.8"
    include = "/Library/Python/3.8/include"
    platinclude = "/Library/Python/3.8/include"
    platlib = "/Library/Python/3.8/site-packages"
    platstdlib = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"
    purelib = "/Library/Python/3.8/site-packages"
    scripts = "/usr/local/bin"
    stdlib = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"

Variables: 
    ABIFLAGS = ""
    AC_APPLE_UNIVERSAL_BUILD = "0"
    AIX_GENUINE_CPLUSPLUS = "0"
    ALT_SOABI = "0"
    ANDROID_API_LEVEL = "0"
    AR = "ar"
    ARFLAGS = "rcs"
    BASECFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic"
    BASECPPFLAGS = "-IObjects -IInclude -IPython"
    BASEMODLIBS = ""
    BINDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin"
    BINLIBDEST = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"
    BLDLIBRARY = ""
    BLDSHARED = "clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -Wl,-headerpad,0x1000"
    BRIDGEOS_DEPLOYMENT_TARGET = ""
    BUILDEXE = ".exe"
    BUILDPYTHON = "python.exe"
    BUILD_GNU_TYPE = "x86_64-apple-darwin"
    BYTESTR_DEPS = "\"
    CC = "clang"
    CCSHARED = ""
    CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration"
    CFLAGSFORSHARED = "-fvisibility=hidden -DPy_BUILD_SHARED"
    CFLAGS_ALIASING = "-fno-strict-aliasing"
    CFLAGS_NODIST = ""
    CONFIGFILES = "configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
    CONFIGURE_CFLAGS = "-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration"
    CONFIGURE_CFLAGS_NODIST = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration"
    CONFIGURE_CPPFLAGS = "-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64"
    CONFIGURE_LDFLAGS = "-Wl,-headerpad,0x1000"
    CONFIGURE_LDFLAGS_NODIST = ""
    CONFIG_ARGS = "'-C' '--host=x86_64-apple-darwin' '--build=x86_64-apple-darwin' '--enable-framework=/Applications/Xcode.app/Contents/Developer/Library/Frameworks' '--with-framework-name=Python3' '--with-openssl=/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/local/libressl-2.8' '--with-openssl-ldflags=-L/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/local/libressl-2.8/lib -F/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/System/Library/PrivateFrameworks' '--with-openssl-libs=-framework TrustEvaluationAgent' '--with-bundleid-prefix=com.apple' '--enable-ipv6' '--prefix=/Applications/Xcode.app/Contents/Developer/usr' '--with-pymalloc' '--with-cxx-main=xcrun -sdk macosx clang -arch arm64 -arch x86_64' 'PYTHON_FOR_BUILD=PYTHONPATH=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Lib DYLD_FRAMEWORK_PATH=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host/python.exe' 'TRAIN_STYLE=DT' 'CC=xcrun -sdk macosx clang' 'CXX=xcrun -sdk macosx clang++' 'CPP=xcrun -sdk macosx clang -E' 'CFLAGS=-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration' 'CPPFLAGS=-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64' 'LIBS=-lSystem' 'LDSHARED=xcrun -sdk macosx clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64' 'LDFRAMEWORK=xcrun -sdk macosx clang -dynamiclib -arch arm64 -arch x86_64' 'LDFLAGS=-Wl,-headerpad,0x1000' 'OBJROOT=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects' 'SDKROOT=/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk' 'build_alias=x86_64-apple-darwin' 'host_alias=x86_64-apple-darwin'"
    CONFINCLUDEDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include"
    CONFINCLUDEPY = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers"
    COREPYTHONPATH = ""
    COVERAGE_INFO = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host/coverage.info"
    COVERAGE_REPORT = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host/lcov-report"
    COVERAGE_REPORT_OPTIONS = "--no-branch-coverage --title "CPython lcov report""
    CPPFLAGS = "-IObjects -IInclude -IPython -I. -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64"
    CURDIR = ""
    CXX = "clang++"
    DESTDIRS = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8 /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8 /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/lib-dynload"
    DESTLIB = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"
    DESTPATH = ""
    DESTSHARED = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/lib-dynload"
    DFLAGS = ""
    DIRMODE = "755"
    DIST = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummy"
    DISTDIRS = "Include Lib Misc Ext-dummy"
    DISTFILES = "README.rst ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in"
    DLINCLDIR = "."
    DLLLIBRARY = ""
    DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 = "0"
    DOUBLE_IS_BIG_ENDIAN_IEEE754 = "0"
    DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = "1"
    DTRACE = ""
    DTRACE_DEPS = "\"
    DTRACE_HEADERS = ""
    DTRACE_OBJS = ""
    DYNLOADFILE = "dynload_shlib.o"
    ENABLE_IPV6 = "1"
    ENSUREPIP = "upgrade"
    EXE = ""
    EXEMODE = "755"
    EXTRATESTOPTS = ""
    EXTRA_CFLAGS = ""
    EXT_SUFFIX = ".cpython-38-darwin.so"
    FILEMODE = "644"
    FLOAT_WORDS_BIGENDIAN = "0"
    FLOCK_NEEDS_LIBBSD = "0"
    GETPGRP_HAVE_ARG = "0"
    GETTIMEOFDAY_NO_TZ = "0"
    GITBRANCH = ""
    GITTAG = ""
    GITVERSION = ""
    GNULD = "no"
    HAVE_ACCEPT4 = "0"
    HAVE_ACOSH = "1"
    HAVE_ADDRINFO = "1"
    HAVE_ALARM = "1"
    HAVE_ALIGNED_REQUIRED = "0"
    HAVE_ALLOCA_H = "1"
    HAVE_ALTZONE = "0"
    HAVE_ASINH = "1"
    HAVE_ASM_TYPES_H = "0"
    HAVE_ATANH = "1"
    HAVE_BIND_TEXTDOMAIN_CODESET = "0"
    HAVE_BLUETOOTH_BLUETOOTH_H = "0"
    HAVE_BLUETOOTH_H = "0"
    HAVE_BROKEN_MBSTOWCS = "0"
    HAVE_BROKEN_NICE = "0"
    HAVE_BROKEN_PIPE_BUF = "0"
    HAVE_BROKEN_POLL = "0"
    HAVE_BROKEN_POSIX_SEMAPHORES = "0"
    HAVE_BROKEN_PTHREAD_SIGMASK = "0"
    HAVE_BROKEN_SEM_GETVALUE = "1"
    HAVE_BROKEN_UNSETENV = "0"
    HAVE_BUILTIN_ATOMIC = "1"
    HAVE_CHFLAGS = "1"
    HAVE_CHOWN = "1"
    HAVE_CHROOT = "1"
    HAVE_CLOCK = "1"
    HAVE_CLOCK_GETRES = "1"
    HAVE_CLOCK_GETTIME = "1"
    HAVE_CLOCK_SETTIME = "1"
    HAVE_COMPUTED_GOTOS = "1"
    HAVE_CONFSTR = "1"
    HAVE_CONIO_H = "0"
    HAVE_COPYSIGN = "1"
    HAVE_COPY_FILE_RANGE = "0"
    HAVE_CRYPT_H = "0"
    HAVE_CRYPT_R = "0"
    HAVE_CTERMID = "1"
    HAVE_CTERMID_R = "1"
    HAVE_CURSES_FILTER = "1"
    HAVE_CURSES_H = "1"
    HAVE_CURSES_HAS_KEY = "1"
    HAVE_CURSES_IMMEDOK = "1"
    HAVE_CURSES_IS_PAD = "0"
    HAVE_CURSES_IS_TERM_RESIZED = "1"
    HAVE_CURSES_RESIZETERM = "1"
    HAVE_CURSES_RESIZE_TERM = "1"
    HAVE_CURSES_SYNCOK = "1"
    HAVE_CURSES_TYPEAHEAD = "1"
    HAVE_CURSES_USE_ENV = "1"
    HAVE_CURSES_WCHGAT = "1"
    HAVE_DECL_ISFINITE = "1"
    HAVE_DECL_ISINF = "1"
    HAVE_DECL_ISNAN = "1"
    HAVE_DECL_RTLD_DEEPBIND = "0"
    HAVE_DECL_RTLD_GLOBAL = "1"
    HAVE_DECL_RTLD_LAZY = "1"
    HAVE_DECL_RTLD_LOCAL = "1"
    HAVE_DECL_RTLD_MEMBER = "0"
    HAVE_DECL_RTLD_NODELETE = "1"
    HAVE_DECL_RTLD_NOLOAD = "1"
    HAVE_DECL_RTLD_NOW = "1"
    HAVE_DECL_TZNAME = "0"
    HAVE_DEVICE_MACROS = "1"
    HAVE_DEV_PTC = "0"
    HAVE_DEV_PTMX = "1"
    HAVE_DIRECT_H = "0"
    HAVE_DIRENT_D_TYPE = "1"
    HAVE_DIRENT_H = "1"
    HAVE_DIRFD = "1"
    HAVE_DLFCN_H = "1"
    HAVE_DLOPEN = "1"
    HAVE_DUP2 = "1"
    HAVE_DUP3 = "0"
    HAVE_DYNAMIC_LOADING = "1"
    HAVE_ENDIAN_H = "0"
    HAVE_EPOLL = "0"
    HAVE_EPOLL_CREATE1 = "0"
    HAVE_ERF = "1"
    HAVE_ERFC = "1"
    HAVE_ERRNO_H = "1"
    HAVE_EXECV = "1"
    HAVE_EXPLICIT_BZERO = "0"
    HAVE_EXPLICIT_MEMSET = "0"
    HAVE_EXPM1 = "1"
    HAVE_FACCESSAT = "1"
    HAVE_FCHDIR = "1"
    HAVE_FCHMOD = "1"
    HAVE_FCHMODAT = "1"
    HAVE_FCHOWN = "1"
    HAVE_FCHOWNAT = "1"
    HAVE_FCNTL_H = "1"
    HAVE_FDATASYNC = "0"
    HAVE_FDOPENDIR = "1"
    HAVE_FDWALK = "0"
    HAVE_FEXECVE = "0"
    HAVE_FINITE = "0"
    HAVE_FLOCK = "1"
    HAVE_FORK = "1"
    HAVE_FORKPTY = "1"
    HAVE_FPATHCONF = "1"
    HAVE_FSEEK64 = "0"
    HAVE_FSEEKO = "1"
    HAVE_FSTATAT = "1"
    HAVE_FSTATVFS = "1"
    HAVE_FSYNC = "1"
    HAVE_FTELL64 = "0"
    HAVE_FTELLO = "1"
    HAVE_FTIME = "1"
    HAVE_FTRUNCATE = "1"
    HAVE_FUTIMENS = "1"
    HAVE_FUTIMES = "1"
    HAVE_FUTIMESAT = "0"
    HAVE_GAI_STRERROR = "1"
    HAVE_GAMMA = "0"
    HAVE_GCC_ASM_FOR_MC68881 = "0"
    HAVE_GCC_ASM_FOR_X64 = "0"
    HAVE_GCC_ASM_FOR_X87 = "0"
    HAVE_GCC_UINT128_T = "1"
    HAVE_GETADDRINFO = "1"
    HAVE_GETC_UNLOCKED = "1"
    HAVE_GETENTROPY = "0"
    HAVE_GETGRGID_R = "1"
    HAVE_GETGRNAM_R = "1"
    HAVE_GETGROUPLIST = "1"
    HAVE_GETGROUPS = "1"
    HAVE_GETHOSTBYNAME = "1"
    HAVE_GETHOSTBYNAME_R = "0"
    HAVE_GETHOSTBYNAME_R_3_ARG = "0"
    HAVE_GETHOSTBYNAME_R_5_ARG = "0"
    HAVE_GETHOSTBYNAME_R_6_ARG = "0"
    HAVE_GETITIMER = "1"
    HAVE_GETLOADAVG = "1"
    HAVE_GETLOGIN = "1"
    HAVE_GETNAMEINFO = "1"
    HAVE_GETPAGESIZE = "1"
    HAVE_GETPEERNAME = "1"
    HAVE_GETPGID = "1"
    HAVE_GETPGRP = "1"
    HAVE_GETPID = "1"
    HAVE_GETPRIORITY = "1"
    HAVE_GETPWENT = "1"
    HAVE_GETPWNAM_R = "1"
    HAVE_GETPWUID_R = "1"
    HAVE_GETRANDOM = "0"
    HAVE_GETRANDOM_SYSCALL = "0"
    HAVE_GETRESGID = "0"
    HAVE_GETRESUID = "0"
    HAVE_GETSID = "1"
    HAVE_GETSPENT = "0"
    HAVE_GETSPNAM = "0"
    HAVE_GETTIMEOFDAY = "1"
    HAVE_GETWD = "1"
    HAVE_GLIBC_MEMMOVE_BUG = "1"
    HAVE_GRP_H = "1"
    HAVE_HSTRERROR = "1"
    HAVE_HTOLE64 = "0"
    HAVE_HYPOT = "1"
    HAVE_IEEEFP_H = "0"
    HAVE_IF_NAMEINDEX = "1"
    HAVE_INET_ATON = "1"
    HAVE_INET_PTON = "1"
    HAVE_INITGROUPS = "1"
    HAVE_INTTYPES_H = "1"
    HAVE_IO_H = "0"
    HAVE_IPA_PURE_CONST_BUG = "0"
    HAVE_KILL = "1"
    HAVE_KILLPG = "1"
    HAVE_KQUEUE = "1"
    HAVE_LANGINFO_H = "1"
    HAVE_LARGEFILE_SUPPORT = "0"
    HAVE_LCHFLAGS = "1"
    HAVE_LCHMOD = "1"
    HAVE_LCHOWN = "1"
    HAVE_LGAMMA = "1"
    HAVE_LIBDL = "1"
    HAVE_LIBDLD = "0"
    HAVE_LIBIEEE = "0"
    HAVE_LIBINTL_H = "0"
    HAVE_LIBREADLINE = "1"
    HAVE_LIBRESOLV = "0"
    HAVE_LIBSENDFILE = "0"
    HAVE_LIBUTIL_H = "1"
    HAVE_LINK = "1"
    HAVE_LINKAT = "1"
    HAVE_LINUX_CAN_BCM_H = "0"
    HAVE_LINUX_CAN_H = "0"
    HAVE_LINUX_CAN_RAW_FD_FRAMES = "0"
    HAVE_LINUX_CAN_RAW_H = "0"
    HAVE_LINUX_MEMFD_H = "0"
    HAVE_LINUX_NETLINK_H = "0"
    HAVE_LINUX_QRTR_H = "0"
    HAVE_LINUX_RANDOM_H = "0"
    HAVE_LINUX_TIPC_H = "0"
    HAVE_LINUX_VM_SOCKETS_H = "0"
    HAVE_LOCKF = "1"
    HAVE_LOG1P = "1"
    HAVE_LOG2 = "1"
    HAVE_LONG_DOUBLE = "1"
    HAVE_LSTAT = "1"
    HAVE_LUTIMES = "1"
    HAVE_MADVISE = "1"
    HAVE_MAKEDEV = "1"
    HAVE_MBRTOWC = "1"
    HAVE_MEMFD_CREATE = "0"
    HAVE_MEMORY_H = "1"
    HAVE_MEMRCHR = "0"
    HAVE_MKDIRAT = "1"
    HAVE_MKFIFO = "1"
    HAVE_MKFIFOAT = "0"
    HAVE_MKNOD = "1"
    HAVE_MKNODAT = "0"
    HAVE_MKTIME = "1"
    HAVE_MMAP = "1"
    HAVE_MREMAP = "0"
    HAVE_NCURSES_H = "1"
    HAVE_NDIR_H = "0"
    HAVE_NETPACKET_PACKET_H = "0"
    HAVE_NET_IF_H = "1"
    HAVE_NICE = "1"
    HAVE_OPENAT = "1"
    HAVE_OPENPTY = "1"
    HAVE_PATHCONF = "1"
    HAVE_PAUSE = "1"
    HAVE_PIPE2 = "0"
    HAVE_PLOCK = "0"
    HAVE_POLL = "1"
    HAVE_POLL_H = "1"
    HAVE_POSIX_FADVISE = "0"
    HAVE_POSIX_FALLOCATE = "0"
    HAVE_POSIX_SPAWN = "1"
    HAVE_POSIX_SPAWNP = "1"
    HAVE_PREAD = "1"
    HAVE_PREADV = "1"
    HAVE_PREADV2 = "0"
    HAVE_PRLIMIT = "0"
    HAVE_PROCESS_H = "0"
    HAVE_PROTOTYPES = "1"
    HAVE_PTHREAD_CONDATTR_SETCLOCK = "0"
    HAVE_PTHREAD_DESTRUCTOR = "0"
    HAVE_PTHREAD_GETCPUCLOCKID = "0"
    HAVE_PTHREAD_H = "1"
    HAVE_PTHREAD_INIT = "0"
    HAVE_PTHREAD_KILL = "1"
    HAVE_PTHREAD_SIGMASK = "1"
    HAVE_PTY_H = "0"
    HAVE_PUTENV = "1"
    HAVE_PWRITE = "1"
    HAVE_PWRITEV = "1"
    HAVE_PWRITEV2 = "0"
    HAVE_READLINK = "1"
    HAVE_READLINKAT = "1"
    HAVE_READV = "1"
    HAVE_REALPATH = "1"
    HAVE_RENAMEAT = "1"
    HAVE_RL_APPEND_HISTORY = "0"
    HAVE_RL_CATCH_SIGNAL = "0"
    HAVE_RL_COMPLETION_APPEND_CHARACTER = "1"
    HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = "1"
    HAVE_RL_COMPLETION_MATCHES = "1"
    HAVE_RL_COMPLETION_SUPPRESS_APPEND = "0"
    HAVE_RL_PRE_INPUT_HOOK = "1"
    HAVE_RL_RESIZE_TERMINAL = "0"
    HAVE_ROUND = "1"
    HAVE_RTPSPAWN = "0"
    HAVE_SCHED_GET_PRIORITY_MAX = "1"
    HAVE_SCHED_H = "1"
    HAVE_SCHED_RR_GET_INTERVAL = "0"
    HAVE_SCHED_SETAFFINITY = "0"
    HAVE_SCHED_SETPARAM = "0"
    HAVE_SCHED_SETSCHEDULER = "0"
    HAVE_SEM_GETVALUE = "1"
    HAVE_SEM_OPEN = "1"
    HAVE_SEM_TIMEDWAIT = "0"
    HAVE_SEM_UNLINK = "1"
    HAVE_SENDFILE = "1"
    HAVE_SETEGID = "1"
    HAVE_SETEUID = "1"
    HAVE_SETGID = "1"
    HAVE_SETGROUPS = "1"
    HAVE_SETHOSTNAME = "1"
    HAVE_SETITIMER = "1"
    HAVE_SETLOCALE = "1"
    HAVE_SETPGID = "1"
    HAVE_SETPGRP = "1"
    HAVE_SETPRIORITY = "1"
    HAVE_SETREGID = "1"
    HAVE_SETRESGID = "0"
    HAVE_SETRESUID = "0"
    HAVE_SETREUID = "1"
    HAVE_SETSID = "1"
    HAVE_SETUID = "1"
    HAVE_SETVBUF = "1"
    HAVE_SF_HDTR = "1"
    HAVE_SHADOW_H = "0"
    HAVE_SHM_OPEN = "1"
    HAVE_SHM_UNLINK = "1"
    HAVE_SIGACTION = "1"
    HAVE_SIGALTSTACK = "1"
    HAVE_SIGFILLSET = "1"
    HAVE_SIGINFO_T_SI_BAND = "1"
    HAVE_SIGINTERRUPT = "1"
    HAVE_SIGNAL_H = "1"
    HAVE_SIGPENDING = "1"
    HAVE_SIGRELSE = "1"
    HAVE_SIGTIMEDWAIT = "0"
    HAVE_SIGWAIT = "1"
    HAVE_SIGWAITINFO = "0"
    HAVE_SNPRINTF = "1"
    HAVE_SOCKADDR_ALG = "0"
    HAVE_SOCKADDR_SA_LEN = "1"
    HAVE_SOCKADDR_STORAGE = "1"
    HAVE_SOCKETPAIR = "1"
    HAVE_SPAWN_H = "1"
    HAVE_SSIZE_T = "1"
    HAVE_STATVFS = "1"
    HAVE_STAT_TV_NSEC = "0"
    HAVE_STAT_TV_NSEC2 = "1"
    HAVE_STDARG_PROTOTYPES = "1"
    HAVE_STDINT_H = "1"
    HAVE_STDLIB_H = "1"
    HAVE_STD_ATOMIC = "1"
    HAVE_STRDUP = "1"
    HAVE_STRFTIME = "1"
    HAVE_STRINGS_H = "1"
    HAVE_STRING_H = "1"
    HAVE_STRLCPY = "1"
    HAVE_STROPTS_H = "0"
    HAVE_STRSIGNAL = "1"
    HAVE_STRUCT_PASSWD_PW_GECOS = "1"
    HAVE_STRUCT_PASSWD_PW_PASSWD = "1"
    HAVE_STRUCT_STAT_ST_BIRTHTIME = "1"
    HAVE_STRUCT_STAT_ST_BLKSIZE = "1"
    HAVE_STRUCT_STAT_ST_BLOCKS = "1"
    HAVE_STRUCT_STAT_ST_FLAGS = "1"
    HAVE_STRUCT_STAT_ST_GEN = "1"
    HAVE_STRUCT_STAT_ST_RDEV = "1"
    HAVE_STRUCT_TM_TM_ZONE = "1"
    HAVE_SYMLINK = "1"
    HAVE_SYMLINKAT = "1"
    HAVE_SYNC = "1"
    HAVE_SYSCONF = "1"
    HAVE_SYSEXITS_H = "1"
    HAVE_SYS_AUDIOIO_H = "0"
    HAVE_SYS_BSDTTY_H = "0"
    HAVE_SYS_DEVPOLL_H = "0"
    HAVE_SYS_DIR_H = "0"
    HAVE_SYS_ENDIAN_H = "0"
    HAVE_SYS_EPOLL_H = "0"
    HAVE_SYS_EVENT_H = "1"
    HAVE_SYS_FILE_H = "1"
    HAVE_SYS_IOCTL_H = "1"
    HAVE_SYS_KERN_CONTROL_H = "1"
    HAVE_SYS_LOADAVG_H = "0"
    HAVE_SYS_LOCK_H = "1"
    HAVE_SYS_MEMFD_H = "0"
    HAVE_SYS_MKDEV_H = "0"
    HAVE_SYS_MMAN_H = "1"
    HAVE_SYS_MODEM_H = "0"
    HAVE_SYS_NDIR_H = "0"
    HAVE_SYS_PARAM_H = "1"
    HAVE_SYS_POLL_H = "1"
    HAVE_SYS_RANDOM_H = "1"
    HAVE_SYS_RESOURCE_H = "1"
    HAVE_SYS_SELECT_H = "1"
    HAVE_SYS_SENDFILE_H = "0"
    HAVE_SYS_SOCKET_H = "1"
    HAVE_SYS_STATVFS_H = "1"
    HAVE_SYS_STAT_H = "1"
    HAVE_SYS_SYSCALL_H = "1"
    HAVE_SYS_SYSMACROS_H = "0"
    HAVE_SYS_SYS_DOMAIN_H = "1"
    HAVE_SYS_TERMIO_H = "0"
    HAVE_SYS_TIMES_H = "1"
    HAVE_SYS_TIME_H = "1"
    HAVE_SYS_TYPES_H = "1"
    HAVE_SYS_UIO_H = "1"
    HAVE_SYS_UN_H = "1"
    HAVE_SYS_UTSNAME_H = "1"
    HAVE_SYS_WAIT_H = "1"
    HAVE_SYS_XATTR_H = "1"
    HAVE_TCGETPGRP = "1"
    HAVE_TCSETPGRP = "1"
    HAVE_TEMPNAM = "1"
    HAVE_TERMIOS_H = "1"
    HAVE_TERM_H = "1"
    HAVE_TGAMMA = "1"
    HAVE_TIMEGM = "1"
    HAVE_TIMES = "1"
    HAVE_TMPFILE = "1"
    HAVE_TMPNAM = "1"
    HAVE_TMPNAM_R = "0"
    HAVE_TM_ZONE = "1"
    HAVE_TRUNCATE = "1"
    HAVE_TZNAME = "0"
    HAVE_UCS4_TCL = "0"
    HAVE_UNAME = "1"
    HAVE_UNISTD_H = "1"
    HAVE_UNLINKAT = "1"
    HAVE_UNSETENV = "1"
    HAVE_USABLE_WCHAR_T = "1"
    HAVE_UTIL_H = "1"
    HAVE_UTIMENSAT = "1"
    HAVE_UTIMES = "1"
    HAVE_UTIME_H = "1"
    HAVE_UUID_CREATE = "0"
    HAVE_UUID_ENC_BE = "0"
    HAVE_UUID_GENERATE_TIME_SAFE = "0"
    HAVE_UUID_H = "0"
    HAVE_UUID_UUID_H = "1"
    HAVE_WAIT3 = "1"
    HAVE_WAIT4 = "1"
    HAVE_WAITID = "1"
    HAVE_WAITPID = "1"
    HAVE_WCHAR_H = "1"
    HAVE_WCSCOLL = "1"
    HAVE_WCSFTIME = "1"
    HAVE_WCSXFRM = "1"
    HAVE_WMEMCMP = "1"
    HAVE_WORKING_TZSET = "1"
    HAVE_WRITEV = "1"
    HAVE_X509_VERIFY_PARAM_SET1_HOST = "1"
    HAVE_ZLIB_COPY = "1"
    HAVE__GETPTY = "0"
    HOST_GNU_TYPE = "x86_64-apple-darwin"
    INCLDIRSTOMAKE = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers/internal /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers"
    INCLUDEDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/include"
    INCLUDEPY = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers"
    INSTALL = "/usr/bin/install -c"
    INSTALL_DATA = "/usr/bin/install -c -m 644"
    INSTALL_PROGRAM = "/usr/bin/install -c"
    INSTALL_SCRIPT = "/usr/bin/install -c"
    INSTALL_SHARED = "/usr/bin/install -c -m 755"
    INSTSONAME = "Python3.framework/Versions/3.8/Python3"
    IO_H = "Modules/_io/_iomodule.h"
    IO_OBJS = "\"
    IPHONEOS_DEPLOYMENT_TARGET = ""
    LDCXXSHARED = "clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64"
    LDFLAGS = "-Wl,-headerpad,0x1000"
    LDFLAGS_NODIST = ""
    LDFRAMEWORK = "clang -dynamiclib -arch arm64 -arch x86_64"
    LDLIBRARY = "Python3.framework/Versions/3.8/Python3"
    LDLIBRARYDIR = ""
    LDSHARED = "clang -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -Wl,-headerpad,0x1000"
    LDVERSION = "3.8"
    LIBC = ""
    LIBDEST = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"
    LIBDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib"
    LIBFFI_INCLUDEDIR = ""
    LIBM = ""
    LIBOBJDIR = "Python/"
    LIBOBJS = ""
    LIBPC = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/pkgconfig"
    LIBPL = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin"
    LIBPYTHON = ""
    LIBRARY = "libpython3.8.a"
    LIBRARY_OBJS = "\"
    LIBRARY_OBJS_OMIT_FROZEN = "\"
    LIBS = "-ldl -lSystem  -framework CoreFoundation"
    LIBSUBDIRS = "tkinter tkinter/test tkinter/test/test_tkinter \"
    LIBTESTDEST = "/AppleInternal/Tests/Python/3.8/"
    LIBZIPDEST = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python$(subst .,,3.8).zip"
    LINKCC = "clang -arch arm64 -arch x86_64"
    LINKFORSHARED = "-Wl,-stack_size,1000000  -framework CoreFoundation Python3.framework/Versions/3.8/Python3"
    LIPO_32BIT_FLAGS = ""
    LLVM_PROF_ERR = "no"
    LLVM_PROF_FILE = "LLVM_PROFILE_FILE="code-%p.profclangr""
    LLVM_PROF_MERGER = "/usr/bin/xcrun llvm-profdata merge -output=code.profclangd *.profclangr"
    LN = "ln"
    LOCALMODLIBS = ""
    MACHDEP = "darwin"
    MACHDEP_OBJS = ""
    MACHDESTLIB = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8"
    MACOSX_DEPLOYMENT_TARGET = "10.14.6"
    MAINCC = "clang -arch arm64 -arch x86_64"
    MAJOR_IN_MKDEV = "0"
    MAJOR_IN_SYSMACROS = "0"
    MAKESETUP = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Modules/makesetup"
    MANDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/share/man"
    MKDIR_P = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/install-sh -c -d"
    MODBUILT_NAMES = "posix  errno  pwd  _sre  _codecs  _weakref  _functools  _operator  _collections  _abc  itertools  atexit  _signal  _stat  time  _thread  _locale  _io  faulthandler  _tracemalloc  _symtable  xxsubtype"
    MODDISABLED_NAMES = ""
    MODLIBS = ""
    MODOBJS = "Modules/posixmodule.o  Modules/errnomodule.o  Modules/pwdmodule.o  Modules/_sre.o  Modules/_codecsmodule.o  Modules/_weakref.o  Modules/_functoolsmodule.o  Modules/_operator.o  Modules/_collectionsmodule.o  Modules/_abc.o  Modules/itertoolsmodule.o  Modules/atexitmodule.o  Modules/signalmodule.o  Modules/_stat.o  Modules/timemodule.o  Modules/_threadmodule.o  Modules/_localemodule.o  Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.o"
    MODULE_OBJS = "\"
    MULTIARCH = "darwin"
    MULTIARCH_CPPFLAGS = "-DMULTIARCH=\"darwin\""
    MVWDELCH_IS_EXPRESSION = "1"
    NO_AS_NEEDED = ""
    OBJECT_OBJS = "\"
    OPENSSL_INCLUDES = "-I/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/local/libressl-2.8/include"
    OPENSSL_LDFLAGS = "-L/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/usr/local/libressl-2.8/lib -F/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk/System/Library/PrivateFrameworks"
    OPENSSL_LIBS = "-lssl -lcrypto -framework TrustEvaluationAgent"
    OPT = "-DNDEBUG -g -fwrapv -O3 -Wall"
    OTHER_LIBTOOL_OPT = ""
    PACKAGE_BUGREPORT = "0"
    PACKAGE_NAME = "0"
    PACKAGE_STRING = "0"
    PACKAGE_TARNAME = "0"
    PACKAGE_URL = "0"
    PACKAGE_VERSION = "0"
    PARSER_HEADERS = "\"
    PARSER_OBJS = "\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o"
    PGO_PROF_GEN_FLAG = "-fprofile-instr-generate"
    PGO_PROF_USE_FLAG = "-fprofile-instr-use=code.profclangd"
    POBJS = "\"
    POSIX_SEMAPHORES_NOT_ENABLED = "0"
    PROFILE_TASK = "-m test --pgo"
    PTHREAD_KEY_T_IS_COMPATIBLE_WITH_INT = "0"
    PTHREAD_SYSTEM_SCHED_SUPPORTED = "1"
    PURIFY = ""
    PY3LIBRARY = ""
    PYLONG_BITS_IN_DIGIT = "0"
    PYTHON = "python"
    PYTHONFRAMEWORK = "Python3"
    PYTHONFRAMEWORKDIR = "Python3.framework"
    PYTHONFRAMEWORKINSTALLDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework"
    PYTHONFRAMEWORKPREFIX = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks"
    PYTHONPATH = ""
    PYTHON_FOR_BUILD = "./python.exe -E"
    PYTHON_FOR_REGEN = "python3.8"
    PYTHON_HEADERS = "\"
    PYTHON_OBJS = "\"
    PY_BUILTIN_MODULE_CFLAGS = "-g -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include/internal -IObjects -IInclude -IPython -I. -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -fvisibility=hidden -DPy_BUILD_SHARED -DPy_BUILD_CORE_BUILTIN"
    PY_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration"
    PY_CFLAGS_NODIST = "-std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include/internal"
    PY_COERCE_C_LOCALE = "1"
    PY_CORE_CFLAGS = "-g -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include/internal -IObjects -IInclude -IPython -I. -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -fvisibility=hidden -DPy_BUILD_SHARED -DPy_BUILD_CORE"
    PY_CORE_LDFLAGS = "-Wl,-headerpad,0x1000"
    PY_CPPFLAGS = "-IObjects -IInclude -IPython -I. -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64"
    PY_FORMAT_SIZE_T = ""z""
    PY_LDFLAGS = "-Wl,-headerpad,0x1000"
    PY_LDFLAGS_NODIST = ""
    PY_SSL_DEFAULT_CIPHERS = "1"
    PY_SSL_DEFAULT_CIPHER_STRING = "0"
    PY_STDMODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration  -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include/internal -IObjects -IInclude -IPython -I. -I/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Include -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -fvisibility=hidden -DPy_BUILD_SHARED"
    Py_DEBUG = "0"
    Py_ENABLE_SHARED = "0"
    Py_HASH_ALGORITHM = "0"
    Py_TRACE_REFS = "0"
    QUICKTESTOPTS = "-x test_subprocess test_io test_lib2to3 \"
    READELF = ":"
    RESSRCDIR = "Mac/Resources/framework"
    RETSIGTYPE = "void"
    RUNSHARED = "DYLD_FRAMEWORK_PATH=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host:/AppleInternal/XBS/Bundles/XBS.bundle/Contents/Frameworks DYLD_LIBRARY_PATH=/libressl/ssl/.libs:/libressl/crypto/.libs"
    SCRIPTDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib"
    SDKROOT = "/AppleInternal/BuildRoot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.Internal.sdk"
    SETPGRP_HAVE_ARG = "0"
    SGI_ABI = "@SGI_ABI@"
    SHELL = "/bin/sh"
    SHLIBS = "-ldl -lSystem  -framework CoreFoundation"
    SHLIB_SUFFIX = ".so"
    SHM_NEEDS_LIBRT = "0"
    SIGNED_RIGHT_SHIFT_ZERO_FILLS = "1"
    SITEPATH = ""
    SIZEOF_DOUBLE = "8"
    SIZEOF_FLOAT = "4"
    SIZEOF_FPOS_T = "8"
    SIZEOF_INT = "4"
    SIZEOF_LONG = "8"
    SIZEOF_LONG_DOUBLE = "16"
    SIZEOF_LONG_LONG = "8"
    SIZEOF_OFF_T = "8"
    SIZEOF_PID_T = "4"
    SIZEOF_PTHREAD_KEY_T = "8"
    SIZEOF_PTHREAD_T = "8"
    SIZEOF_SHORT = "2"
    SIZEOF_SIZE_T = "8"
    SIZEOF_TIME_T = "8"
    SIZEOF_UINTPTR_T = "8"
    SIZEOF_VOID_P = "8"
    SIZEOF_WCHAR_T = "4"
    SIZEOF__BOOL = "1"
    SO = ".cpython-38-darwin.so"
    SOABI = "cpython-38-darwin"
    SRCDIRS = "Parser Objects Python Modules Modules/_io Programs"
    SRC_GDB_HOOKS = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Tools/gdb/libpython.py"
    STDC_HEADERS = "1"
    STRICT_SYSV_CURSES = "/* Don't use ncurses extensions */"
    STRIPFLAG = "-s"
    SUBDIRS = ""
    SUBDIRSTOO = "Include Lib Misc"
    SYSLIBS = ""
    SYS_SELECT_WITH_SYS_TIME = "1"
    TARGET_OS_EMBEDDED = "0"
    TCLTK_INCLUDES = ""
    TCLTK_LIBS = ""
    TESTOPTS = ""
    TESTPATH = ""
    TESTPYTHON = "DYLD_FRAMEWORK_PATH=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host:/AppleInternal/XBS/Bundles/XBS.bundle/Contents/Frameworks DYLD_LIBRARY_PATH=/libressl/ssl/.libs:/libressl/crypto/.libs ./python.exe"
    TESTPYTHONOPTS = ""
    TESTRUNNER = "DYLD_FRAMEWORK_PATH=/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host:/AppleInternal/XBS/Bundles/XBS.bundle/Contents/Frameworks DYLD_LIBRARY_PATH=/libressl/ssl/.libs:/libressl/crypto/.libs ./python.exe /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Tools/scripts/run_tests.py"
    TESTTIMEOUT = "1200"
    TIMEMODULE_LIB = "0"
    TIME_WITH_SYS_TIME = "1"
    TM_IN_SYS_TIME = "0"
    TRAIN_STYLE = "DT"
    TRAIN_STYLE_DT = "1"
    TVOS_DEPLOYMENT_TARGET = ""
    UNICODE_DEPS = "\"
    UNIVERSALSDK = ""
    UPDATE_FILE = "python3.8 /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python/Tools/scripts/update_file.py"
    USE_COMPUTED_GOTOS = "0"
    VERSION = "3.8"
    VPATH = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python"
    WATCHOS_DEPLOYMENT_TARGET = ""
    WINDOW_HAS_FLAGS = "1"
    WITH_DOC_STRINGS = "1"
    WITH_DTRACE = "0"
    WITH_DYLD = "1"
    WITH_LIBINTL = "0"
    WITH_NEXT_FRAMEWORK = "1"
    WITH_PYMALLOC = "1"
    WITH_VALGRIND = "0"
    X87_DOUBLE_ROUNDING = "0"
    XMLLIBSUBDIRS = "xml xml/dom xml/etree xml/parsers xml/sax"
    ZIPSTDLIB = "no"
    abiflags = ""
    abs_builddir = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Binaries/python3/install/TempContent/Objects/host"
    abs_srcdir = "/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/python3/python3-73.100.20/Python"
    base = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    datarootdir = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/share"
    exec_prefix = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    installed_base = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    installed_platbase = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    platbase = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    prefix = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8"
    projectbase = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin"
    py_version = "3.8.2"
    py_version_nodot = "38"
    py_version_short = "3.8"
    srcdir = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin"
    userbase = "/Users/n8henrie/Library/Python/3.8"
davidhewitt commented 3 years ago

Yep, so running with LD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib will probably resolve issues with your system Python.

it should be present at runtime as well. Right?

Yes, but the error we've been seeing with pyenv is that it can't find the library to link (the wrong LIB_DIR is being detected by pyo3 to add to the linker search paths), and so LD_LIBRARY_PATH helping to load the library at runtime never comes into play.

Looking at your pyenv sysconfig, I think that pyenv should really have LIBDIR set to /Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib/? It could be worth reporting this upstream with pyenv and see whether they agree it's a bug.

In the meanwhile, you can probably workaround this by using PYO3_PRINT_CONFIG to get the current pyenv configuration, save that to a file, replace the lib_dir to be set to that directory above, and then use PYO3_CONFIG_FILE environment variable to point pyo3 at that custom lib dir.

n8henrie commented 3 years ago

Yep, so running with LD_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib will probably resolve issues with your system Python.

Thanks for all the suggestions. Still getting this with the system python; will need to take a closer look later. Thanks again for your time!

dyld: Library not loaded: @rpath/Python3.framework/Versions/3.8/Python3
  Referenced from: /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.k5WtRXDrBb/foo/target/debug/deps/foo-1c4d5e927fcdf368
  Reason: image not found
n8henrie commented 3 years ago

LIBDIR set to /Users/n8henrie/.pyenv/versions/3.9.6/Python.framework/Versions/3.9/lib In the meanwhile, you can probably workaround this by using PYO3_PRINT_CONFIG to get the current pyenv configuration, save that to a file, replace the lib_dir to be set to that directory above, and then use PYO3_CONFIG_FILE environment variable to point pyo3 at that custom lib dir.

This worked for pyenv. I would not have figured that out. Thank you!

It could be worth reporting this upstream with pyenv and see whether they agree it's a bug.

I'll see if I can put something coherent together.

davidhewitt commented 3 years ago

Still getting this with the system python; will need to take a closer look later. Thanks again for your time!

Right, sorry, I'm misreading. If I understand https://blog.krzyzanowskim.com/2018/12/05/rpath-what/ correctly, we need to ensure that the RPATH in the final binary contains this framework dir.

Maybe something like this could work, to add the Xcode frameworks dir to the binary?

install_name_tool -add_rpath /Applications/Xcode.app/Contents/Developer/Library/Frameworks /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.k5WtRXDrBb/foo/target/debug/deps/foo-1c4d5e927fcdf368

This worked for pyenv. I would not have figured that out. Thank you!

🎉

n8henrie commented 3 years ago

Well, more weird findings.

With both the system python and pyenv, I can run the same e.g. BASE_PYTHON=/path/to/pyenv/python tryagain.sh script from above, and it fails with the same error as above.

However, if I take a line from the end of the error output and cd into the tmpdir it is using, e.g. /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.RpYiD4RYF0/foo/target/debug/deps/foo-52886a903c6e12a4 -> cd /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.RpYiD4RYF0/foo and then cargo test --no-default-features from there -- it works.

Which doesn't make sense to me, because I am executing the command from that directory in the script (pushd there). (To be sure, I changed the pushd to cd, and it still fails.)

Homebrew python continues to work without having to manually cd to the tmpdir.

Why would that be?

Even worse, my actual project still fails with the same error I started with, even with running from that directory: note: ld: library not found for -lpython3.9 -- but it works if I clone into a tmpdir, cd there, and then run there. I've tried cargo clean, rm -r .venv, opening a new shell to make sure no ghost envvars are hanging out, even mving the old directory and re-cloning. I'm sure this is something simple I'm overlooking, but I'm pretty bewildered. Why would it fail when run from the tmpdir in the script, succeed when run from the tmpdir interactively, and fail when run from ~/git, where I keep all my projects?

$ cat tryagain.sh
#!/bin/bash

set -Eeuf -o pipefail

cd $(mktemp -d)

git clone --depth=1 https://github.com/n8henrie/knapsack
pushd knapsack

"${BASE_PYTHON}" -m venv .venv
. ./.venv/bin/activate
pip install --upgrade maturin
maturin develop
cargo test --no-default-features
$ BASE_PYTHON=~/.pyenv/versions/3.9.6/bin/python ./tryagain.sh
Cloning into 'knapsack'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 35 (delta 3), reused 33 (delta 3), pack-reused 0
Receiving objects: 100% (35/35), 87.93 KiB | 91.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting maturin
  Using cached maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (10.5 MB)
Collecting toml~=0.10.2
  Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB)
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
WARNING: You are using pip version 21.1.3; however, version 21.2.4 is available.
You should consider upgrading via the '/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/.venv/bin/python -m pip install --upgrade pip' command.
🔗 Found pyo3 bindings
🐍 Found CPython 3.9 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling proc-macro-hack v0.5.19
   Compiling syn v1.0.74
   Compiling pyo3-build-config v0.14.2
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling smallvec v1.6.1
   Compiling unindent v0.1.7
   Compiling scopeguard v1.1.0
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling knapsack v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack)
    Finished dev [unoptimized + debuginfo] target(s) in 6.63s
   Compiling pyo3-build-config v0.14.2
   Compiling pyo3-macros-backend v0.14.2
   Compiling pyo3 v0.14.2
   Compiling pyo3-macros v0.14.2
   Compiling knapsack v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.10l8tr4cdb3duggs.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.12u1obghg6fx7x41.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.12zy9jzt3yomn4s6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.139rbnqpsl8uh5up.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.141vzqvztnhgqatz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.15jsljqknksnescz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.17fp2oa431753m10.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.17xoc7ycr2r0nznj.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.194umr8i1ob7x6gp.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.19uus0aynpj0h33k.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1b20achr2urx8642.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1bkna28gfk6wpsfn.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1bl7dg4iur2pe182.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1emrbbkykbadnb3n.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1eua5tzyhep87c7y.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1fh41li7hlr1nxx3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1hry3n6tfed02rr7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1q9rcr65w7lxuwn4.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1r41p9vvzeepregh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1rwj6f2eipqvey8a.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1u70ihjrsmric33v.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1vgwbks186c1rz6x.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1wb88wx9ujawqfhm.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1zdlmrkf8ygpphna.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1zgocbhu8dwn5890.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.1zvuxz5jhyseyrew.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2755j642l10sfbl7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2aeb0q64wuig12m2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2c6lfpmtgh2uuk5u.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2ewc4jc1h6emrcbu.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2fop1e60ujju39lh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2jy9yd0zdulga0qh.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2k9qlazy02yd1qk7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2kdzluorfrij4816.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2kl35yc31xpmf4dd.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2pdly0z8myv8sxac.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2tevfluvuzwg8zd2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2tlpj5dk326oxmax.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2xdrtlb1kzxosu4k.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2ywl7yrjf9j2tp93.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.2zsjmfz468nd1gn6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.33w6n0ezgjhyvj7g.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.341pzzoyjjjxqt86.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.37di7mwn788ehxq2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.37vb8rhs5utxmdci.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.39nr2hjsfzqtcvhi.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3ccye8iwzfsicjip.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3d4pzoumo01av5ku.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3gsqe4nb40lpzh6i.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3gxv8yby63rzzfz5.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3j9gwa2vegxfvcm7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3jgm5xr16f1j9jxu.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3kd3nf53q3r13kwb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3n4wvjpb2h9wrhwi.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3p946nxgcx0iqd83.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3pab1343tw0phur9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3rs9645bg87j3xf3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3s1we1oe8ptyuoyc.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3twmkzmnbeinwef2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3v1r44n4it8k48ms.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3v7t27bho5bby24w.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3z5s1iltckeefdu3.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.3ztvukfmzmcpojbz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4037ioclmr4bwz57.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.44inf1y1ediwv8hf.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4908lr7mgqhbqjpz.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4aps40jzbzkbshsb.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4c92f52l4egk0t1v.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4cs3a983pjvvzdu9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4dljzuxm2gbswq5o.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4elv4rz86yeadu0b.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4f9akjzw2fbd89m9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4frnioyvekloyy2y.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4h43skjltwu5hrg7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4hnp5i4dv5803vs7.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4insgi0urlkpd7pu.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4l6vvarue55ay8c5.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4mkz4iqofnxxz0rr.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4nid8mbh5hs2if0q.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4oax8bpuktp1f3ze.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4ttrhygknd807i62.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4v13y3415brvw7mp.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4xr7yt4mkohbmon6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.4zszb8hc98z2pycc.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.51k5ie9g63lhpso2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.55y51pbgi1r6bjlf.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.57rkylbi71nrkfke.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.5c8c9hqcskwhdoop.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.5cezp99ftar47jiy.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.5f8kclkwhza28pvg.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.7w10wtwa1x9bd8t.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.9oxoopzlikumocy.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.afjjibydkv7rwux.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.bvqxf5ouos48n75.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.bxwqzmzuid0lj9h.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.c0nvl2ryn3w6s0q.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.cwfvrxvsilb2yu6.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.f475gqkoel1lqo0.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.f71004jk3lfabi4.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.fxmxsv5xah2ja8a.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.glk7oue6c0fd0.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.hwrdb55fmk3u4hx.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.ibdng3oafdtv07.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.kcqkntrjd43ma1o.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.lc88rycbterghrg.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.nthx98tigmfdu2.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.qmx20e10d6kspun.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.rjdyl2k8ycvphhi.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.ruq7k3tpj5gbg9h.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.vofbqzl2yjmmy4z.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.w3tn8cmmc54uvkt.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.xsl4a6cnk5lcpg9.rcgu.o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d.27h887fkaazor3d4.rcgu.o" "-L" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps" "-L" "/Users/n8henrie/.pyenv/versions/3.9.6/lib" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libtest-06ff11d645105e2b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libterm-f05ecaeca66814e6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgetopts-6ad0d034fc8e15c7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunicode_width-c4beacdc35405cb8.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_std-fc0f4647def297a8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libpyo3-44857f8da2fa9343.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libparking_lot-3d6f176468cb3e55.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libparking_lot_core-1a66328f5320fcf8.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libsmallvec-b1d3333bf059e064.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/liblock_api-09ae7dbe1cd82c80.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libscopeguard-62e7a6d9289eec1f.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libinstant-4e05ab198a32da16.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libcfg_if-254a4227ea494762.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/liblibc-2d65d84e2d4e9c71.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libunindent-dda6001dcdbb754c.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libpaste-61320a4b949429d0.rlib" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/libindoc-758ee8d2665c486a.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-000cdec9267bfd7b.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-2669f3cbce8358f4.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-86461a1c60728ccb.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-f17574752cb5ddba.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-3bb606c936cc0d28.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-8139a4b0cda20184.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-ea0823eca3e9abf9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-4f19e1259f6028e7.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-435daca85b8e10b5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-d73085abefd284c6.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-e6a09ca0044b34e5.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-e07333f48f53c71e.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-2a49b0d9fbc7a459.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-b66dda66aafe36c9.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-34d0b58da984bf31.rlib" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-01275baa20724171.rlib" "-lpython3.9" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/n8henrie/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: ld: library not found for -lpython3.9
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `knapsack`

To learn more, run the command again with --verbose.
$ cd /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack
$ cargo test --no-default-features
   Compiling pyo3-build-config v0.14.2
   Compiling pyo3-macros-backend v0.14.2
   Compiling pyo3 v0.14.2
   Compiling pyo3-macros v0.14.2
   Compiling knapsack v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.CtEqZ4H3V7/knapsack)
    Finished test [unoptimized + debuginfo] target(s) in 3.80s
     Running unittests (target/debug/deps/knapsack-e3891c9eeee3976d)

running 3 tests
test tests::test_parse ... ok
test tests::test_display_solution ... ok
test tests::test_solve ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
davidhewitt commented 3 years ago

This sounds like it's definitely an environment issue. Are you using direnv or something similar which automatically loads python environments as you switch directories by any chance?

However, if I take a line from the end of the error output and cd into the tmpdir it is using,

It doesn't look like you're selecting a python interpreter when you do this, so the subsequent cargo test probably ends up recompiling with homebrew python, which we know works well.

my actual project still fails with the same error I started with, even with running from that directory

Which python is that with? Presumably we now expect it to work with homebrew python and require manual environment overrides if you use system / pyenv.

n8henrie commented 3 years ago

It doesn't look like you're selecting a python interpreter when you do this

Doh! That was it. Sourcing the venv after cd and it fails as expected. It wasn't obvious to me (though should have been from your patient replies in this thread) that running cargo test --no-default-features would be pulling in runtime information from my python venv -- I figured that all happened during a python command like maturin develop.

I'd really prefer to use pyenv for development, since it pins the python version (i.e. when 3.10 comes out soon and homebrew updates it might hose any of my venvs that are based on homebrew python). For the time being, exporting the PyO3 config, manually editing the config file to fix the LIBDIR issue, then running the below to automatically export PYO3_CONFIG_FILE upon venv activation seems workable.

$ echo "export PYO3_CONFIG_FILE=\"$PWD/pyenv-config.txt\"" >> ./.venv/bin/activate

Maybe something like this could work, to add the Xcode frameworks dir to the binary?

Using /usr/bin/python3 for venv, install_name_tool does the trick:

$ source ./.venv/bin/activate
$ readlink -f $(which python3)
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3.8
$ cargo test --no-default-features
    Finished test [unoptimized + debuginfo] target(s) in 0.07s
     Running unittests (target/debug/deps/knapsack-e3891c9eeee3976d)
dyld: Library not loaded: @rpath/Python3.framework/Versions/3.8/Python3
  Referenced from: /private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.w2HVR48SEE/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d
  Reason: image not found
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.w2HVR48SEE/knapsack/target/debug/deps/knapsack-e3891c9eeee3976d` (signal: 6, SIGABRT: process abort signal)
$ install_name_tool -add_rpath /Applications/Xcode.app/Contents/Developer/Library/Frameworks ./target/debug/deps/knapsack-e3891c9eeee3976d
$ cargo test --no-default-features
    Finished test [unoptimized + debuginfo] target(s) in 0.08s
     Running unittests (target/debug/deps/knapsack-e3891c9eeee3976d)

running 3 tests
test tests::test_display_solution ... ok
test tests::test_parse ... ok
test tests::test_solve ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

🎉!

davidhewitt commented 3 years ago

😅 does this mean we now solved all the cases? 🚀

n8henrie commented 3 years ago

I'm not sure I'd consider the system python case fully resolved -- yes, it seems like the pyenv case is an upstream issue.

For the MacOS system python3, the general process above was a little clunky:

  1. Copy a dynamic library path to python3, surprisingly buried somewhere in Xcode
  2. search for a dynamically named binary towards the end of a bunch of error output
  3. running a somewhat obscure tool to change the @rpath
  4. profit

I'm still doing some reading and found a few posts like this, I wonder if I can add some linker args to Cargo.toml to make this process smoother for other MacOS users (with a planned documentation PR). Or perhaps some build.rs magic. Or perhaps another option to help this be a little smoother before I'd consider the issue solved.

I am profoundly grateful for your time on this issue so far!

davidhewitt commented 3 years ago

Fair enough. If you come across something which is reusable and can be shoved into a build.rs we can add it as a new API in pyo3-build-config for users to invoke in their build scripts.

n8henrie commented 3 years ago

Relevant conversations:

Tried a bazillion or so cross-product combinations of:

adding to cargo config:

[profile.dev]
rpath = true
maturin develop --rustc-extra-args='-C link-args=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks'
maturin develop --rustc-extra-args='-C link-args=-Wl,-rpath,/Applications/Xcode.app/Contents/Developer/Library/Frameworks'
$ DYLD_FALLBACK_LIBRARY_PATH=/Library/Developer/CommandLineTools/Library/Frameworks cargo test --no-default-features

Just as I was about to give up, I hit gold:

$ RUSTFLAGS='-C link-args=-Wl,-rpath,/Applications/Xcode.app/Contents/Developer/Library/Frameworks' cargo test --no-default-features

Seems like that's all that's needed, I removed the rpath = true and it still works.

I prefer /Library/Developer/CommandLineTools/Library/Frameworks to the Xcode path above, and it seems to work as well, though there are a lot of differences between the two (according to diff -r).

POC:

$ cat tryagain.sh
#!/bin/bash

set -Eeuf -o pipefail

pushd $(mktemp -d)

git clone --depth=1 https://github.com/n8henrie/knapsack
pushd knapsack

"${BASE_PYTHON}" -m venv .venv
. ./.venv/bin/activate
./.venv/bin/python -m pip install --upgrade pip
./.venv/bin/python -m pip install --no-index maturin
./.venv/bin/maturin develop
RUSTFLAGS='-C link-args=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks' \
  cargo test --no-default-features
$ BASE_PYTHON=/usr/bin/python3 ./tryagain.sh
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.SmfGuLhEiW ~
Cloning into 'knapsack'...
remote: Enumerating objects: 35, done.
remote: Counting objects: 100% (35/35), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 35 (delta 3), reused 33 (delta 3), pack-reused 0
Receiving objects: 100% (35/35), 87.93 KiB | 360.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.SmfGuLhEiW/knapsack /var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.SmfGuLhEiW ~
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Collecting pip
  Using cached https://files.pythonhosted.org/packages/ca/31/b88ef447d595963c01060998cb329251648acf4a067721b0452c45527eb8/pip-21.2.4-py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-21.2.4
Looking in links: /Users/n8henrie/.dotfiles/pip/wheel-cache
Processing /Users/n8henrie/.dotfiles/pip/wheel-cache/maturin-0.11.2-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Processing /Users/n8henrie/.dotfiles/pip/wheel-cache/toml-0.10.2-py2.py3-none-any.whl
Installing collected packages: toml, maturin
Successfully installed maturin-0.11.2 toml-0.10.2
🔗 Found pyo3 bindings
🐍 Found CPython 3.8 at python
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling proc-macro-hack v0.5.19
   Compiling pyo3-build-config v0.14.2
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling unindent v0.1.7
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.6.1
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling quote v1.0.9
   Compiling parking_lot_core v0.8.3
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling knapsack v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.SmfGuLhEiW/knapsack)
    Finished dev [unoptimized + debuginfo] target(s) in 11.55s
   Compiling proc-macro2 v1.0.28
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.74
   Compiling proc-macro-hack v0.5.19
   Compiling pyo3-build-config v0.14.2
   Compiling once_cell v1.8.0
   Compiling libc v0.2.99
   Compiling cfg-if v1.0.0
   Compiling unindent v0.1.7
   Compiling scopeguard v1.1.0
   Compiling smallvec v1.6.1
   Compiling instant v0.1.10
   Compiling lock_api v0.4.4
   Compiling parking_lot_core v0.8.3
   Compiling quote v1.0.9
   Compiling parking_lot v0.11.1
   Compiling paste-impl v0.1.18
   Compiling pyo3 v0.14.2
   Compiling paste v0.1.18
   Compiling pyo3-macros-backend v0.14.2
   Compiling indoc-impl v0.3.6
   Compiling indoc v0.3.6
   Compiling pyo3-macros v0.14.2
   Compiling knapsack v0.1.0 (/private/var/folders/kb/tw_lp_xd2_bbv0hqk4m0bvt80000gn/T/tmp.SmfGuLhEiW/knapsack)
    Finished test [unoptimized + debuginfo] target(s) in 11.15s
     Running unittests (target/debug/deps/knapsack-e3891c9eeee3976d)

running 3 tests
test tests::test_display_solution ... ok
test tests::test_parse ... ok
test tests::test_solve ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

One way to make this a little easier is the same virtualenv trick as per above:

$  echo "export RUSTFLAGS='-C link-args=-Wl,-rpath,/Applications/Xcode.app/Contents/Developer/Library/Frameworks'" >> ./.venv/bin/activate

Probably a better solution is to put in ./.cargo/config:

[build]
rustflags = [
  "-C", "link-args=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks",
]

With regards to build.rs, I thought this looked promising, but no dice:

fn main() {
    println!(
        "cargo:rustc-link-search=framework=/Library/Developer/CommandLineTools/Library/Frameworks"
    )
}

But using nightly (for testing only, looks like it has been stabilized to be released with 0.56) and using this build.rs worked a treat:

$ cat build.rs
fn main() {
    println!(
        "cargo:rustc-link-arg=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks"
    );
}
$ cargo +nightly test --no-default-features
   Compiling knapsack v0.1.0 (/Users/n8henrie/git/knapsack)
...
    Finished test [unoptimized + debuginfo] target(s) in 0.52s
     Running unittests (target/debug/deps/knapsack-5d0869e61f55eb39)

running 3 tests
test tests::test_display_solution ... ok
test tests::test_parse ... ok
test tests::test_solve ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Works just as well with /Applications/Xcode.app/Contents/Developer/Library/Frameworks (instead of the CommandLineTools path).

Phew!

Once cargo:rustc-link-arg is available in stable rust, would it be reasonable for me to submit a PR to PyO3's build.rs ~L110, with some logic looking for /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework in lib_dir, and if found, emit the rustc-link-arg above? I would probably stick to the Xcode path, since that's the one contained in LIBDIR:

$ /usr/bin/python3 -m sysconfig | grep '\bLIBDIR\b'
        LIBDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib"
n8henrie commented 3 years ago

With regards to build.rs, I thought this looked promising

Well, it fixes the pyenv issue at least! No more need for dirty environment variable hacks, nice that a build.rs can get placed in git (though perhaps I should figure out some dynamic way to set the homedir I guess PYENV_ROOT will work for now).

$ cat build.rs
fn main() {
    println!(
        "cargo:rustc-link-search=native={}/versions/3.9.6/Python.framework/Versions/3.9/lib",
        env!("PYENV_ROOT"),
    );
}
$ cargo test --no-default-features
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests (target/debug/deps/knapsack-636e358c9a9ebca1)

running 3 tests
test tests::test_display_solution ... ok
test tests::test_parse ... ok
test tests::test_solve ... ok
davidhewitt commented 3 years ago

Once cargo:rustc-link-arg is available in stable rust, would it be reasonable for me to submit a PR to PyO3's build.rs ~L110, with some logic looking for /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework in lib_dir, and if found, emit the rustc-link-arg above? I would probably stick to the Xcode path, since that's the one contained in LIBDIR:

Hmm, this an interesting one.

Modifying binaries' RPATH for all downstream users may have unintended consequences; they may suddenly start loading a different shared library to what they were before.

I found an interesting blog at https://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-names.html#comment-0a8da6a6e71853ed6f96a0d58e77627f which suggests that /Library/Frameworks and /System/Library/Frameworks are searched by default.

I think the macOS Python installer from python.org will install a framework into /Library/Frameworks? So I wonder whether users typically will not run into the rpath issue you're having with the system (aka XCode) Python 3.

This problem seems to be unique to the environment you're running: you're using the XCode Python which wants to supply its linkage through an rpath, however there's no matching Python3 framework in your system's installed libraries.

This is why I think a pyo3-build-config API which users can use to opt-in, rather than changing it by default for everyone, seems preferable to me?

n8henrie commented 3 years ago

Modifying binaries' RPATH for all downstream users may have unintended consequences; they may suddenly start loading a different shared library to what they were before.

With a default Big Sur installation, apparently /usr/bin/python3 is a stubfile that prompts users to use the MacOS Command Line Tools to install the version I've discussed above at /Library/Developer/.

My wife's MacBook Air seems like a decent test case (she is not a developer, but has MacOS Command Line Tools installed so that I can run automated backups). Unfortunately, it looks like there's more to the story. Instead of the @rpath error from above, I'm getting one more similar to the pyenv error (she does not have pyenv installed).

  = note: ld: warning: directory not found for option '-L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib'
          ld: library not found for -lpython3.8
          clang: error: linker command failed with exit code 1 (use -v to see invocation)          

For her, it looks like /Applications/Xcode.app doesn't exist at all, so it's a bit frustrating that it's still set as LIBDIR according to python -m sysconfig. /Library/Developer/CommandLineTools/Library/Frameworks does exist. Neither the build.rs nor RUSTFLAGS from above works alone; instead, I have to both set RUSTFLAGS='-C link-args=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks' (I didn't install nightly on her computer, so I can't yet try the build.rs approach for fixing rpath), and I have to also set the build.rs as per below.

fn main() {
    println!(
        "cargo:rustc-link-search=native=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib"
    )
}

Again, on her MacBook, LIBDIR is identical to mine, even though she doesn't have XCode installed, which seems like an upstream Apple issue I guess?

$ /usr/bin/python3 -m sysconfig | grep '\bLIBDIR\b'
        LIBDIR = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib"
$ ls -ld /Applications/Xcode.app
ls: cannot access '/Applications/Xcode.app': No such file or directory

What a pain.

you're using the XCode Python

I didn't install anything special via Xcode, and as shown above one doesn't even need to have ever installed Xcode to run into this, it's just the default MacOS system python3, installed via MacOS Command Line Tools.

I wonder whether users typically will not run into the rpath issue you're having

I guess that's a good question. I don't know how common it is for MacOS users to install Python through Python.org, as opposed to homebrew or pyenv, which is what I've always done. I had thought /usr/bin/python3 might be more common than via Python.org, but I could be wrong.

Either way, given that we've gone through several not-terribly-onerous workarounds:

perhaps this could start as a documentation PR and go from there?

davidhewitt commented 3 years ago

Ah ok, thanks for testing all that! Agreed it looks like there's a bit of oddity in the way that Apple's set this up.

I think a documentation PR is an excellent idea. I've actually been wanting to add a section to the guide for a while on installing Python. I think there's two separate topics, though that's not necessarily the best way to organise it:

I was hoping that we'd be able to break those two down by OS and installation method. (E.g. the information that we've collected here is a perfect example of the different choices available for macOS.) E.g. something like the alacritty install notes which cover lots of platforms. We can start with something simple (macOS / Linux / Windows) with plenty of gaps, and invite users to fill in information for their platform.

(Doing any documentation on this line would probably supercede #763 which never got merged.)

n8henrie commented 3 years ago

Somehow I missed this section in the docs: https://pyo3.rs/v0.14.4/building_and_distribution.html#macos

It doesn't seem like pyo3_build_config::add_extension_module_link_args() makes any difference for /usr/bin/python3 in my case, which makes sense since it says that maturin should be doing this for me.

n8henrie commented 3 years ago

Good new: with some help from the pyenv team, I found a different way of approaching the framework install that seems to have things working without any extra steps (build.rs, linker flags, etc.).

The short of it is that CONFIGURE_OPTS, which is what I was using, is working differently than PYTHON_CONFIGURE_OPTS (https://github.com/pyenv/pyenv/issues/2081). With PYTHON_CONFIGURE_OPTS, the --enable-framework build flag is working and seems to be properly setting prefix, so while LIBDIR is unchanged, rust is finding everything as expected.

https://github.com/pyenv/pyenv/issues/2038#issuecomment-931728391

So I think only the system MacOS installation remains an issue, and it certainly seems buggy based on the above.

sobolevn commented 3 years ago

Is there any way to solve this?

I've just got hit by it:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.1iy3cf52co6w634b.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.1nx92m9alz1pd852.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.1oqbfn3fee556ddb.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.1xf1mb8uhe3gkbof.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.2tiivfaj4ddkgsoy.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.2tluhbe360qpj1qe.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.2xf93zf06azdddun.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.32voxgcbgketfwkb.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.3flve906o7lo3wwp.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.3pykkq3tycon5lf1.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.3ydz9h98hjwl3caw.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.42yz10lz6zjnaiof.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.48vs8rm647uel96m.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.4jiop8jz3qwck3z2.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.4rbu7sh9iebjgwgi.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.4rgimcdq1zinwrfu.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.4s0jd4bloanq4pvw.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.52xwylvw20gr8yaa.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.9butto06fvbkgbz.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.ljhb3o78vgbgcka.rcgu.o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9.n662ilighmfgajr.rcgu.o" "-L" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps" "-L" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libpyo3-401c5a02b81b477f.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libparking_lot-682e11ac4bd25684.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libparking_lot_core-3b9975bb6867e006.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libsmallvec-bab46976c4546413.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/liblock_api-6764e05797cceabb.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libscopeguard-9e9d60c809f3cb16.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libinstant-6d7606edb1f55bca.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libcfg_if-6177bc18c2d5293c.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libunindent-9d9f94d93362e12f.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libpaste-2e60a604dcf8a23e.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libindoc-0a8aabdfb1633a57.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libclap-506408a1aa2d2fc3.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libstrsim-41c4716efa4ee527.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libatty-c35f6176f776e32c.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/liblibc-d659ec59a732182c.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libunicase-f1300b2963c56775.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libtermcolor-48fd61bdf3abe71d.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libtextwrap-7fb668c3151f3ec0.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libunicode_width-befe970bb04d7a4d.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libindexmap-0aaa8105482e9deb.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libhashbrown-83184040054d2b64.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libos_str_bytes-884c6d8b00d7d202.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libmemchr-2b8b6b6a5da641b7.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/libbitflags-75a1110966c90018.rlib" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/liblazy_static-733fd1ce8b835c42.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-4ec60b84367e08d2.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-7099e56a0d1c94d7.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-afc436bb512056a3.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-3f6689c6ea577924.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-6e9b24362bf14fa5.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-02bb2b1bd9878bd0.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-936632ac628807e3.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-9708050de2af4e40.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-896e16a2412081ee.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-8b76e66ef30ec18c.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-4947b30fb2d5efc7.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-6e908e0f583d9b3a.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-8fcff7e9e26ac9fb.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-61108b48f3f0c52b.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-d1337b5e8e6a58bd.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-1036fd7d2889d55f.rlib" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-1ce642d447892a2b.rlib" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/sobolev/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/sobolev/Documents/github/pravda/packages/pravda-semantic/target/debug/deps/pravda_semantic-6a1c644f9d2663a9" "-Wl,-dead_strip" "-nodefaultlibs"
  = note: Undefined symbols for architecture x86_64:
            "_PyBytes_AsString", referenced from:
                pyo3::types::bytes::PyBytes::as_bytes::h1eba00e48dbbffc1 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.10.rcgu.o)
            "_PyObject_GetAttr", referenced from:
                pyo3::types::any::PyAny::getattr::_$u7b$$u7b$closure$u7d$$u7d$::h793f8ba5bca6d296 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.8.rcgu.o)
            "_PyUnicode_FromStringAndSize", referenced from:
                pyo3::types::string::PyString::new::hcc96760164d52a53 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.14.rcgu.o)
            "_PyExc_TypeError", referenced from:
                _$LT$pyo3..exceptions..PyTypeError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::h22395dd4d719fcd7 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.1.rcgu.o)
            "_PyExc_BaseException", referenced from:
                _$LT$pyo3..exceptions..PyBaseException$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::h30bc00e1b64c22db in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.1.rcgu.o)
            "_PyBytes_Size", referenced from:
                pyo3::types::bytes::PyBytes::as_bytes::h1eba00e48dbbffc1 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.10.rcgu.o)
            "_PyErr_PrintEx", referenced from:
                pyo3::err::PyErr::print::h2439a956d7070d55 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyErr_NormalizeException", referenced from:
                pyo3::err::PyErr::normalized::h06eb17e7cbfc3c24 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyGILState_Release", referenced from:
                _$LT$pyo3..gil..GILGuard$u20$as$u20$core..ops..drop..Drop$GT$::drop::ha22001929190cb4c in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.7.rcgu.o)
            "_PyErr_Restore", referenced from:
                pyo3::err::PyErr::restore::hc2e44c89d4419ada in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyObject_Repr", referenced from:
                pyo3::types::any::PyAny::repr::h9873ed1b4862e5b0 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.8.rcgu.o)
            "_PyExc_SystemError", referenced from:
                _$LT$pyo3..exceptions..PySystemError$u20$as$u20$pyo3..type_object..PyTypeInfo$GT$::type_object_raw::hfe76ddb17aea0f91 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.1.rcgu.o)
            "__Py_Dealloc", referenced from:
                pyo3::ffi::object::Py_DECREF::he7e44aef448fa385 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.9.rcgu.o)
            "_PyErr_Print", referenced from:
                pyo3::err::panic_after_error::hcdadec454c85deb6 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyErr_NewException", referenced from:
                pyo3::err::PyErr::new_type::hfdb41d9c43c33b82 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyErr_Fetch", referenced from:
                pyo3::err::PyErr::fetch::h11ac07d8c1bf9003 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.13.rcgu.o)
            "_PyUnicode_AsUTF8AndSize", referenced from:
                pyo3::types::string::PyString::to_str::h4728b6bd66623afb in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.14.rcgu.o)
            "_PyGILState_Ensure", referenced from:
                pyo3::gil::GILGuard::acquire_unchecked::h001e4aad51ca7562 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.7.rcgu.o)
            "_PyUnicode_AsEncodedString", referenced from:
                pyo3::types::string::PyString::to_string_lossy::hc7427fbedb3abd8c in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.14.rcgu.o)
            "_Py_IsInitialized", referenced from:
                pyo3::gil::GILGuard::acquire::_$u7b$$u7b$closure$u7d$$u7d$::h587963c703bf0429 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.7.rcgu.o)
            "_PyEval_ThreadsInitialized", referenced from:
                pyo3::gil::GILGuard::acquire::_$u7b$$u7b$closure$u7d$$u7d$::h587963c703bf0429 in libpyo3-401c5a02b81b477f.rlib(pyo3-401c5a02b81b477f.pyo3.e0055ccb-cgu.7.rcgu.o)
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

warning: `pravda-semantic` (bin "pravda-semantic") generated 3 warnings
error: could not compile `pravda-semantic` due to previous error; 3 warnings emitted

I am using MacOS and this setup:

[dependencies.pyo3]
version = "0.14.5"

[features]
extension-module = ["pyo3/extension-module"]
default = ["extension-module"]

Update: https://pyo3.rs/v0.14.4/building_and_distribution.html#macos

digizeph commented 2 years ago

I hit the problem with m1 Mac when trying to publish a crate original built fine on intel-based machines.

I was able to resolve the issue by adding --no-default-features flag.

mrlevitas commented 2 years ago

this helped me: https://pyo3.rs/v0.14.2/building_and_distribution.html#macos

xloem commented 2 years ago

This issue is present on android termux as well as macos.

sorry, my error is different, deleting this comment error happens only with maturin build, not maturin develop: "attempted to link to Python shared library but config does not contain lib_name"

[oops, I don't see a way to delete comments, apologies]

websearchers: the workaround here is to make a custom config file as described at the bottom of https://github.com/PyO3/pyo3/issues/1800#issuecomment-902539210

davidhewitt commented 2 years ago

@xloem if you're able to share a repro in a separate issue we might be able to understand why the lib name is missing and perhaps avoid the need for you to have a custom config eventually.