Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文档中可以补充 macOS M1 (darwin-arm64) 架构的 irita 的构建方式 #192

Open
nekomeowww opened this issue Apr 6, 2022 · 1 comment

Comments

@nekomeowww
Copy link

nekomeowww commented Apr 6, 2022

使用 make install 命令的时候会遇到 github.com/CosmWasm/wasmvm/api 的编译报错提示:

ld: symbol(s) not found for architecture arm64

详细测试如下:

go install github.com/CosmWasm/wasmvm/api
# github.com/CosmWasm/wasmvm/api
ld: warning: ignoring file ../../golang/pkg/mod/github.com/!cosm!wasm/[email protected]/api/libwasmvm.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_analyze_code", referenced from:
      __cgo_10a41752a67f_C2func_analyze_code in _x004.o
      __cgo_10a41752a67f_Cfunc_analyze_code in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_analyze_code, __cgo_10a41752a67f_Cfunc_analyze_code )
  "_destroy_unmanaged_vector", referenced from:
      __cgo_10a41752a67f_Cfunc_destroy_unmanaged_vector in _x006.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_destroy_unmanaged_vector)
  "_execute", referenced from:
      __cgo_10a41752a67f_C2func_execute in _x004.o
      __cgo_10a41752a67f_Cfunc_execute in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_execute, __cgo_10a41752a67f_C2func_execute )
  "_get_metrics", referenced from:
      __cgo_10a41752a67f_C2func_get_metrics in _x004.o
      __cgo_10a41752a67f_Cfunc_get_metrics in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_get_metrics, __cgo_10a41752a67f_C2func_get_metrics )
  "_ibc_channel_close", referenced from:
      __cgo_10a41752a67f_C2func_ibc_channel_close in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_channel_close in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_ibc_channel_close, __cgo_10a41752a67f_Cfunc_ibc_channel_close )
  "_ibc_channel_connect", referenced from:
      __cgo_10a41752a67f_C2func_ibc_channel_connect in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_channel_connect in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_ibc_channel_connect, __cgo_10a41752a67f_Cfunc_ibc_channel_connect )
  "_ibc_channel_open", referenced from:
      __cgo_10a41752a67f_C2func_ibc_channel_open in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_channel_open in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_ibc_channel_open, __cgo_10a41752a67f_Cfunc_ibc_channel_open )
  "_ibc_packet_ack", referenced from:
      __cgo_10a41752a67f_C2func_ibc_packet_ack in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_packet_ack in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_ibc_packet_ack, __cgo_10a41752a67f_C2func_ibc_packet_ack )
  "_ibc_packet_receive", referenced from:
      __cgo_10a41752a67f_C2func_ibc_packet_receive in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_packet_receive in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_ibc_packet_receive, __cgo_10a41752a67f_Cfunc_ibc_packet_receive )
  "_ibc_packet_timeout", referenced from:
      __cgo_10a41752a67f_C2func_ibc_packet_timeout in _x004.o
      __cgo_10a41752a67f_Cfunc_ibc_packet_timeout in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_ibc_packet_timeout, __cgo_10a41752a67f_C2func_ibc_packet_timeout )
  "_init_cache", referenced from:
      __cgo_10a41752a67f_C2func_init_cache in _x004.o
      __cgo_10a41752a67f_Cfunc_init_cache in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_init_cache, __cgo_10a41752a67f_C2func_init_cache )
  "_instantiate", referenced from:
      __cgo_10a41752a67f_C2func_instantiate in _x004.o
      __cgo_10a41752a67f_Cfunc_instantiate in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_instantiate, __cgo_10a41752a67f_Cfunc_instantiate )
  "_load_wasm", referenced from:
      __cgo_10a41752a67f_C2func_load_wasm in _x004.o
      __cgo_10a41752a67f_Cfunc_load_wasm in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_load_wasm, __cgo_10a41752a67f_Cfunc_load_wasm )
  "_migrate", referenced from:
      __cgo_10a41752a67f_C2func_migrate in _x004.o
      __cgo_10a41752a67f_Cfunc_migrate in _x004.o
     (maybe you meant: __cgo_10a41752a67f_C2func_migrate, __cgo_10a41752a67f_Cfunc_migrate )
  "_new_unmanaged_vector", referenced from:
      __cgo_10a41752a67f_Cfunc_new_unmanaged_vector in _x006.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_new_unmanaged_vector)
  "_pin", referenced from:
      __cgo_10a41752a67f_C2func_pin in _x004.o
      __cgo_10a41752a67f_Cfunc_pin in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_pin, __cgo_10a41752a67f_C2func_pin )
  "_query", referenced from:
      __cgo_10a41752a67f_C2func_query in _x004.o
      __cgo_10a41752a67f_Cfunc_query in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_query, __cgo_10a41752a67f_C2func_query )
  "_release_cache", referenced from:
      __cgo_10a41752a67f_Cfunc_release_cache in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_release_cache)
  "_reply", referenced from:
      __cgo_10a41752a67f_C2func_reply in _x004.o
      __cgo_10a41752a67f_Cfunc_reply in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_reply, __cgo_10a41752a67f_C2func_reply )
  "_save_wasm", referenced from:
      __cgo_10a41752a67f_C2func_save_wasm in _x004.o
      __cgo_10a41752a67f_Cfunc_save_wasm in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_save_wasm, __cgo_10a41752a67f_C2func_save_wasm )
  "_sudo", referenced from:
      __cgo_10a41752a67f_C2func_sudo in _x004.o
      __cgo_10a41752a67f_Cfunc_sudo in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_sudo, __cgo_10a41752a67f_C2func_sudo )
  "_unpin", referenced from:
      __cgo_10a41752a67f_C2func_unpin in _x004.o
      __cgo_10a41752a67f_Cfunc_unpin in _x004.o
     (maybe you meant: __cgo_10a41752a67f_Cfunc_unpin, __cgo_10a41752a67f_C2func_unpin )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

查看 wasmvm 源代码后发现他们是通过 CI 自动构建的方式把各个平台和架构的动态链接库放到源代码仓库中的方式进行分发的(这样并不是很通用化,可能对于 Linux 的不同 CPU 架构或是 macOS 的不同 CPU 架构就没办法正确构建了),可以通过:

git clone https://github.com/CosmWasm/wasmvm.git
cd wasmvm
cd libwasmvm && cargo build --release
cp libwasmvm/target/release/libwasmvm.dylib $GOPATH'/pkg/mod/github.com/!cosm!wasm/wasmvm@<依赖的 wasmvm 版本号>/api'

CosmWasm/wasmvm/libwasmvm 单独进行构建。

完成上述步骤后返回 irita 继续进行 make install 即可。

@lakeo
Copy link

lakeo commented Apr 17, 2022

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants