trait bound error when using jsonref crate
03:16 28 Nov 2025

I'm using jsonref crate which internally uses rustls crate. When compiling rustls crate it fails in QNX platform, but builds successfully in Linux platform. Below is the error message

Error

2025-11-27T13:59:59.474608124Z | error[E0277]: the trait bound `SystemRandom: ring::rand::SecureRandom` is not satisfied
2025-11-27T13:59:59.474610477Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/sign.rs:182:34
2025-11-27T13:59:59.474612374Z |     |
2025-11-27T13:59:59.47461476Z | 182 |             .sign(self.encoding, &rng, message, &mut sig)
2025-11-27T13:59:59.474617088Z |     |                                  ^^^^ the trait `ring::rand::sealed::SecureRandom` is not implemented for `SystemRandom`
2025-11-27T13:59:59.474618968Z |     |
2025-11-27T13:59:59.474621155Z |     = help: the following other types implement trait `ring::rand::sealed::SecureRandom`:
2025-11-27T13:59:59.474623617Z |               ring::testutil::rand::FixedByteRandom
2025-11-27T13:59:59.474625829Z |               ring::testutil::rand::FixedSliceRandom<'_>
2025-11-27T13:59:59.474627772Z |               ring::testutil::rand::FixedSliceSequenceRandom<'_>
2025-11-27T13:59:59.474629646Z |     = note: required for `SystemRandom` to implement `ring::rand::SecureRandom`
2025-11-27T13:59:59.474631639Z |     = note: required for the cast from `&SystemRandom` to `&dyn ring::rand::SecureRandom`
2025-11-27T13:59:59.474633506Z | 
2025-11-27T13:59:59.47463723Z | error[E0277]: the trait bound `SystemRandom: ring::rand::SecureRandom` is not satisfied
2025-11-27T13:59:59.474639253Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/sign.rs:228:85
2025-11-27T13:59:59.474641149Z |     |
2025-11-27T13:59:59.474643587Z | 228 |                 Self::convert_sec1_to_pkcs8(scheme, sigalg, sec1.secret_sec1_der(), &rng)?
2025-11-27T13:59:59.474645523Z |     |                                                                                     ^^^^ the trait `ring::rand::sealed::SecureRandom` is not implemented for `SystemRandom`
2025-11-27T13:59:59.474647384Z |     |
2025-11-27T13:59:59.474649424Z |     = help: the following other types implement trait `ring::rand::sealed::SecureRandom`:
2025-11-27T13:59:59.474651361Z |               ring::testutil::rand::FixedByteRandom
2025-11-27T13:59:59.474653332Z |               ring::testutil::rand::FixedSliceRandom<'_>
2025-11-27T13:59:59.47465532Z |               ring::testutil::rand::FixedSliceSequenceRandom<'_>
2025-11-27T13:59:59.474657461Z |     = note: required for `SystemRandom` to implement `ring::rand::SecureRandom`
2025-11-27T13:59:59.474659377Z |     = note: required for the cast from `&SystemRandom` to `&dyn ring::rand::SecureRandom`
2025-11-27T13:59:59.474661306Z | 
2025-11-27T13:59:59.474663182Z | error[E0277]: the trait bound `SystemRandom: ring::rand::SecureRandom` is not satisfied
2025-11-27T13:59:59.474665424Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/sign.rs:231:76
2025-11-27T13:59:59.474667279Z |     |
2025-11-27T13:59:59.474669461Z | 231 |                 EcdsaKeyPair::from_pkcs8(sigalg, pkcs8.secret_pkcs8_der(), &rng).map_err(|_| ())?
2025-11-27T13:59:59.474671958Z |     |                                                                            ^^^^ the trait `ring::rand::sealed::SecureRandom` is not implemented for `SystemRandom`
2025-11-27T13:59:59.474673792Z |     |
2025-11-27T13:59:59.474676048Z |     = help: the following other types implement trait `ring::rand::sealed::SecureRandom`:
2025-11-27T13:59:59.474677971Z |               ring::testutil::rand::FixedByteRandom
2025-11-27T13:59:59.47468955Z |               ring::testutil::rand::FixedSliceRandom<'_>
2025-11-27T13:59:59.474691788Z |               ring::testutil::rand::FixedSliceSequenceRandom<'_>
2025-11-27T13:59:59.474693687Z |     = note: required for `SystemRandom` to implement `ring::rand::SecureRandom`
2025-11-27T13:59:59.474695547Z |     = note: required for the cast from `&SystemRandom` to `&dyn ring::rand::SecureRandom`
2025-11-27T13:59:59.474697448Z | 
2025-11-27T13:59:59.474699309Z | error[E0277]: the trait bound `SystemRandom: ring::rand::SecureRandom` is not satisfied
2025-11-27T13:59:59.474701167Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/sign.rs:328:19
2025-11-27T13:59:59.474703488Z |     |
2025-11-27T13:59:59.474705348Z | 328 |             .sign(&rng, message)
2025-11-27T13:59:59.474707334Z |     |                   ^^^^ the trait `ring::rand::sealed::SecureRandom` is not implemented for `SystemRandom`
2025-11-27T13:59:59.474709151Z |     |
2025-11-27T13:59:59.4747113Z |     = help: the following other types implement trait `ring::rand::sealed::SecureRandom`:
2025-11-27T13:59:59.474713263Z |               ring::testutil::rand::FixedByteRandom
2025-11-27T13:59:59.474715211Z |               ring::testutil::rand::FixedSliceRandom<'_>
2025-11-27T13:59:59.474719033Z |               ring::testutil::rand::FixedSliceSequenceRandom<'_>
2025-11-27T13:59:59.474720881Z |     = note: required for `SystemRandom` to implement `ring::rand::SecureRandom`
2025-11-27T13:59:59.474722779Z |     = note: required for the cast from `&SystemRandom` to `&dyn ring::rand::SecureRandom`
2025-11-27T13:59:59.474724733Z | 
2025-11-27T13:59:59.474726625Z | error[E0277]: the trait bound `SystemRandom: ring::rand::SecureRandom` is not satisfied
2025-11-27T13:59:59.474728569Z |   --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/kx.rs:45:91
2025-11-27T13:59:59.474730412Z |    |
2025-11-27T13:59:59.474732414Z | 45 |         let priv_key = agreement::EphemeralPrivateKey::generate(self.agreement_algorithm, &rng)
2025-11-27T13:59:59.474734414Z |    |                                                                                           ^^^^ the trait `ring::rand::sealed::SecureRandom` is not implemented for `SystemRandom`
2025-11-27T13:59:59.474736247Z |    |
2025-11-27T13:59:59.47473843Z |    = help: the following other types implement trait `ring::rand::sealed::SecureRandom`:
2025-11-27T13:59:59.474740493Z |              ring::testutil::rand::FixedByteRandom
2025-11-27T13:59:59.474742438Z |              ring::testutil::rand::FixedSliceRandom<'_>
2025-11-27T13:59:59.474744492Z |              ring::testutil::rand::FixedSliceSequenceRandom<'_>
2025-11-27T13:59:59.474746423Z |    = note: required for `SystemRandom` to implement `ring::rand::SecureRandom`
2025-11-27T13:59:59.47474829Z |    = note: required for the cast from `&SystemRandom` to `&dyn ring::rand::SecureRandom`
2025-11-27T13:59:59.474750216Z | 
2025-11-27T13:59:59.474752193Z | error[E0599]: the method `fill` exists for struct `SystemRandom`, but its trait bounds were not satisfied
2025-11-27T13:59:59.474754187Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/ticketer.rs:65:14
2025-11-27T13:59:59.474756036Z |     |
2025-11-27T13:59:59.474757999Z | 64  | /         SystemRandom::new()
2025-11-27T13:59:59.474759856Z | 65  | |             .fill(&mut key)
2025-11-27T13:59:59.474761811Z |     | |             -^^^^ method cannot be called on `SystemRandom` due to unsatisfied trait bounds
2025-11-27T13:59:59.474764135Z |     | |_____________|
2025-11-27T13:59:59.474766003Z |     |
2025-11-27T13:59:59.474767843Z |     |
2025-11-27T13:59:59.474769807Z |    ::: /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/src/rand.rs:109:1
2025-11-27T13:59:59.474771647Z |     |
2025-11-27T13:59:59.474773534Z | 109 |   pub struct SystemRandom(());
2025-11-27T13:59:59.474775919Z |     |   ----------------------- doesn't satisfy `SystemRandom: ring::rand::SecureRandom` or `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474777742Z |     |
2025-11-27T13:59:59.474779668Z |     = note: the following trait bounds were not satisfied:
2025-11-27T13:59:59.47478162Z |             `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474783761Z |             which is required by `SystemRandom: ring::rand::SecureRandom`
2025-11-27T13:59:59.474785613Z |     = help: items from traits can only be used if the trait is implemented and in scope
2025-11-27T13:59:59.474787481Z | note: `crypto::SecureRandom` defines an item `fill`, perhaps you need to implement it
2025-11-27T13:59:59.474789472Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/mod.rs:311:1
2025-11-27T13:59:59.474793163Z |     |
2025-11-27T13:59:59.47479514Z | 311 | pub trait SecureRandom: Send + Sync + Debug {
2025-11-27T13:59:59.474797338Z |     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-27T13:59:59.474799179Z | 
2025-11-27T13:59:59.47480114Z | error[E0599]: the method `fill` exists for struct `SystemRandom`, but its trait bounds were not satisfied
2025-11-27T13:59:59.4748031Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/ticketer.rs:72:14
2025-11-27T13:59:59.474805057Z |     |
2025-11-27T13:59:59.47481625Z | 71  | /         SystemRandom::new()
2025-11-27T13:59:59.474818399Z | 72  | |             .fill(&mut key_name)
2025-11-27T13:59:59.474820378Z |     | |             -^^^^ method cannot be called on `SystemRandom` due to unsatisfied trait bounds
2025-11-27T13:59:59.474822226Z |     | |_____________|
2025-11-27T13:59:59.474824039Z |     |
2025-11-27T13:59:59.474825885Z |     |
2025-11-27T13:59:59.474827862Z |    ::: /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/src/rand.rs:109:1
2025-11-27T13:59:59.474830314Z |     |
2025-11-27T13:59:59.47483218Z | 109 |   pub struct SystemRandom(());
2025-11-27T13:59:59.474834194Z |     |   ----------------------- doesn't satisfy `SystemRandom: ring::rand::SecureRandom` or `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474836014Z |     |
2025-11-27T13:59:59.474837969Z |     = note: the following trait bounds were not satisfied:
2025-11-27T13:59:59.474839811Z |             `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474841797Z |             which is required by `SystemRandom: ring::rand::SecureRandom`
2025-11-27T13:59:59.474843688Z |     = help: items from traits can only be used if the trait is implemented and in scope
2025-11-27T13:59:59.474845566Z | note: `crypto::SecureRandom` defines an item `fill`, perhaps you need to implement it
2025-11-27T13:59:59.474847711Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/mod.rs:311:1
2025-11-27T13:59:59.474849528Z |     |
2025-11-27T13:59:59.474851374Z | 311 | pub trait SecureRandom: Send + Sync + Debug {
2025-11-27T13:59:59.474853325Z |     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-27T13:59:59.474855179Z | 
2025-11-27T13:59:59.474857226Z | error[E0599]: the method `fill` exists for struct `SystemRandom`, but its trait bounds were not satisfied
2025-11-27T13:59:59.474859068Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/ticketer.rs:99:14
2025-11-27T13:59:59.474860903Z |     |
2025-11-27T13:59:59.474862792Z | 98  | /         SystemRandom::new()
2025-11-27T13:59:59.474866748Z | 99  | |             .fill(&mut nonce_buf)
2025-11-27T13:59:59.474868764Z |     | |             -^^^^ method cannot be called on `SystemRandom` due to unsatisfied trait bounds
2025-11-27T13:59:59.474870622Z |     | |_____________|
2025-11-27T13:59:59.474872439Z |     |
2025-11-27T13:59:59.474874272Z |     |
2025-11-27T13:59:59.474876225Z |    ::: /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/src/rand.rs:109:1
2025-11-27T13:59:59.474878094Z |     |
2025-11-27T13:59:59.47488Z | 109 |   pub struct SystemRandom(());
2025-11-27T13:59:59.474883774Z |     |   ----------------------- doesn't satisfy `SystemRandom: ring::rand::SecureRandom` or `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474885644Z |     |
2025-11-27T13:59:59.47488766Z |     = note: the following trait bounds were not satisfied:
2025-11-27T13:59:59.474889604Z |             `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474891581Z |             which is required by `SystemRandom: ring::rand::SecureRandom`
2025-11-27T13:59:59.474895311Z |     = help: items from traits can only be used if the trait is implemented and in scope
2025-11-27T13:59:59.474897315Z | note: `crypto::SecureRandom` defines an item `fill`, perhaps you need to implement it
2025-11-27T13:59:59.47489929Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/mod.rs:311:1
2025-11-27T13:59:59.47490116Z |     |
2025-11-27T13:59:59.47490313Z | 311 | pub trait SecureRandom: Send + Sync + Debug {
2025-11-27T13:59:59.474905078Z |     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-27T13:59:59.474906984Z | 
2025-11-27T13:59:59.474908983Z | error[E0599]: the method `fill` exists for struct `SystemRandom`, but its trait bounds were not satisfied
2025-11-27T13:59:59.474910923Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/ring/mod.rs:50:14
2025-11-27T13:59:59.47491283Z |     |
2025-11-27T13:59:59.474914818Z | 49  | /         ring_like::rand::SystemRandom::new()
2025-11-27T13:59:59.474916755Z | 50  | |             .fill(buf)
2025-11-27T13:59:59.474918762Z |     | |             -^^^^ method cannot be called on `SystemRandom` due to unsatisfied trait bounds
2025-11-27T13:59:59.474920614Z |     | |_____________|
2025-11-27T13:59:59.47492255Z |     |
2025-11-27T13:59:59.474924383Z |     |
2025-11-27T13:59:59.474926334Z |    ::: /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.14/src/rand.rs:109:1
2025-11-27T13:59:59.474928186Z |     |
2025-11-27T13:59:59.474930097Z | 109 |   pub struct SystemRandom(());
2025-11-27T13:59:59.474932089Z |     |   ----------------------- doesn't satisfy `SystemRandom: ring::rand::SecureRandom` or `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474933923Z |     |
2025-11-27T13:59:59.474935879Z |     = note: the following trait bounds were not satisfied:
2025-11-27T13:59:59.474937824Z |             `SystemRandom: ring::rand::sealed::SecureRandom`
2025-11-27T13:59:59.474939766Z |             which is required by `SystemRandom: ring::rand::SecureRandom`
2025-11-27T13:59:59.474941703Z |     = help: items from traits can only be used if the trait is implemented and in scope
2025-11-27T13:59:59.474954344Z | note: `crypto::SecureRandom` defines an item `fill`, perhaps you need to implement it
2025-11-27T13:59:59.474956576Z |    --> /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/crypto/mod.rs:311:1
2025-11-27T13:59:59.474958423Z |     |
2025-11-27T13:59:59.474960474Z | 311 | pub trait SecureRandom: Send + Sync + Debug {
2025-11-27T13:59:59.47496241Z |     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-27T13:59:59.474964274Z | 
2025-11-27T13:59:59.474966462Z | Some errors have detailed explanations: E0277, E0599.
2025-11-27T13:59:59.474968617Z | For more information about an error, try `rustc --explain E0277`.
2025-11-27T13:59:59.474970671Z | error: could not compile `rustls` (lib) due to 9 previous errors
2025-11-27T13:59:59.474974209Z | 
2025-11-27T13:59:59.474976138Z | Caused by:
2025-11-27T13:59:59.474982846Z |   process didn't exit successfully: `rustc --crate-name rustls --edition=2021 /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/cargo_home/registry/src/index.crates.io-1949cf8c6b5b557f/rustls-0.23.35/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 --warn=unexpected_cfgs --check-cfg 'cfg(bench)' --check-cfg 'cfg(coverage_nightly)' --check-cfg 'cfg(read_buf)' --check-cfg 'cfg(rustls_docsrs)' --cfg 'feature="log"' --cfg 'feature="logging"' --cfg 'feature="ring"' --cfg 'feature="std"' --cfg 'feature="tls12"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("aws-lc-rs", "aws_lc_rs", "brotli", "custom-provider", "default", "fips", "hashbrown", "log", "logging", "prefer-post-quantum", "read_buf", "ring", "rustversion", "std", "tls12", "zlib"))' -C metadata=8589098c8533034c -C extra-filename=-3ebe2dac34703d48 --out-dir /workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps --target aarch64-unknown-nto-qnx800 -C linker=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/wrappers/linker-wrapper.sh -L dependency=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps -L dependency=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/release/deps --extern log=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/liblog-ef575cfbc157f0d0.rmeta --extern once_cell=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/libonce_cell-96dd58d449594cc3.rmeta --extern ring=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/libring-16bf29e698babb36.rmeta --extern pki_types=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/librustls_pki_types-8a817bbed5bfd0e9.rmeta --extern webpki=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/libwebpki-a5ca0f5d076bc561.rmeta --extern subtle=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/libsubtle-e8663cfd38a80d17.rmeta --extern zeroize=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/deps/libzeroize-a3d77fe09baf665c.rmeta --cap-lints allow -L native=/workspace/poky/build/tmp/work/cortexa57-poky-linux/dabba/daci451/target/aarch64-unknown-nto-qnx800/release/build/ring-bbdaa43a2abe0fcf/out` (exit status: 1)

I'm using Rust version 1.88

rust qnx json-ref