Skip to content

cargo liquid 编译合约错误 #37

@jewelzms

Description

@jewelzms

根据说明文档 https://liquid-doc.readthedocs.io/zh_CN/latest/docs/quickstart/prerequisite.html 配置好环境之后。

尝试编译 HelloWorld 例子合约,开始遇到 proc-macro2 等一些依赖库报错,在修改 HelloWorld 示例合约部分依赖库版本之后继续编译,提示需要 edition2021 特性,编译出现如下错误:

[1/4] 🔍  Collecting crate metadata
[2/4] 🚚  Building cargo project
error: failed to parse manifest at `/tmp/cargo-xbuildqtQwtT/Cargo.toml`

Caused by:
  feature `edition2021` is required

  consider adding `cargo-features = ["edition2021"]` to the manifest
ERROR: Building with xargo

Caused by:
    `"/home/john/.rustup/toolchains/nightly-2021-06-23-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/cargo-xbuildqtQwtT/Cargo.toml" "--target" "wasm32-unknown-unknown" "--" "-Z" "force-unstable-if-unmarked"` failed with exit code: Some(101)

根据提示修改 Cargo.toml,在文件顶部增加 cargo-features = ["edition2021"],报错如下:

[1/4] 🔍  Collecting crate metadata
[2/4] 🚚  Building cargo project
   Compiling core v0.0.0 (/home/john/.rustup/toolchains/nightly-2021-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling compiler_builtins v0.1.45
   Compiling rustc-std-workspace-core v1.99.0 (/home/john/.rustup/toolchains/nightly-2021-06-23-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/tmp/cargo-xbuildLJMsg2)
    Finished release [optimized] target(s) in 19.60s
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not support the standard library
  = note: `std` is required by `predicates_core` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not support the standard library
  = note: `std` is required by `bumpalo` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: could not compile `predicates-core`

To learn more, run the command again with --verbose.
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed
ERROR: xbuild failed with status exit status: 101

目前提供的编译链因为当时使用的版本老旧,很多库已升级(patch不兼容),使得编译链无法正常使用,似乎难以找到整套兼容的依赖。
官方有无好的解决方案,或是当时有无封装可用容器?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions