mpc
mpc copied to clipboard
Error on compilation for verifying MPC on macOS
$ RUST_BACKTRACE=1 cargo run --release --bin verifier
Compiling rustc-serialize v0.3.19
Compiling snark v0.0.1 (/Users/rex/zcash-mpc/snark)
error: failed to run custom build command for `snark v0.0.1 (/Users/rex/zcash-mpc/snark)`
process didn't exit successfully: `/Users/rex/zcash-mpc/target/release/build/snark-5cecc86d88ffe278/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=gmp
cargo:rustc-link-lib=gmpxx
cargo:rustc-link-lib=sodium
TARGET = Some("x86_64-apple-darwin")
PROFILE = Some("release")
TARGET = Some("x86_64-apple-darwin")
debug=false opt-level=2
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXX_x86_64-apple-darwin = None
CXX_x86_64_apple_darwin = None
HOST_CXX = None
CXX = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXXFLAGS_x86_64-apple-darwin = None
CXXFLAGS_x86_64_apple_darwin = None
HOST_CXXFLAGS = None
CXXFLAGS = None
running: "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-m64" "-fPIC" "-I" "libsnark/src" "-std=c++11" "-DNO_PROCPS" "-DSTATIC" "-DMONTGOMERY_OUTPUT" "-DUSE_ASM" "-DNO_PT_COMPRESSION" "-DBINARY_OUTPUT" "-DCURVE_ALT_BN128" "-o" "/Users/rex/zcash-mpc/target/release/build/snark-b2915c2d3ab65dd4/out/libsnark/src/common/utils.o" "-c" "libsnark/src/common/utils.cpp"
cargo:warning=clang: error: no such file or directory: 'libsnark/src/common/utils.cpp'
cargo:warning=clang: error: no input files
ExitStatus(ExitStatus(256))
command did not execute successfully, got: exit code: 1
--- stderr
thread 'main' panicked at 'explicit panic', /Users/rex/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.35/src/lib.rs:897:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::begin_panic
6: gcc::fail
7: gcc::run
8: gcc::Config::compile
9: build_script_build::main
10: std::rt::lang_start::{{closure}}
11: std::panicking::try::do_call
12: __rust_maybe_catch_panic
13: std::rt::lang_start_internal
14: main
warning: build failed, waiting for other jobs to finish...
error[E0642]: patterns aren't allowed in methods without bodies
--> /Users/rex/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.19/src/serialize.rs:147:45
|
147 | &f_name: &str,
| ^^^^^^^
error: aborting due to previous error
Executing git submodule update --init --recursive
should resolve the first issue (it will download the libsnark submodule)
I believe the latter issue is caused by this compiler bugfix (https://github.com/rust-lang/rust/pull/37378) and imagine you can either
- Use an older version of Rust (1.12.1 being the version used at the time, IIRC)
- Update the rustc-serialize dependency to a more recent version that likely includes a bugfix
After updating rustic-serialize
it now fails here.
$ RUST_BACKTRACE=1 cargo run --release --bin verifier
Compiling snark v0.0.1 (/Users/rex/zcash-mpc/snark)
error: failed to run custom build command for `snark v0.0.1 (/Users/rex/zcash-mpc/snark)`
process didn't exit successfully: `/Users/rex/zcash-mpc/target/release/build/snark-0e104ed8dcaedfae/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-lib=gmp
cargo:rustc-link-lib=gmpxx
cargo:rustc-link-lib=sodium
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXX_x86_64-apple-darwin = None
CXX_x86_64_apple_darwin = None
HOST_CXX = None
CXX = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXXFLAGS_x86_64-apple-darwin = None
CXXFLAGS_x86_64_apple_darwin = None
HOST_CXXFLAGS = None
CXXFLAGS = None
DEBUG = Some("false")
running: "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "libsnark/src" "-std=c++11" "-DNO_PROCPS" "-DSTATIC" "-DMONTGOMERY_OUTPUT" "-DUSE_ASM" "-DNO_PT_COMPRESSION" "-DBINARY_OUTPUT" "-DCURVE_ALT_BN128" "-Wall" "-Wextra" "-o" "/Users/rex/zcash-mpc/target/release/build/snark-543073c6bcf5ae7f/out/libsnark/src/common/utils.o" "-c" "libsnark/src/common/utils.cpp"
exit code: 0
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXX_x86_64-apple-darwin = None
CXX_x86_64_apple_darwin = None
HOST_CXX = None
CXX = None
HOST = Some("x86_64-apple-darwin")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CXXFLAGS_x86_64-apple-darwin = None
CXXFLAGS_x86_64_apple_darwin = None
HOST_CXXFLAGS = None
CXXFLAGS = None
DEBUG = Some("false")
running: "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "libsnark/src" "-std=c++11" "-DNO_PROCPS" "-DSTATIC" "-DMONTGOMERY_OUTPUT" "-DUSE_ASM" "-DNO_PT_COMPRESSION" "-DBINARY_OUTPUT" "-DCURVE_ALT_BN128" "-Wall" "-Wextra" "-o" "/Users/rex/zcash-mpc/target/release/build/snark-543073c6bcf5ae7f/out/libsnark/src/common/profiling.o" "-c" "libsnark/src/common/profiling.cpp"
cargo:warning=In file included from libsnark/src/common/profiling.cpp:22:
cargo:warning=In file included from libsnark/src/common/default_types/ec_pp.hpp:19:
cargo:warning=In file included from libsnark/src/algebra/curves/alt_bn128/alt_bn128_pp.hpp:11:
cargo:warning=In file included from libsnark/src/algebra/curves/alt_bn128/alt_bn128_init.hpp:11:
cargo:warning=In file included from libsnark/src/algebra/fields/fp.hpp:13:
cargo:warning=libsnark/src/algebra/fields/bigint.hpp:14:10: fatal error: 'gmp.h' file not found
cargo:warning=#include <gmp.h>
cargo:warning= ^~~~~~~
cargo:warning=1 error generated.
exit code: 1
--- stderr
thread 'main' panicked at '
Internal error occurred: Command "c++" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "libsnark/src" "-std=c++11" "-DNO_PROCPS" "-DSTATIC" "-DMONTGOMERY_OUTPUT" "-DUSE_ASM" "-DNO_PT_COMPRESSION" "-DBINARY_OUTPUT" "-DCURVE_ALT_BN128" "-Wall" "-Wextra" "-o" "/Users/rex/zcash-mpc/target/release/build/snark-543073c6bcf5ae7f/out/libsnark/src/common/profiling.o" "-c" "libsnark/src/common/profiling.cpp" with args "c++" did not execute successfully (status code exit code: 1).
', /Users/rex/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.55/src/lib.rs:1672:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
1: std::sys_common::backtrace::_print
2: std::panicking::default_hook::{{closure}}
3: std::panicking::default_hook
4: std::panicking::rust_panic_with_hook
5: std::panicking::continue_panic_fmt
6: std::panicking::begin_panic_fmt
7: gcc::fail
8: gcc::Build::compile
9: build_script_build::main
10: std::rt::lang_start::{{closure}}
11: std::panicking::try::do_call
12: __rust_maybe_catch_panic
13: std::rt::lang_start_internal
14: main
You need the development headers for GMP. I'm not a macOS user so take this advice with a metric ton of salt, but something to the effect of brew install gmp
should work.
Can somebody write down the exact steps to run this thing? :)
It's crazy to go step by step and find problems that nobody has ever tested.
@rex4539 To be fair, I imagine most (if not all) of the developers of the MPC software use Linux.
For the record, I already had gmp
installed.
Try to compile this with rustc 1.12.1
.
Same error fatal error: 'gmp.h' file not found
Somehow it expects to find it in /usr/local/include
but MacPorts installs it in /opt/local/include
Even if I force install it in /usr/local/include
then I get ld: library not found for -lgmpxx
when compiling mpc
. And all the libgmp
files are already installed in /usr/local/lib
Any ideas are greatly appreciated.
I got it to work by installing libgmp3-dev
sudo apt-get install libgmp3-dev