红联Linux门户
Linux帮助

Ethereum客户端Parity编译

发布时间:2017-07-12 15:01:21来源:linux网站作者: 怎当她临去时秋波那
Ethereum客户端一般有geth和eth。Parity是由以太坊前CTO开发的一款Ehtereum客户端。它是用一种全新的系统级别的编程语言RUST开发而成。
 
Rust编译器
编译前先安装RUST编译器。具体参考https://www.rust-lang.org/en-US/
在windows下需运行以下命令设置编译环境
$ rustup default stable-x86_64-pc-windows-msvc
 
源码编译
# download Parity code
$ git clone https://github.com/paritytech/parity
$ cd parity
# build in release mode
$ cargo build --release
Windows编译未成功,Ubuntu上编译成功了
Ethereum客户端Parity编译
Ethereum客户端Parity编译
 
问题
国内访问国外不稳定,包镜像改为国内
sudo gedit /etc/apt/sources.list
sudo apt-get update
 
问题
Ubuntu上编译遇到如下错误
Running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "etc/hidapi/hidapi" "-o" "/home/kaldin/parity/target/release/build/hidapi-9e850a65e56ead30/out/etc/hidapi/linux/hid.o" "-c" "etc/hidapi/linux/hid.c"
cargo:warning=etc/hidapi/linux/hid.c:44:21: fatal error: libudev.h: No such file or directory
cargo:warning=compilation terminated.
ExitStatus(ExitStatus(256))
 
解决方法:
sudo apt install libudev1=204-5ubuntu20.24
sudo apt install libudev-dev
在Ubuntu上,不要偷懒用 sudo apt install rustc. 它给我带来如下错误
Compiling untrusted v0.5.0
Running `rustc --crate-name untrusted /home/gavin/.cargo/registry/src/github.com-1ecc6299db9ec823/untrusted-0.5.0/src/untrusted.rs --crate-type lib -C opt-level=3 -C panic=abort -C metadata=c831394b30a1c4f4 -C extra-filename=-c831394b30a1c4f4 --out-dir /home/gavin/dev/parity/target/release/deps --emit=dep-info,link -L dependency=/home/gavin/dev/parity/target/release/deps --cap-lints allow`
error: struct field shorthands are unstable (see issue #37340)
--> /home/gavin/.cargo/registry/src/github.com-1ecc6299db9ec823/untrusted-0.5.0/src/untrusted.rs:313:21
|
313 |             Slice { bytes }
|                     ^^^^^
error: struct field shorthands are unstable (see issue #37340)
--> /home/gavin/.cargo/registry/src/github.com-1ecc6299db9ec823/untrusted-0.5.0/src/untrusted.rs:327:51
|
327 |             self.bytes.get(r).map(|bytes| Slice { bytes })
|                                                   ^^^^^
error: aborting due to 2 previous errors
error: Could not compile `untrusted`.
 
老老实实用以下命令安装Rustc。
$ curl https://sh.rustup.rs -sSf | sh
 
具体原因嘛
Ethereum客户端Parity编译
 
使用unstable feature的条件和步骤: 
1.只有nightly才可以使用unstable 
2.找到unstable feature的名字 
3.#![feature(xxx)]启用这个feature
 
评价
Rust目前还不是一个很成熟的系统语言。仍然有memory leak的问题
Rust仍然缺乏对CPU多核编程的支持。这一点我仍然喜欢GO
Rust语言是所有程序员梦寐以求的语言,它隐藏了多线程,并发等等让程序员头痛的问题,降低了编程的复杂性,从而可以专注于商业逻辑
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31946.html