Running go build gives error: invalid flag in #cgo LDFLAGS: -Wl,-no_pie #3

Closed
opened 2023-02-23 02:59:30 +00:00 by jsoneaday · 2 comments
jsoneaday commented 2023-02-23 02:59:30 +00:00 (Migrated from github.com)

I run the command below and it fails with the error given. Any ideas?

go build -buildmode=c-shared -o "example.node" cmd/main.go

I run the command below and it fails with the error given. Any ideas? ```go build -buildmode=c-shared -o "example.node" cmd/main.go```
jsoneaday commented 2023-02-23 03:58:15 +00:00 (Migrated from github.com)

I also tried running the simplified version below and it still gives the same error. So it must be flags coming from napi-go? I'm on go 1.20.1.

go build cmd/main.go

I also tried running the simplified version below and it still gives the same error. So it must be flags coming from napi-go? I'm on go 1.20.1. `go build cmd/main.go`
jsoneaday commented 2023-02-23 04:20:35 +00:00 (Migrated from github.com)

Had to run CGO_LDFLAGS_ALLOW=-Wl,-no_pie go build -buildmode=c-shared -o "example.node" ./cmd and it works

Had to run `CGO_LDFLAGS_ALLOW=-Wl,-no_pie go build -buildmode=c-shared -o "example.node" ./cmd` and it works
Sign in to join this conversation.
No description provided.