Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no_std compilation #62

Closed
MabezDev opened this issue Oct 8, 2019 · 5 comments
Closed

no_std compilation #62

MabezDev opened this issue Oct 8, 2019 · 5 comments

Comments

@MabezDev
Copy link

MabezDev commented Oct 8, 2019

I'm having alot of trouble building this crate on a truly no_std platform (thumbv7m).

cargo build --no-default-features --features core_io --target=thumbv7m-none-eabi -j1

Initial findings are that yasna uses std, but beyond that there seems to be a whole heap of other issues like dev dependencies attempting to build and failing for that target (which I think it actually a cargo issue).

Edit: Looks like its mainly a cargo issue rust-lang/cargo#5730.

@jethrogb
Copy link
Member

jethrogb commented Oct 8, 2019

Hmm this is probably a failure of our CI to catch this. I see yasna went from an optional dependency to a required dependency a few weeks ago in 186268c. @jack-fortanix any comment?

Dev dependencies should be compiled for your host, so I'm not sure what's going on there.

@MabezDev
Copy link
Author

MabezDev commented Oct 8, 2019

$ cargo tree --no-default-features --features core_io --target=thumbv7m-none-eabi

mbedtls v0.4.0 (/home/mabez/development/rust/embedded/util/rust-mbedtls/mbedtls)
├── bitflags v1.1.0
├── byteorder v1.3.2
├── chrono v0.4.7
│   ├── libc v0.2.60
│   ├── num-integer v0.1.41
│   │   └── num-traits v0.2.8
│   │       [build-dependencies]
│   │       └── autocfg v0.1.6
│   │   [build-dependencies]
│   │   └── autocfg v0.1.6 (*)
│   ├── num-traits v0.2.8 (*)
│   └── time v0.1.42
│       └── libc v0.2.60 (*)
│       [dev-dependencies]
│       └── winapi v0.3.7
├── core_io v0.1.20190701
│   [build-dependencies]
│   └── rustc_version v0.1.7
│       └── semver v0.1.20
├── mbedtls-sys-auto v2.18.0 (/home/mabez/development/rust/embedded/util/rust-mbedtls/mbedtls-sys)
│   [build-dependencies]
│   ├── bindgen v0.19.1
│   │   ├── cexpr v0.2.3
│   │   │   └── nom v3.2.1
│   │   │       └── memchr v1.0.2
│   │   │           └── libc v0.2.60 (*)
│   │   ├── clang-sys v0.11.1
│   │   │   ├── bitflags v0.7.0
│   │   │   ├── glob v0.2.11
│   │   │   └── libc v0.2.60 (*)
│   │   │   [build-dependencies]
│   │   │   └── glob v0.2.11 (*)
│   │   ├── docopt v0.6.86
│   │   │   ├── lazy_static v0.2.11
│   │   │   ├── regex v0.1.80
│   │   │   │   ├── aho-corasick v0.5.3
│   │   │   │   │   └── memchr v0.1.11
│   │   │   │   │       └── libc v0.2.60 (*)
│   │   │   │   ├── memchr v0.1.11 (*)
│   │   │   │   ├── regex-syntax v0.3.9
│   │   │   │   ├── thread_local v0.2.7
│   │   │   │   │   └── thread-id v2.0.0
│   │   │   │   │       ├── kernel32-sys v0.2.2
│   │   │   │   │       │   └── winapi v0.2.8
│   │   │   │   │       │   [build-dependencies]
│   │   │   │   │       │   └── winapi-build v0.1.1
│   │   │   │   │       └── libc v0.2.60 (*)
│   │   │   │   └── utf8-ranges v0.1.3
│   │   │   ├── rustc-serialize v0.3.24
│   │   │   └── strsim v0.5.2
│   │   ├── env_logger v0.3.5
│   │   │   ├── log v0.3.9
│   │   │   │   └── log v0.4.7
│   │   │   │       └── cfg-if v0.1.9
│   │   │   └── regex v0.1.80 (*)
│   │   ├── libc v0.2.60 (*)
│   │   ├── log v0.3.9 (*)
│   │   ├── rustc-serialize v0.3.24 (*)
│   │   └── syntex_syntax v0.38.0
│   │       ├── bitflags v0.5.0
│   │       ├── libc v0.2.60 (*)
│   │       ├── log v0.3.9 (*)
│   │       ├── rustc-serialize v0.3.24 (*)
│   │       ├── syntex_errors v0.38.0
│   │       │   ├── libc v0.2.60 (*)
│   │       │   ├── log v0.3.9 (*)
│   │       │   ├── rustc-serialize v0.3.24 (*)
│   │       │   ├── syntex_pos v0.38.0
│   │       │   │   └── rustc-serialize v0.3.24 (*)
│   │       │   ├── term v0.4.6
│   │       │   └── unicode-xid v0.0.3
│   │       ├── syntex_pos v0.38.0 (*)
│   │       ├── term v0.4.6 (*)
│   │       └── unicode-xid v0.0.3 (*)
│   └── cmake v0.1.40
│       └── cc v1.0.37
└── serde v1.0.97
    └── serde_derive v1.0.97
        ├── proc-macro2 v0.4.30
        │   └── unicode-xid v0.1.0
        ├── quote v0.6.13
        │   └── proc-macro2 v0.4.30 (*)
        └── syn v0.15.39
            ├── proc-macro2 v0.4.30 (*)
            ├── quote v0.6.13 (*)
            └── unicode-xid v0.1.0 (*)
    [dev-dependencies]
    └── serde_derive v1.0.97 (*)
[build-dependencies]
└── cc v1.0.37 (*)
[dev-dependencies]
├── hex v0.3.2
├── libc v0.2.60 (*)
├── rand v0.4.6
└── serde_cbor v0.6.1
    ├── byteorder v1.3.2 (*)
    ├── serde v1.0.97 (*)
    └── serde_bytes v0.10.5
        └── serde v1.0.97 (*)

Firstly, I'm not sure how chrono is getting pulled in, as the only feature enabled is core_io. Secondly I think I am running into the cargo issue I linked in my first post, byte-order is pulled in by mbedtls, with default-features = false but in the dev-deps serde_cbor is also using byteorder but with std features. Cargo seems to assume they are the same crate and use the std enabled one in mbedtls

@jack-fortanix
Copy link
Contributor

Re yasna, we need the extensions parsing internally, but could gate use of yasna behind std. I'll open a PR

@jack-fortanix
Copy link
Contributor

Re chrono it is a hard dep since 9d82ad1 but shouldn't be - I think we only use it with custom_gmtime_r feature so it should only be pulled in then. @Goirad

jack-fortanix added a commit to jack-fortanix/rust-mbedtls that referenced this issue Oct 8, 2019
jack-fortanix added a commit to jack-fortanix/rust-mbedtls that referenced this issue Oct 8, 2019
jack-fortanix added a commit to jack-fortanix/rust-mbedtls that referenced this issue Oct 8, 2019
jack-fortanix added a commit to jack-fortanix/rust-mbedtls that referenced this issue Oct 9, 2019
bors bot added a commit that referenced this issue Oct 9, 2019
64: Make yasna optional again as it does not support no-std builds r=jethrogb a=jack-fortanix

See #62

Co-authored-by: Jack Lloyd <[email protected]>
bors bot added a commit that referenced this issue Oct 9, 2019
65: Only require chrono when we actually use it r=jethrogb a=jack-fortanix

See #62

Co-authored-by: Jack Lloyd <[email protected]>
@MabezDev
Copy link
Author

With resolver = "2" these issues should be fixed. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants