citahub / cita-common

Libraries for CITA (https://github.com/citahub/cita)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to run the cita-web3 example

flyq opened this issue · comments

Env

  • Ubuntu 18.04
$ cargo version
cargo 1.38.0-nightly (677a180f4 2019-07-08)

$ rustc --version
rustc 1.38.0-nightly (69656fa4c 2019-07-13)
     
$ rustup --version
rustup 1.19.0 (2af131cf9 2019-09-08)

command

cargo run --example query_height http://MY_ADDR:PORT

Error info:

Compiling futures-cpupool v0.1.8 (registry `https://mirrors.ustc.edu.cn/crates.io-index/`)
error: failed to run custom build command for `openssl v0.9.24 (registry `https://mirrors.ustc.edu.cn/crates.io-index/`)`

Caused by:
  process didn't exit successfully: `/home/flyq/workspaces/cita/cita-common/target/debug/build/openssl-aa083da41679e6c3/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/flyq/.cargo/registry/src/mirrors.ustc.edu.cn-b63e9dae659fc205/openssl-0.9.24/build.rs:16:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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

relate

paritytech/substrate#800
paritytech/substrate#886

And I find there three crates related to openssl v0.9.24 in Cargo.lock:

[[package]]
name = "openssl"
version = "0.9.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "native-tls"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)",
 "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
 "security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
 "security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
 "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

"checksum openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index)" = "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985"

Maybe it concern with your local openssl version. Cargo build works well in such a env:

Ubuntu: 18.04
cargo version: cargo 1.39.0 (1c6ec66d5 2019-09-30)
rustup version: rustup 1.21.1 (7832b2ebe 2019-12-20)
openssl version: OpenSSL 1.1.1  11 Sep 2018

Have you installed OpenSSL on your local? It seems that the compiler cannot find your local OpenSSL.

Have you installed OpenSSL on your local? It seems that the compiler cannot find your local OpenSSL.

I have installed it already :

$ openssl version
OpenSSL 1.1.1  11 Sep 2018

according to this:
sfackler/rust-openssl#987 (comment)

openssl 0.9 doesn't support OpenSSL 1.1.1. You'll need to update to openssl 0.10.

I think the openssl's crate version should be upgraded.

Maybe it concern with your local openssl version. Cargo build works well in such a env:

Ubuntu: 18.04
cargo version: cargo 1.39.0 (1c6ec66d5 2019-09-30)
rustup version: rustup 1.21.1 (7832b2ebe 2019-12-20)
openssl version: OpenSSL 1.1.1  11 Sep 2018

I tried to run:

cargo run --example query_height http://[IP]:[PORT]

in another server, and failed too:

 Compiling syn v0.14.4
   Compiling openssl v0.9.24
error: failed to run custom build command for `openssl v0.9.24`

Caused by:
  process didn't exit successfully: `/home/ubuntu/cita-common/target/debug/build/openssl-fc82d8427bdab35a/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Unable to detect OpenSSL version', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.9.24/build.rs:16:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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

the env:

$ openssl version
OpenSSL 1.1.1  11 Sep 2018
$ cargo version
cargo 1.40.0 (bc8e4c8be 2019-11-22)
$ rustup  --version
rustup 1.21.1 (7832b2ebe 2019-12-20)

I'll try the docker

fixed by update web3's version

 Compiling cita-web3 v0.1.0 (/home/flyq/workspaces/flyq/cita-common/cita-web3)
    Finished dev [unoptimized + debuginfo] target(s) in 1m 17s
     Running `/home/flyq/workspaces/flyq/cita-common/target/debug/examples/query_height 'http://x.x.x.x:1337'`
Response = Quantity(1228753)