FS#57921 - [go] Unable to build docker/containerd-shim
Attached to Project:
Community Packages
Opened by Sébastien Luttringer (seblu) - Friday, 23 March 2018, 01:54 GMT
Last edited by Morten Linderud (Foxboron) - Sunday, 13 September 2020, 13:33 GMT
Opened by Sébastien Luttringer (seblu) - Friday, 23 March 2018, 01:54 GMT
Last edited by Morten Linderud (Foxboron) - Sunday, 13 September 2020, 13:33 GMT
|
Details
Hello,
I'm no more able to compile containerd-shim in docker package with go-pie. The standalone containerd package is also affected. Binary versions aged from few months in repository looks good, so something happen in go-pie recently, I don't know what. Switch to go as deps make error goes away. The makefile line which fail is: CGO_ENABLED=0 go build -v -o bin/containerd-shim -ldflags '-s -w -X github.com/containerd/containerd/version.Version=v1.0.2 -X github.com/containerd/containerd/version.Revision=cfd04396dc68220d1cecbe686a6cc3aa5ce3667c -X github.com/containerd/containerd/version.Package=github.com/containerd/containerd -extldflags "-static"' ./cmd/containerd-shim # github.com/containerd/containerd/cmd/containerd-shim loadinternal: cannot find runtime/cgo The fastest way to reproduce is to rebuild containerd package with go-pie. |
This task depends upon
Closed by Morten Linderud (Foxboron)
Sunday, 13 September 2020, 13:33 GMT
Reason for closing: Won't implement
Additional comments about closing: go-pie has been dropped and containerd doesn't use PIE anymore.
Sunday, 13 September 2020, 13:33 GMT
Reason for closing: Won't implement
Additional comments about closing: go-pie has been dropped and containerd doesn't use PIE anymore.
The "solution" (which seems reasonable IMHO) is to strip out the -static and allow go to at least dynamically link libc.
```
package main
import "fmt"
func main() {
fmt.Println("hello")
}
```
When built using either `go` package or upstream go1.10.1 and CGO_ENABLED=0, the resulting binary is not statically linked:
```
$ CGO_ENABLED=0 go build -buildmode=pie main.go
# command-line-arguments
loadinternal: cannot find runtime/cgo
$ ldd main
linux-vdso.so.1 (0x00007ffc57f3d000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f659f253000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f659f9c3000)
```
Version `go version devel +58b18cfda5 Tue Apr 17 14:39:08 2018 +0000 linux/amd64` behaves the same. GOCACHE=off does not seem to have any effect.