Git Product home page Git Product logo

Comments (5)

itrumper avatar itrumper commented on June 24, 2024

I also have been running into an issue using the work-around where maturin build cannot find the dylib (I'm on macOS) built by uniffi because the library built is called libuniffi_uniffi_test, which I can see when I unpack the wheel after running pip install . This doesn't match with the command above, which is pulling the correct dylib from the target directory, so I'm not sure what is going on here. I will try and create a MWE repo for this issue, but again, I'm having trouble because it seems that maturin new -b uniffi uses a UDL file, while I'm using their proc macros and v0.26 of the uniffi crate.

I have found another work-around for this issue, which is to first call maturin develop, which generates an additional module within my python directory with the incorrectly named dylib. I then re-name the dylib manually to what it is supposed to be (libuniffi_test.dylib), and then run maturing build and pip install .. This somehow collects the "correct" library.

I think this is also related to the fact that I get an ImporError when using maturin develop. Again, I apologize for the lack of a MWE, but as you can tell, there is a lot of complexity to this issue! I'll keep digging and report back.

from maturin.

mbway avatar mbway commented on June 24, 2024

I also ran into this incompatibility but on my machine (Arch Linux) the build suceeds but fails to load. For example installing test-crates/uniffi-mixed from the maturin repo and running python test-crates/uniffi-mixed/check_installed/check_installed.py

Traceback (most recent call last):
  File "maturin/test-crates/uniffi-mixed/check_installed/check_installed.py", line 3, in <module>
    import uniffi_mixed
  File "maturin/test-crates/uniffi-mixed/uniffi_mixed/__init__.py", line 1, in <module>
    from .uniffi_mixed import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "maturin/test-crates/uniffi-mixed/uniffi_mixed/uniffi_mixed/__init__.py", line 1, in <module>
    from .math import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^
  File "maturin/test-crates/uniffi-mixed/uniffi_mixed/uniffi_mixed/math.py", line 766, in <module>
    _uniffi_check_contract_api_version(_UniffiLib)
  File "maturin/test-crates/uniffi-mixed/uniffi_mixed/uniffi_mixed/math.py", line 476, in _uniffi_check_contract_api_version
    raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
uniffi_mixed.uniffi_mixed.math.InternalError: UniFFI contract version mismatch: try cleaning and rebuilding your project

The error is triggered by bindings_contract_version = 25 and scaffolding_contract_version = 24

after installing uniffi-bindgen==0.25.0 after rebuilding check_installed.py prints SUCCESS

from maturin.

messense avatar messense commented on June 24, 2024

You need to make sure your uniff crate major.minor version is aligned with the python uniffi-bindgen package version.

from maturin.

messense avatar messense commented on June 24, 2024

FYI, the python uniffi-bindgen package exists as an optimization to reduce compilation time for uniffi bindings, you can use the official recommended way of creating the uniffi-bindgen binary in your project to better satisfy the version requirement.

from maturin.

itrumper avatar itrumper commented on June 24, 2024

Thank you for the additional info! Yes, on further inspection, my uniffi crate version was 0.25, and it just so happened that I began using maturin a day after the 0.26 release happened 😆 .

from maturin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.