收款定制开发要点初见:切换老版本Rust并运行老版本cargo

初学Web3.0,收款定制开发在参考安装以太坊客户端Parity的过程中,收款定制开发遇到了一个因版本过新导致的Bug:

mem::transmute::<SocketAddrV4, sockaddr_in>(v4);

具体Bug如下:

  1. error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
  2. --> /home/hhy/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.3.8/src/sockaddr.rs:153:9
  3. |
  4. 153 | mem::transmute::<SocketAddrV4, sockaddr_in>(v4);
  5. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  6. |
  7. = note: source type: `SocketAddrV4` (48 bits)
  8. = note: target type: `sockaddr_in` (128 bits)
  9. Compiling term_size v0.3.1
  10. For more information about this error, try `rustc --explain E0512`.
  11. error: could not compile `socket2` due to previous error
  12. warning: build failed, waiting for other jobs to finish...

根据解释,是Rust版本1.64.0修改了Ipv4Addr、Ipv6Addr、SocketAddrV4和SocketAddrV6,收款定制开发导致内存长度对不上了:

Just wanted to add into this issue:

Rust in its version 1.64.0 made changes to Ipv4Addr, Ipv6Addr, SocketAddrV4 and SocketAddrV6. Also, when using std::mem::transmute it results in invalid memory accesses.

With all of these, the newest version of Rust broke some crates, and now spotify-tui has problems with memory and different bit sizes and stuff.
So they recommend doing cargo update to mitigate for now, and it works as a workaround (adding the cargo update somewhere before it reads the Cargo.lock and Cargo.toml files and .patches.

I had to manually do the editing, building and compiling from (AUR in Arch Linux).

Also, after running makepkg si with the cargo update command already in place, it updates the files but after that it is required to download updated versions of some of the dependencies/creates and 1 or 2 required http and also, obviously for all the update, network connection is required so the --frozen option had to be temporary removed.

For me, it built succesfully after that even using this PKGBUILD.

但要切换到适配以太坊客户端的Rust真的费了一大番功夫:

1、根据Rust官网:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

这句安装的是最新版本的Rust(先下载rustup-init.sh脚本,而后自动运行),暂无在官网上看到提供任何过往版本的链接,而在Github官方仓库中只有1.25.1以及之前的版本tag分支;

2、根据,因以太坊客户端Parity需要1.24.0以上版本的nightly版本Rust,故在用1安装完Rust后运行

rustup install nightly-2018-08-01【错误示范】

即可切换Rust版本……才怪,Rust主要分cargo、rustc两个主要工具,运行上述install后cargo --version仍然是显示最新1.64.0版本,而且nightly-2018-08-01是非常上古的版本。

3、正确做法是查寻了之后找到的:

rustup toolchain install nightly-2020-07-27

而后采用

rustup run nightly-2020-07-27 rustc --version

查寻版本即可确定已切换至旧版本:

  1. Parity Ethereum Client.
  2. version Parity-Ethereum/v2.7.2-unstable-55c90d401-20200205/x86_64-unknown-linux-gnu/rustc1.47.0-nightly
  3. Copyright 2015-2020 Parity Technologies (UK) Ltd.
  4. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
  5. This is free software: you are free to change and redistribute it.
  6. There is NO WARRANTY, to the extent permitted by law.
  7. By Wood/Paronyan/Kotewicz/Drwięga/Volf/Greeff
  8. Habermeier/Czaban/Gotchac/Redman/Nikolsky
  9. Schoedon/Tang/Adolfsson/Silva/Palm/Hirsz et al.

之后需要调用nightly-2020-07-27版本的cargo、rustc都必须加rustup run nightly-2020-07-27前缀,即通过以下命令编译Parity release版:

rustup run nightly-2020-07-27 cargo build --release --features finacargo build --release --features final

或通过以下命令编译Parity debug版:

rustup run nightly-2020-07-27 cargo build

附:

编译Parity前需要安装:

sudo apt install llvm-dev libclang-dev clang

另如果

parity --version 

提示:

  1. Command 'parity' not found, but can be installed with:
  2. sudo snap install parity

只需

sudo cp ./target/debug/parity /usr/bin/

即可。

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发