heapless icon indicating copy to clipboard operation
heapless copied to clipboard

Build error when compiling with `esp-idf`

Open SeaRoll opened this issue 4 months ago • 7 comments

I get this error:

error[E0223]: ambiguous associated type
   --> /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/heapless-0.9.1/src/c_string.rs:181:17
    |
181 |             Err(FromBytesWithNulError::InteriorNul { position }) => {
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: if there were a trait named `Example` with associated type `InteriorNul` implemented for `FromBytesWithNulError`, you could use the fully-qualified path
    |
181 |             Err(<FromBytesWithNulError as Example>::InteriorNul { position }) => {
    |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0599]: no associated item named `NotNulTerminated` found for struct `FromBytesWithNulError` in the current scope
   --> /home/esp/.cargo/registry/src/index.crates.io-6f17d22bba15001f/heapless-0.9.1/src/c_string.rs:184:40
    |
184 |             Err(FromBytesWithNulError::NotNulTerminated) => {
    |                                        ^^^^^^^^^^^^^^^^ associated item not found in `FromBytesWithNulError`

Which seems to be coming from this package.

This happens when using with HistoryBuf to be more exact

SeaRoll avatar Aug 25 '25 10:08 SeaRoll

How are you building your software to obtain this error? It looks like some types from the standard library have been modified. Which version of the Rust compiler are you using?

sgued avatar Aug 27 '25 10:08 sgued

It's the esp-idf toolchain for std rust that can be found here

SeaRoll avatar Aug 28 '25 00:08 SeaRoll

For reference is that version 0.8.0 worked flawlessly with the beforehand named HistoryBuffer

SeaRoll avatar Aug 28 '25 00:08 SeaRoll

Looks like this is an issue coming from the fork of std used by the esp compiler. It looks like it has been fixed in version 1.89 of the fork: 

https://github.com/esp-rs/rust/commit/2f5a3d4b06a0a9e8749c2e361758ec517df0c96a

It's available as a pre-release. Please test that: https://github.com/esp-rs/rust-build/releases/tag/v1.89.0.0

sgued avatar Aug 29 '25 12:08 sgued

will do and report back on monday-tuesday

SeaRoll avatar Aug 29 '25 23:08 SeaRoll

Have you been able to check back?

sosthene-nitrokey avatar Sep 05 '25 08:09 sosthene-nitrokey

Had some talk with my guys and there were some complication that prevented us from using that specific build, so it's a bit tricky.

SeaRoll avatar Sep 06 '25 00:09 SeaRoll