Skip to content

maturin build --target x86_64-pc-windows-gnu --zig results in a broken module #922

Open
@ravenexp

Description

@ravenexp

Bug Description

Running the above command succeeds, but shown a warning:

⚠️  Warning: Couldn't find the symbol `PyInit_testmodule` in the native library. Python will fail to import this module. If you're using pyo3, check that `#[pymodule]` uses `testmodule` as module name

I've checked the extension module with objdump, and it indeed does not export any symbols.

Building the same extension without --zig results in a working module exporting PyInit_testmodule.

Your Python version (python -V)

Python 3.10.4

Your pip version (pip -V)

pip 21.0

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. Build with maturin build --target x86_64-pc-windows-gnu --zig
  2. Build with maturin build --target x86_64-pc-windows-gnu
  3. The first command results in a broken module, the second command works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcross-compileSomething related to cross compilation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions