我在我的基板1.0运行时模块(基于node-template)中使用了一个外挂机箱,它的编译错误为
duplicate lang item in crate 'std' (which 'myexternalcrate' depends on): 'panic_impl'.
= note: first defined in crate `sr_io` (which `node_template_runtime` depends on).如果我正确地理解了消息,那么如果开发人员想要包含依赖于已经在std中实现的std特性的外部板条箱,我认为这可能是一个常见的问题,但我不确定这是否正确。
我已经看到了这个问题,这里,它似乎已经在sr-io中解决了,但这似乎不是原因。
他们是否另一种解决问题的方法?
编辑:向Cargo.toml添加更改我们正在尝试拉进名为Cargo.toml的机箱
[dependencies]
nacl = {version = "0.3.0", default-features = false}在lib.rs中添加
extern crate nacl;在运行时模块中
use nacl::public_box::*;发布于 2019-12-18 09:49:46
您试图使用的机箱(rust-nacl)不支持no_std,因此不能在衬底运行时环境中使用。
备选方案如下:
no_std并具有类似功能的机箱:标准no_std的机箱(根据机箱的不同,它可能没有那么糟糕)。发布于 2022-06-27 04:24:27
为了澄清肖恩·塔布里齐上面的回答..。使用另一个支持no_std的机箱:
imported_crate = { git = "...", default-features = false, branch = "..." }或者编写一个支持no_std的板条箱:
#![cfg_attr(not(feature = "std"), no_std)]更多关于no_std:https://substrate.stackexchange.com/questions/1307/how-to-resolve-duplicate-lang-item-error的信息
https://stackoverflow.com/questions/59388952
复制相似问题