ontio / ontology

Official Go implementation of the Ontology protocol. https://dev-docs.ont.io/#/
GNU Lesser General Public License v3.0
829 stars 290 forks source link

Compile failure on Mac m1 chip #1394

Closed smallyunet closed 2 years ago

smallyunet commented 2 years ago
~/work/test/github/ontology master ❯ git remote -v                                    ✘ INT
origin  https://github.com/ontio/ontology.git (fetch)
origin  https://github.com/ontio/ontology.git (push)
~/work/test/github/ontology master ❯ 
~/work/test/github/ontology master ❯ git pull
Already up to date.
~/work/test/github/ontology master ❯ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
~/work/test/github/ontology master ❯ 
~/work/test/github/ontology master ❯ make
CGO_ENABLED=1 go build  -ldflags "-w -X github.com/ontio/ontology/common/config.Version=v1.14.2-1-gfad93170"  -o ontology main.go
# github.com/shirou/gopsutil/cpu
../../../../go/pkg/mod/github.com/shirou/gopsutil@v2.20.5+incompatible/cpu/cpu_darwin_cgo.go:13:5: warning: 'TARGET_OS_MAC' is not defined, evaluates to 0 [-Wundef-prefix=TARGET_OS_]
# github.com/ontio/ontology/smartcontract/service/wasmvm
ld: warning: ignoring file smartcontract/service/wasmvm/libwasmjit_onto_interface_darwin.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_wasmjit_bytes_destroy", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_bytes_destroy in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_bytes_destroy)
  "_wasmjit_chain_context_create", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_chain_context_create in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_chain_context_create)
  "_wasmjit_construct_result", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_construct_result in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_construct_result)
  "_wasmjit_get_exec_step", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_get_exec_step in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_get_exec_step)
  "_wasmjit_get_gas", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_get_gas in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_get_gas)
  "_wasmjit_invoke", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_invoke in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_invoke)
  "_wasmjit_service_index", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_service_index in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_service_index)
  "_wasmjit_set_calloutput", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_set_calloutput in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_set_calloutput)
  "_wasmjit_set_exec_step", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_set_exec_step in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_set_exec_step)
  "_wasmjit_set_gas", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_set_gas in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_set_gas)
  "_wasmjit_validate", referenced from:
      __cgo_99ce27cfa72d_Cfunc_wasmjit_validate in _x002.o
     (maybe you meant: __cgo_99ce27cfa72d_Cfunc_wasmjit_validate)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ontology] Error 2

Still not supporting mac m1 now? Hava any plan in the future?

rongyi commented 2 years ago

Sorry, ontology does not support m1 currently, but there is a work around for this. You can install a emulator utm and then install a amd64 OS. you can build ontology in this OS.