napi-go icon indicating copy to clipboard operation
napi-go copied to clipboard

Error building: undefined: NapiGoAsyncWorkID and undefined: Status

Open jsoneaday opened this issue 2 years ago • 3 comments

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

jsoneaday avatar Feb 23 '23 19:02 jsoneaday

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.

akshayganeshen avatar Mar 02 '23 00:03 akshayganeshen

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.

ACenterA avatar May 13 '23 13:05 ACenterA

@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?

omar391 avatar Sep 08 '23 19:09 omar391