Jiter 0.4.1 pypi package failed to build in yocto

this is my first time with a rust package it’s jiter 0.4.1 that got from pypi.org i am trying to integrate this recipe with my tdx-reference-multimedia-image but it insist on failing this is the structure of the project:

├── Cargo.lock
├── Cargo.toml
├── crates
│   ├── jiter
│   │   ├── benches
│   │   │   ├── bigints_array.json
│   │   │   ├── floats_array.json
│   │   │   ├── generate_big.py
│   │   │   ├── main.rs
│   │   │   ├── massive_ints_array.json
│   │   │   ├── medium_response.json
│   │   │   ├── pass1.json
│   │   │   ├── pass2.json
│   │   │   ├── python.rs
│   │   │   ├── sentence.json
│   │   │   ├── short_numbers.json
│   │   │   ├── string_array.json
│   │   │   ├── string_array_unique.json
│   │   │   ├── true_array.json
│   │   │   ├── true_object.json
│   │   │   ├── unicode.json
│   │   │   └── x100.json
│   │   ├── build.rs
│   │   ├── Cargo.toml
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── errors.rs
│   │   │   ├── jiter.rs
│   │   │   ├── lazy_index_map.rs
│   │   │   ├── lib.rs
│   │   │   ├── number_decoder.rs
│   │   │   ├── parse.rs
│   │   │   ├── py_lossless_float.rs
│   │   │   ├── py_string_cache.rs
│   │   │   ├── python.rs
│   │   │   ├── simd_aarch64.rs
│   │   │   ├── string_decoder.rs
│   │   │   └── value.rs
│   │   └── tests
│   │       ├── main.rs
│   │       └── python.rs
│   └── jiter-python
│       ├── bench.py
│       ├── Cargo.toml
│       ├── jiter.pyi
│       ├── README.md
│       ├── requirements.txt
│       ├── src
│       │   └── lib.rs
│       └── tests
│           ├── requirements.txt
│           └── test_jiter.py
├── oe-logs -> /home/rania/pixii_os/pixii_os/build/tmp/work/cortexa72-cortexa53-tdx-linux/python3-jiter/0.4.1-r0/temp
├── oe-workdir -> /home/rania/pixii_os/pixii_os/build/tmp/work/cortexa72-cortexa53-tdx-linux/python3-jiter/0.4.1-r0
├── PKG-INFO
├── pyproject.toml
└── README.md

this is the cargo.toml within crates/jiter:

[package]
name = "jiter"
description = "Fast Iterable JSON parser"
readme = "../../README.md"
authors = ["Samuel Colvin <samuel@pydantic.dev>"]
version = "0.4.1"
edition = "2021"
license = "MIT"
keywords = ["JSON", "parsing", "deserialization", "iter"]
categories = ["parser-implementations", "parsing"]
homepage = "https://github.com/pydantic/jiter/"
repository = "https://github.com/pydantic/jiter/"

[dependencies]
num-bigint = "0.4.4"
num-traits = "0.2.16"
ahash = "0.8.0"
smallvec = "1.11.0"
pyo3 = { version = "0.21.0", optional = true }
lexical-parse-float = { version = "0.8.5", features =  ["format"] }
bitvec = "1.0.1"

[features]
python = ["pyo3", "pyo3-build-config"]

[dev-dependencies]
bencher = "0.1.5"
paste = "1.0.7"
serde_json = {version = "1.0.87", features = ["preserve_order", "arbitrary_precision", "float_roundtrip"]}
serde = "1.0.147"
pyo3 = { workspace = true, default-features=false, features = ["num-bigint", "auto-initialize"] }
codspeed-bencher-compat = "2.3.1"

[build-dependencies]
pyo3-build-config = { version = "0.21.0", optional = true }

[[test]]
name = "python"
required-features = ["python"]

[[bench]]
name = "main"
harness = false

[[bench]]
name = "python"
required-features = ["python"]
harness = false

# get docs.rs to include python docs
[package.metadata.docs.rs]
all-features = true

[lints.clippy]
dbg_macro = "deny"
print_stdout = "deny"
print_stderr = "deny"
# in general we lint against the pedantic group, but we will whitelist
# certain lints which we don't want to enforce (for now)
pedantic = { level = "deny", priority = -1 }
missing_errors_doc = "allow"
module_name_repetitions = "allow"
must_use_candidate = "allow"
if_not_else = "allow"
cast_lossless = "allow"
cast_possible_wrap = "allow"
cast_possible_truncation = "allow"
cast_precision_loss = "allow"
match_bool = "allow"
doc_markdown = "allow"
implicit_clone = "allow"
iter_without_into_iter = "allow"
return_self_not_must_use = "allow"
inline_always = "allow"  # TODO remove?
match_same_arms = "allow"  # TODO remove?

and these are logs :

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: d**ependency (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

this is the main cargo.toml within python3-jiter :

[workspace]
members = ["crates/jiter-python"]
resolver = "2"

[workspace.package]
authors = ["Samuel Colvin <samuel@pydantic.dev>"]
version = "0.4.1"
edition = "2021"
license = "MIT"
keywords = ["JSON", "parsing", "deserialization", "iter"]
categories = ["parser-implementations", "parsing"]
homepage = "https://github.com/pydantic/jiter/"
repository = "https://github.com/pydantic/jiter/"

[profile.bench]
debug = true
lto = true
opt-level = 3
codegen-units = 1

[profile.profiling]
inherits = "release"
debug = true

[workspace.dependencies]
pyo3 = { version = "0.21.0", default-features = false}

also this is the recipe :

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 1” 
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” 

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

Did you like my answer?

:+1: :-1:


The build issues you’re encountering with the Jiter 0.4.1 package in Yocto are primarily due to the unresolved pyo3 dependency. Here are some steps you can take to address these issues:

  1. Specify pyo3 Correctly: In your Cargo.toml files, ensure that the pyo3 dependency is specified with a valid version or path. It seems you have already specified a version for pyo3 in the Cargo.toml files, but you should double-check that the version is correct and available in the registry.

  2. Check Registry Availability: Verify that the pyo3 package version you are using is available in the crates.io registry. You can do this by visiting the crates.io website and searching for pyo3 to ensure the version 0.21.0 is available.

  3. Review Build Logs: The build logs indicate warnings about the pyo3 dependency being specified without a local path, Git repository, or version. Make sure that all instances of pyo3 in your Cargo.toml files are correctly specified with a version.

  4. Update Recipe: Ensure that your Yocto recipe is correctly set up to handle Rust dependencies. You might need to adjust the recipe to ensure it can fetch and build Rust dependencies properly.

  5. Optional Features: Since pyo3 is marked as optional in your Cargo.toml, ensure that the features that require pyo3 are enabled if they are necessary for your build.

By addressing these points, you should be able to resolve the build issues related to the pyo3 dependency. If the problem persists, consider reaching out to the maintainers of the Jiter package or the Yocto community for further assistance.

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

How to Bitbake Jitter Package with Yocto Image Using Rust and Cargo.

can u try to build it from your side and tell me exactly what u did cause i tried everything but didn’t work

i checked the crates.io and it exists with the right version

i used .whl file (precompiled binaries) instead of .tar and i was able to bitbake the recipe successfully

Hi @rania !

Thank you for sharing the solution!

We sent you an email. Please get back to us there when you have time.

Best regards,