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

Unable to compile with -Z build-std #1659

Open
illuzen opened this issue Jan 30, 2025 · 4 comments
Open

Unable to compile with -Z build-std #1659

illuzen opened this issue Jan 30, 2025 · 4 comments

Comments

@illuzen
Copy link

illuzen commented Jan 30, 2025

Hello,

we are trying to use plonky2 in a substrate chain, and we have proofs verifying when tested in isolation, but we are unable to build the chain as a whole.

If we could compile plonky2 with cargo build -Z build-std --target wasm32-unknown-unknown that would solve our issues. Currently if you try that, you get

error[E0152]: duplicate lang item in crate `core`: `sized`
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from plonky2/target/wasm32-unknown-unknown/debug/deps/libcore-1bda2c0fe1509098.rlib,plonky2/target/wasm32-unknown-unknown/debug/deps/libcore-1bda2c0fe1509098.rmeta
  = note: second definition in `core` loaded from .rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcore-ca9fe48a49de91a5.rlib

For more information about this error, try `rustc --explain E0152`.
error: could not compile `plonky2` (bin "generate_constants") due to 1 previous error

Any suggestions?

@github-project-automation github-project-automation bot moved this to Backlog in Zero EVM Jan 30, 2025
@illuzen illuzen changed the title Serde-off feature flag? Unable to compile with -Z build-std Feb 10, 2025
@illuzen
Copy link
Author

illuzen commented Feb 10, 2025

ping

@illuzen
Copy link
Author

illuzen commented Feb 12, 2025

ok new info, compiling with

-Z build-std=std,panic_abort

works across all packages, but =std and =panic_abort do not, they both complain about duplicate versions of core from

/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/wasm32-unknown-unknown/lib/libcore-ca9fe48a49de91a5.rlib

and

plonky2/target/wasm32-unknown-unknown/debug/deps/libcore-1bda2c0fe1509098.rlib

Any suggestions guys?

@illuzen
Copy link
Author

illuzen commented Feb 12, 2025

The real command I want to run is this

env -u CARGO_ENCODED_RUSTFLAGS -u RUSTC CARGO_MAKEFLAGS="-j --jobserver-fds=8,9 --jobserver-auth=8,9" CARGO_TARGET_DIR="..." RUSTFLAGS="-C target-cpu=mvp -C target-feature=-sign-ext -C link-arg=--export-table -Clink-arg=--export=__heap_base -C link-arg=--import-memory --cfg substrate_runtime " SKIP_WASM_BUILD="" "~/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=..." "--color=always" "--profile" "release" "-Z" "build-std"

@illuzen
Copy link
Author

illuzen commented Feb 13, 2025

I posted this issue on the rust-lang repo, a reply seems to indicate that it is in fact a bug with -Z build-std

rust-lang/wg-cargo-std-aware#93

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

No branches or pull requests

1 participant