Problem:
When i compile with cargo build --release, the compilation failed with a long log.
Resume of the error log:
error: linking with cc failed: exit status: 1
...
note: Undefined symbols for architecture x86_64: "_PyBaseObject_Type", referenced from:
...
ld: symbol(s) not found for architecture x86_64
Its related to pyo3 issue:
https://github.com/PyO3/pyo3/issues/4279
Solution:
Add this on .cargo/config.toml:
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]