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

Error on compilation for verifying MPC on macOS #11

Open
rex4539 opened this issue Nov 19, 2018 · 9 comments
Open

Error on compilation for verifying MPC on macOS #11

rex4539 opened this issue Nov 19, 2018 · 9 comments

Comments

@rex4539
Copy link

rex4539 commented Nov 19, 2018

$ 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.aaakk.us.kg-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.aaakk.us.kg-1ecc6299db9ec823/rustc-serialize-0.3.19/src/serialize.rs:147:45
    |
147 |                                             &f_name: &str,
    |                                             ^^^^^^^

error: aborting due to previous error
@rex4539 rex4539 changed the title Error verifying MPC on macOS Error on compilation for verifying MPC on macOS Nov 19, 2018
@saleemrashid
Copy link

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 (rust-lang/rust#37378) and imagine you can either

  1. Use an older version of Rust (1.12.1 being the version used at the time, IIRC)
  2. Update the rustc-serialize dependency to a more recent version that likely includes a bugfix

@rex4539
Copy link
Author

rex4539 commented Nov 19, 2018

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.aaakk.us.kg-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

@saleemrashid
Copy link

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.

@rex4539
Copy link
Author

rex4539 commented Nov 19, 2018

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.

@saleemrashid
Copy link

@rex4539 To be fair, I imagine most (if not all) of the developers of the MPC software use Linux.

@rex4539
Copy link
Author

rex4539 commented Nov 19, 2018

For the record, I already had gmp installed.

@ebfull
Copy link
Contributor

ebfull commented Nov 20, 2018

Try to compile this with rustc 1.12.1.

@rex4539
Copy link
Author

rex4539 commented Nov 21, 2018

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.

@MariusVanDerWijden
Copy link

I got it to work by installing libgmp3-dev

sudo apt-get install libgmp3-dev

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

No branches or pull requests

5 participants