Compile failed.

#1 · open · 5 comments

View on GitHub ↗

tutumagi

In ./example/goroutineid foler. Execute `go1.16 build -overlay="$(../../go-patch-overlay ./patches)"` ```sh go1.16 build -overlay="$(../../go-patch-overlay ./patches)" # github.com/felixge/go-patch-overlay/example/goroutineid ./main.go:17:21: undefined: runtime.Getgid ./main.go:20:22: undefined: runtime.Getgid ./main.go:24:22: undefined: runtime.Getgid ./main.go:28:22: undefined: runtime.Getgid ``` How should I fix it?

Comments

felixge

@tutumagi hm, I can't reproduce this issue locally. Can you run this and share the output you get? ``` cat "$(../../go-patch-overlay ./patches)" ```

tutumagi

```sh $ ../../go-patch-overlay ./patches /var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/overlay.json ```

tutumagi

> ```shell > $ ../../go-patch-overlay ./patches > /var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/overlay.json > ``` the json file' content is: ``` { "Replace": { "/usr/local/go/src/runtime/stubs.go": "/var/folders/sl/jm36v99n2yj1w02tlvmnzdc80000gn/T/go-patch-overlay007724818/src/runtime/stubs.go" } } ```

felixge

What does `go1.16 env GOROOT` give you? Did you compile `../../go-patch-overlay` with the same `go1.16` binary? If not, that's probably the cause of this issue.

ignoramous

When using with [`gomobile`](https://github.com/golang/mobile), setting `GOTOOLCHAIN=local` fixed compilation issue which I only ever saw in our GitHub Actions "build" workflow. Unfortunately, I don't remember if it was the exact same error as OP saw. https://github.com/celzero/firestack/blob/91b781b115955eff57b142bb419392f8bddf054b/Makefile#L57