"Yocto Recipe Build Fails Due to Missing pyo3 Dependency in Rust Project – How to Resolve?"

“I’m trying to build a Yocto recipe for a Python package called jitter which is fine Rust but I’m encountering issues related to the pyo3 despite existing in my Cargo.toml file with the right version. Specifically, I’m getting errors like no matching package named pyo3 found. itried cargo update but still encountering the same error . Here are the details from my recipe and logs: Recipe Snippet: Recipe created by recipetool # This is the basis of a recipe and may need further editing in order to be fully functional. # (Feel free to remove these comments when editing.) # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is # your responsibility to verify that the values are complete and correct. LICENSE = “MIT” LIC_FILES_CHKSUM = “file://crates/jiter/LICENSE;md5=aa97bb3778992892e226b4504b83b60c” SRC_URI = “https://files.pythonhosted.org/packages/f6/27/53d3ffa863e7ef40023b1730fc5c999a616f3695145fd6fd7a351e8a8ae7/jiter-${PV}.tar.gz” SRC_URI[md5sum] = “98a4910b537b4c71b0eb29afe4c4b45e” SRC_URI[sha1sum] = “8f77c34d415ce96cf9cf275359f3e569a16e8786” SRC_URI[sha256sum] = “741851cf5f37cf3583f2a56829d734c9fd17334770c9a326e6d25291603d4278” SRC_URI[sha384sum] = “2495d36b80d62232213f1b4ec57f6ffb7008172f308bdb739321a72d5c2290b89aab469c2178c0be2e8b2e4f3a48ca07” SRC_URI[sha512sum] = “420f7e6785bb34441f27476bad7abc5a362ca98735d527bd90b5980951a0b3116926d82863bab4d12769e42d0e70b783e494bb90e30ae4edc035752289875e42” S = “${WORKDIR}/jiter-${PV}” inherit cargo pypi PYPI_PACKAGE = “jiter” DEBUG: Executing python function externalsrc_compile_prefunc NOTE: python3-jiter: compiling from external source tree /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter DEBUG: Python function externalsrc_compile_prefunc finished DEBUG: Executing shell function do_compile NOTE: cargo = /home/rania/pixii_os/pixii_os/build/tmp/work/cortexa72-cortexa53-tdx-linux/python3-jiter/0.4.1-r0/recipe-sysroot-native/usr/bin/cargo NOTE: rustc = NOTE: cargo build -v --target aarch64-tdx-linux --release --manifest-path=/home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter//Cargo.toml warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter/Cargo.toml: dependency (pyo3) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter/Cargo.toml: unused manifest key: dev-dependencies.pyo3.workspace warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter/Cargo.toml: unused manifest key: lints warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/Cargo.toml: unused manifest key: workspace.dependencies warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/Cargo.toml: unused manifest key: workspace.package warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter-python/Cargo.toml: dependency (pyo3) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter-python/Cargo.toml: unused manifest key: dependencies.pyo3.workspace warning: /home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter-python/Cargo.toml: unused manifest key: lints error: no matching package named pyo3 found location searched: registry crates-io required by package jiter-python v0.4.1 (/home/rania/pixii_os/pixii_os/build/workspace/sources/python3-jiter/crates/jiter-python) WARNING: exit code 101 from a shell command. How can I resolve the pyo3 dependency issue in Yocto and ensure the correct version is used or specified for building? Are there specific considerations for managing Rust dependencies in a cross-compilation environment like Yocto?”

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


To resolve the pyo3 dependency issue in your Yocto build, you should follow these steps based on the context provided:

  1. Specify the pyo3 Dependency Version: Ensure that the pyo3 dependency is specified with a version in your Cargo.toml file. This is crucial for the build system to locate the package in the crates.io registry. Update your Cargo.toml as follows:

    [dependencies]
    pyo3 = "0.15"  # or the latest compatible version
    
  2. Check for Local Path or Git Repository: If you are using a specific version of pyo3 that is not available in the crates.io registry, specify a local path or a Git repository link in your Cargo.toml:

    [dependencies]
    pyo3 = { git = "https://github.com/pyo3/pyo3.git", branch = "main" }
    
  3. Update the Yocto Recipe: Ensure that your Yocto recipe includes the cargo class to handle Rust dependencies:

    inherit cargo
    
  4. Cross-Compilation Considerations: Make sure that the Rust toolchain is set up correctly for the target architecture. You may need to specify the target in your Cargo.toml or in the Yocto build configuration.

  5. Build and Test: After making these changes, run the build process again using bitbake <your-recipe-name>. Monitor the logs for any further errors or warnings related to the pyo3 dependency.

By following these steps, you should be able to resolve the pyo3 dependency issue and successfully build your Yocto recipe. If you continue to encounter issues, double-check the version compatibility of pyo3 with your Rust version and other dependencies.

Please, also check if these links can help you solve your problem:

Torizon-minimal: error when building librsvg.