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 build sp1-sdk crate using cbindgen #386

Open
SyedAhkam opened this issue Feb 13, 2025 · 0 comments
Open

Unable to build sp1-sdk crate using cbindgen #386

SyedAhkam opened this issue Feb 13, 2025 · 0 comments

Comments

@SyedAhkam
Copy link

Hi,

Thanks so much for this incredible project. I was trying to use crate2nix to build my rust application using the sp1-sdk and one of their internal crates: sp1-core-machine which is using cbindgen is failing at their build.rs:137:23

I made one reproducible example repository for testing out the same.

Here is the exact error:

error: builder for '/nix/store/gl2m2hvac8j17px6icl9lrg2im44dnbf-rust_sp1-core-machine-4.0.0.drv' failed with exit code 101;
       last 23 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/j7aqrskg3pljyfk5y4f8rxz7klyaa5ip-sp1-core-machine-4.0.0.tar.gz
       > source root is sp1-core-machine-4.0.0
       > setting SOURCE_DATE_EPOCH to timestamp 1153704088 of file sp1-core-machine-4.0.0/src/utils/uni_stark.rs
       > Running phase: patchPhase
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > Running phase: configurePhase
       > Running cd .
       > Building build.rs (sp1_core_machine)
       > Running rustc --crate-name build_script_build build.rs --crate-type bin -C opt-level=3 -C codegen-units=1 --edition 2021 --cfg feature="default" --cfg feature="sys" --out-dir target/build/sp1-core-machine --emit=dep-info,link -L dependency=target/buildDeps --extern cbindgen=/nix/store/6x0d3vk4mh0rgl6c4fn802qj55nb8cm1-rust_cbindgen-0.27.0-lib/lib/libcbindgen-316b912204.rlib --extern cc=/nix/store/0l9m95mk9jmacas2imdgqvbfallqd38z-rust_cc-1.1.7-lib/lib/libcc-245984fd2c.rlib --extern glob=/nix/store/hyw9r6h55p1r711j1c0b8g0aaky8z18n-rust_glob-0.3.1-lib/lib/libglob-b71812539b.rlib --extern p3_baby_bear=/nix/store/4i9lzj65cb9v6g65lnrsmngn7qxp618d-rust_p3-baby-bear-0.2.0-succinct-lib/lib/libp3_baby_bear-0328d10cfd.rlib --extern pathdiff=/nix/store/zbbwpmzyy4b0xnzw4fzxb0d7jwh4ld5r-rust_pathdiff-0.2.3-lib/lib/libpathdiff-1f648996c1.rlib --extern sp1_primitives=/nix/store/nm09ah4jp9wyygnhrzd94mhgznym6jq1-rust_sp1-primitives-4.0.0-lib/lib/libsp1_primitives-72483d8531.rlib --extern sp1_stark=/nix/store/9i6klrlg0y6hi17v09yrg94gra5di4vv-rust_sp1-stark-4.0.0-lib/lib/libsp1_stark-8f36990352.rlib --cap-lints allow --color always
       > cargo::rerun-if-changed=include
       > cargo::rerun-if-changed=cpp
       > cargo::rerun-if-changed=src
       > cargo::rerun-if-changed=Cargo.toml
       > cargo::metadata=root=/build/sp1-core-machine-4.0.0/target/build/sp1-core-machine.out
       > cargo::metadata=include=/build/sp1-core-machine-4.0.0/target/build/sp1-core-machine.out/include
       > thread 'main' panicked at build.rs:137:23:
       > CargoMetadata("/build/sp1-core-machine-4.0.0/Cargo.toml", Metadata(Output { status: ExitStatus(unix_wait_status(25856)), stdout: "", stderr: "    Updating crates.io index\nwarning: spurious network error (3 tries remaining): [6] Could not resolve hostname (Could not resolve host: index.crates.io)\nwarning: spurious network error (2 tries remaining): [6] Could not resolve hostname (Could not resolve host: index.crates.io)\nwarning: spurious network error (1 tries remaining): [6] Could not resolve hostname (Could not resolve host: index.crates.io)\nerror: failed to get `snowbridge-amcl` as a dependency of package `sp1-core-machine v4.0.0 (/build/sp1-core-machine-4.0.0)`\n\nCaused by:\n  download of config.json failed\n\nCaused by:\n  failed to download from `https://index.crates.io/config.json`\n\nCaused by:\n  [6] Could not resolve hostname (Could not resolve host: index.crates.io)\n" }))
       > stack backtrace:
       >    0: rust_begin_unwind
       >    1: core::panicking::panic_fmt
       >    2: build_script_build::sys::build_ffi
       > note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
       For full logs, run 'nix log /nix/store/gl2m2hvac8j17px6icl9lrg2im44dnbf-rust_sp1-core-machine-4.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/qd97vkkc37cc7cacws2r1vn3mpr3r4k2-rust_fibonacci-script-0.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/r4qlr6f4fz2qfn78i0aw5im7g27x2d8j-all-workspace-members.drv' failed to build

I figured this has to do with network sandboxing, then I tried the same with

nix build -f Cargo.nix rootCrate.build --impure --option sandbox false

But even this did not work. It then complains of SSL certificates. Then I tried to pull in a hack using nix-shell with cacert configured-- even that did not help.

I would really appreciate some help or pointers here!

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

No branches or pull requests

1 participant