Skip to content

Error compiling: ld: symbol(s) not found for architecture x86_64 #1

@hndrbrm

Description

@hndrbrm

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",
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions