Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The standard library is still required with `default-features = false` on bincode

I’m trying to use the bincode crate. As it’s default features, it uses the standard library, but I’m working in a no_std environment. I’ve added default-features = false to my Cargo.toml, but it still doesn’t compile.

My dependencies:

[package]
name = "fsys"
version = "0.1.0"
edition = "2021"

[dependencies]
bincode = { version = "1.3.3", default-features = false}

This doesn’t make any sense to me. The std feature of bincode is disabled, yet it still tries to build it’s dependencies with the standard library.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Here’s the shorter version of the error message:

   Compiling serde v1.0.182
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-cos` target may not support the standard library
  = note: `std` is required by `serde` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

The original error message is this, but followed by 20K lines of failed std imports.

>Solution :

bincode does not have the std feature flag in version 1.3.3, as can be seen here.

You probably want to use version 2.0.0 which is only available as a release candidate at the moment, but offers support for #![no_std].

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading