Skip to content

I need help to link rust PyO3 package to pyodide. #2285

Answered by hoodmane
km19809 asked this question in Q&A
Discussion options

You must be logged in to vote

You don't need to rebuild Pyodide. You will need to apply this patch to your copy of emscripten:
https://github.com/pyodide/pyodide/pull/2081/files#diff-4d3dbac9b16778c2f3c4e57a847de655a6d51b8b92d89d3ba926148a79dfeddb

Also, you need to build the rust standard library unless your package has #[no-std]. You also need:

    export RUSTFLAGS="\
      -C relocation-model=pic\
      -C target-feature=+mutable-globals\
      -C link-arg=-s\
      -C link-arg=SIDE_MODULE=1\
    "

You should imitate the build script here:
https://github.com/hoodmane/pyodide/blob/pyo3/packages/pyo3_samples/meta.yaml

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@derivator
Comment options

@hoodmane
Comment options

@hoodmane
Comment options

@hoodmane
Comment options

@km19809
Comment options

Answer selected by km19809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants