hyperledger-archives / indy-sdk

indy-sdk
https://wiki.hyperledger.org/display/indy
Apache License 2.0
668 stars 735 forks source link

Unable to compile Indy from source #999

Closed xtrycatchx closed 6 years ago

xtrycatchx commented 6 years ago
OS: Mac OS 10.13.6 (17G65)
Cargo: 0.26.0 (41480f5cc 2018-02-26)
Openssl: 1.0.2m
Rustc: 1.27.0-nightly (2f2a11dfc 2018-05-16)

Steps:

git clone https://github.com/hyperledger/indy-sdk.git
cd ./indy-sdk/libindy

brew install pkg-config
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/65effd2b617bade68a8a2c5b39e1c3089cc0e945/Formula/libsodium.rb   
brew install automake 
brew install autoconf
brew install cmake
brew install openssl
brew install zeromq
brew install zmq

export PKG_CONFIG_ALLOW_CROSS=1
export CARGO_INCREMENTAL=1
export RUST_LOG=indy=trace
export RUST_TEST_THREADS=1

export OPENSSL_DIR=/usr/local/Cellar/openssl/1.0.2m
cargo build

Below are the errors:

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
   --> src/commands/did.rs:538:24
    |
538 |                 if let Some(data) = &res.data {
    |                        ^^^^^^^^^^ help: consider using a reference: `&Some(data)`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
   --> src/services/pool/networker.rs:135:30
    |
135 |                     .filter(|(_, v)| v.is_orphaned())
    |                              ^^^^^^ help: consider using a reference: `&(_, v)`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
   --> src/services/wallet/storage/default/mod.rs:238:18
    |
238 |             Some(Config {path: Some(ref path)}) => std::path::PathBuf::from(path),
    |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using a reference: `&Config {path: Some(ref path)}`

error: aborting due to 3 previous errors

error: Could not compile `indy`.
asmallfurrywombat commented 6 years ago

rustc --version returns 1.27.2 on my box..

xtrycatchx commented 6 years ago

updated above post with rustc version

jovfer commented 6 years ago

@xtrycatchx exact same error we see on latest codebase with out-of-date rust. Please try to use stable rust and make sure that you perform build and check/update rustc in same environment

andrewBSTan commented 6 years ago

I also run into error compiling on Mac OS

error: failed to run custom build command for libsodium-sys v0.0.16 process didn't exit successfully: /Users/andrewtan/indy-sdk/libindy/target/debug/build/libsodium-sys-27f6bec8f7337955/build-script-build (exit code: 101) --- stdout cargo:rerun-if-env-changed=SODIUM_LIB_DIR cargo:rerun-if-env-changed=SODIUM_STATIC

--- stderr thread 'main' panicked at 'called Result::unwrap() on an Err value: "\"pkg-config\" \"--libs\" \"--cflags\" \"libsodium\" did not exit successfully: exit code: 1\n--- stderr\nPackage libsodium was not found in the pkg-config search path.\nPerhaps you should add the directory containing libsodium.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'libsodium\' found\n"', libcore/result.rs:945:5 note: Run withRUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish... error: build failed

Any idea why?

xtrycatchx commented 6 years ago

tnx @jovfer and @asmallfurrywombat , indeed the problem was with the older version of rust.