Error building: undefined: NapiGoAsyncWorkID and undefined: Status
I'm on an m1 mac and running below command when this error occurs.
CGO_LDFLAGS_ALLOW=-Wl,-no_pie GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared -o "example.node" -a ./cmd
# github.com/akshayganeshen/napi-go
../../../../go/pkg/mod/github.com/akshayganeshen/[email protected]/async_work.go:9:9: undefined: NapiGoAsyncWorkID
../../../../go/pkg/mod/github.com/akshayganeshen/[email protected]/async_work.go:14:49: undefined: Status
Apologies for the slow reply on this. I took a quick look at the symbols when attempting to cross compile, and still haven't been able to work out where it breaks 🤔.
I imagine this'd be a problem on any GOOS, as the culprit seems to be the GOARCH here, but not sure why... I'll continue taking a look though.
You can try with:
export CC=clang export CGO_ENABLED=1
We had the same issue but with CGO_ENABLED it worked without errors.
@akshayganeshen thank you for this golang project, hopefully it will stay maintained and functional. It seems to work great for our needs.
@akshayganeshen In docker env I had to do CGO_ENABLED=0 and the solution above doesn't work. Is there any other way to fix this?