• OpenEthereum 编译笔记


         先粗略评价一下这个项目,这个项目原本是parity的项目,项目原名也叫Parity,至于为什么后来独立成OpenEthereum,我没有认真考据后面的八卦,不过项目独立以后,这个项目好像成了三不管项目,就是没人负主要责任做强力贡献维护,比如我下面出现的那个编译问题,issue了根本没人管,前两天看了contribution热点图,从19年上半年开始就没什么commits了。

         鉴于以上原因,如果有人想用编译完的发布包做钱包之类的生产应用的话,暂时先别考虑这个项目了。想在以太坊领域用Rust做一些探索性开发工作,没有其他的基础项目,目前也就只能用这个顶上了。编译过程中这个项目一些遗留代码问题还是蛮严重的,提示不少代码在Rust 2018里面是没法通过的。

    环境:Ubuntu 20.04

    0. 这个项目的Toml没有edition属性,其默认使用的是Rust 2015版。

    1. 本地依赖安装

    apt-get install build-essential cmake libudev-dev

    2. rust安装

    这部分就不说了,因为不同的操作系统,玩法区别很大

    3. ustc源不好使,error log:

    error: failed to download from `https://crates-io.proxy.ustclug.org/api/v1/crates/aho-corasick/0.7.6/download`
    
    
    
    
    Caused by:
    
      [6] Couldn't resolve host name (Could not resolve host: crates)

    4. 碰到编译问题

    .cargo/registry/src/github.com-1ecc6299db9ec823/logos-derive-0.7.7/src/lib.rs:55:20
    |
    55 | extras.insert(util::ident(&ext), |_| panic!("Only one #[extras] attribute can be declared."));
    | ^^^^^^ ----------------- ----------------------------------------------------------- supplied 2 arguments
    | |
    | expected 1 argument
    |
    note: associated function defined here
    
    .cargo/registry/src/github.com-1ecc6299db9ec823/logos-derive-0.7.7/src/lib.rs:89:23
    |
    89 | error.insert(variant, |_| panic!("Only one #[error] variant can be declared."));
    | ^^^^^^ ------- -------------------------------------------------------- supplied 2 arguments
    | |
    | expected 1 argument
    |
    note: associated function defined here
    
    .cargo/registry/src/github.com-1ecc6299db9ec823/logos-derive-0.7.7/src/lib.rs:93:21
    |
    93 | end.insert(variant, |_| panic!("Only one #[end] variant can be declared."));
    | ^^^^^^ ------- ------------------------------------------------------ supplied 2 arguments
    | |
    | expected 1 argument
    |
    note: associated function defined here

    解决办法:把第二个参数删除,这是最直接的,后来在repo上的提的issue有人回答之前有重复问题(https://github.com/openethereum/openethereum/issues/442),建议方法是把rust版本降到1.51.0,我自己试了一下,最高可用版本是1.52.0,这是旧rust项目的一个痼疾:没人维护升级的老项目得用旧Rust版本编译,Parity的paritytech/parity-bitcoin项目得把版本退到1.47.0才能编译通过。由此看,eth的发展相对要活跃一点。

    5、Cargo test --all是走不通,看Tip是缺数据

    6、这玩意编译过程中可能会很耗CPU,也有阶段会很耗内存,有的时候资源不足甚至会导致编译失败。

  • 相关阅读:
    Elasticsearch 结构化搜索
    KMP 算法
    ElasticSearch 配置
    C++ 入门
    Spark 基础操作
    HBase 与 MapReduce 集成
    iOS面试相关
    iOS开发值得学习的Demo
    Mac系统安装MyEclipse
    linux安装tomcat
  • 原文地址:https://www.cnblogs.com/dhcn/p/15256307.html
Copyright © 2020-2023  润新知