< 返回博客

simonhsj 发表于 2019-12-02 18:57

Tags:substrate, runtime, rust, clang

背景: 希望在runtime自定义module中调用一个外部MPC库(https://github.com/KZen-networks/multi-party-ecdsa),编译报错。

报错信息如下,目前定位到原因是编译参数中的"--target=wasm32-unknown-unknown",即无法编译成wasm标的。单独编译该库是ok的(单独编译没有上述Flag)。目前想法思路是:

  1. Substrate runtime是否有可能直接编译到Native代码,即不编译成wasm code;
  2. 是否有可能调整编译命令,可以成功编译成wasm代码;

还望赐教

running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "depend/secp256k1/" "-I" "depend/secp256k1/include" "-I" "depend/secp256k1/src" "-Wall" "-Wextra" "-DSECP256K1_BUILD=1" "-DUSE_NUM_NONE=1" "-DUSE_FIELD_INV_BUILTIN=1" "-DUSE_SCALAR_INV_BUILTIN=1" "-DENABLE_MODULE_ECDH=1" "-DUSE_EXTERNAL_DEFAULT_CALLBACKS=1" "-DECMULT_WINDOW_SIZE=15" "-DUSE_FIELD_10X26=1" "-DUSE_SCALAR_8X32=1" "-o" "/Users/simon/substrate-package/substrate-offchain-cb/target/release/wbuild/target/wasm32-unknown-unknown/release/build/secp256k1-37afb3eb188c0d15/out/depend/secp256k1/contrib/lax_der_parsing.o" "-c" "depend/secp256k1/contrib/lax_der_parsing.c"
cargo:warning=depend/secp256k1/contrib/lax_der_parsing.c:7:10: fatal error: 'string.h' file not found
cargo:warning=#include <string.h>
cargo:warning=         ^~~~~~~~~~
cargo:warning=1 error generated.
exit code: 1

--- stderr

评论区

写评论
Mike Tang 2019-12-03 10:42

substrate可以加参数跳过编译成wasm这一步的。就在他的github 仓库首页 readme 里面就有。具体参数名字要去看看。

Mike Tang 2019-12-03 10:39

你发到博客文章区了,估计好多人看不到。

1 共 2 条评论, 1 页