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

Fix no_std builds attempt 2 #78

Merged
merged 3 commits into from
Sep 13, 2021
Merged

Conversation

trevor-crypto
Copy link
Contributor

@trevor-crypto trevor-crypto commented Aug 25, 2021

  • Turn off default features for core in gen and genmult
  • Use resolver="2"

Relates to #71

- Turn off default features for core in gen and genmult
- Use serde-json-core (no_std support) in dev-dependencies

Relates to paritytech#71
Allows us to use serde_json in dev-dependencies and compile for no_std:

https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver
@athei
Copy link
Member

athei commented Sep 13, 2021

The CI should check whether no_std builds are working. Any idea why this wasn't caught there?

@athei athei requested a review from sorpaas September 13, 2021 09:28
@@ -7,6 +7,7 @@ authors = ["Wei Tang <hi@that.world>"]
repository = "https://github.com/paritytech/libsecp256k1"
keywords = ["crypto", "ECDSA", "secp256k1", "bitcoin", "no_std"]
edition = "2018"
resolver = "2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be enough. Please revert the rest of the changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@trevor-crypto
Copy link
Contributor Author

trevor-crypto commented Sep 13, 2021

The CI should check whether no_std builds are working. Any idea why this wasn't caught there?

@athei I don't think that actually checks against a no-std target. You need to add a target like thumbv6m-none-eabi and build for no_std with cargo build --target thumbv6m-none-eabi --no-default-features

@sorpaas sorpaas merged commit 765b291 into paritytech:develop Sep 13, 2021
@trevor-crypto trevor-crypto deleted the no-std-fix branch September 13, 2021 10:07
@athei
Copy link
Member

athei commented Sep 13, 2021

The only difference I see is that your command line is cross compiling where the CI does not. Both use --no-default-features. It that correct?

@trevor-crypto
Copy link
Contributor Author

@athei they both use --no-default-features but that doesn't guarantee that the library will build successfully for a target without std. You can also use something like https://github.com/hobofan/cargo-nono to do a check

trevor-crypto added a commit to monacohq/libsecp256k1 that referenced this pull request May 31, 2022
* Fix no_std builds attempt 2

- Turn off default features for core in gen and genmult
- Use serde-json-core (no_std support) in dev-dependencies

Relates to paritytech#71

* Use resolver="2"

Allows us to use serde_json in dev-dependencies and compile for no_std:

https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver

* revert unnecessary changes
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 this pull request may close these issues.

3 participants