Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: panic when building github.com/DataDog/zstd with buildmode=shared #36893

Closed
kamstrup opened this issue Jan 30, 2020 · 6 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@kamstrup
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.13.4 linux/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kamstrup/.cache/go-build"
GOENV="/home/kamstrup/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/kamstrup/.watchly-dev/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/kamstrup/.watchly-dev/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/kamstrup/.watchly-dev/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/kamstrup/Axiom/eventdb/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build747900966=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.12.8 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.8
uname -sr: Linux 4.15.0-1066-oem
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04 LTS (beaver-three-eyed-raven X92)
Release:	18.04
Codename:	bionic
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.27-3ubuntu1) stable release version 2.27.
gdb --version: GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git

What did you do?

$ go build -buildmode=shared -linkshared github.com/DataDog/zstd
panic: runtime error: slice bounds out of range [:-2]

goroutine 1 [running]:
cmd/go/internal/load.(*Package).load(0xc0000d0900, 0xc00017d910, 0xc000098a80, 0x0, 0x0)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1491 +0x36db
cmd/go/internal/load.loadImport(0xc000374e50, 0x7ffc2dc96267, 0x17, 0xc000024124, 0x1c, 0x0, 0xc00017d910, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:511 +0xdf2
cmd/go/internal/load.PackagesAndErrors(0xc0000c6040, 0x1, 0x1, 0x0, 0x0, 0x0)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1982 +0x398
cmd/go/internal/load.PackagesForBuild(0xc0000c6040, 0x1, 0x1, 0xa3a510, 0x2, 0x1)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:2028 +0x5d
cmd/go/internal/work.runBuild(0xea3280, 0xc0000c6040, 0x1, 0x1)
	/usr/local/go/src/cmd/go/internal/work/build.go:316 +0x88
main.main()
	/usr/local/go/src/cmd/go/main.go:189 +0x57f

I have github.com/DataDog/zstd v1.4.4 in my go.mod

What did you expect to see?

Not a crash :-) If I build my program with a plain old go build XYZ command everything works well.

@jfcg
Copy link

jfcg commented Jan 30, 2020

why dont you try with go1.13.7 ?

@jfcg
Copy link

jfcg commented Jan 30, 2020

Also for that to work, you need to have a shared standard library with:

go install [flags] -buildmode=shared std

which successfully finishes with go1.13.7 btw.

@kamstrup
Copy link
Author

kamstrup commented Jan 30, 2020

Updated to 1.13.7 and followed you instructions in an empty project with a go.mod only containing zstd, but the compiler still crashes:

UPDATE: Got some permission errors installing the std lib that I didn't notice at first.

14:52:44 kamstrup@mistpoint foo $ go get github.com/DataDog/zstd

14:53:21 kamstrup@mistpoint foo $ go install -buildmode=shared std
go install runtime/internal/sys: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install internal/race: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install container/list: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install container/ring: open /usr/local/go/pkg/linux_amd64_dynlink/container/ring.a: no such file or directory
go install crypto/internal/subtle: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install crypto/subtle: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install vendor/golang.org/x/crypto/cryptobyte/asn1: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install math/bits: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install vendor/golang.org/x/crypto/internal/subtle: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install internal/nettrace: open /usr/local/go/pkg/linux_amd64_dynlink/internal/nettrace.a: no such file or directory
go install encoding: mkdir /usr/local/go/pkg/linux_amd64_dynlink/: permission denied
go install unicode/utf8: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install unicode/utf16: open /usr/local/go/pkg/linux_amd64_dynlink/unicode/utf16.a: no such file or directory
go install internal/goversion: open /usr/local/go/pkg/linux_amd64_dynlink/internal/goversion.a: no such file or directory
go install internal/cfg: open /usr/local/go/pkg/linux_amd64_dynlink/internal/cfg.a: no such file or directory
go install image/color: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install unicode: open /usr/local/go/pkg/linux_amd64_dynlink/unicode.a: no such file or directory
go install runtime/race: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install sync/atomic: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install runtime/internal/atomic: open /usr/local/go/pkg/linux_amd64_dynlink/runtime/internal/atomic.a: no such file or directory
go install internal/cpu: open /usr/local/go/pkg/linux_amd64_dynlink/internal/cpu.a: no such file or directory
go install vendor/golang.org/x/crypto/curve25519: mkdir /usr/local/go/pkg/linux_amd64_dynlink: permission denied
go install runtime/cgo: open /usr/local/go/pkg/linux_amd64_dynlink/runtime/cgo.a: no such file or directory

14:53:44 kamstrup@mistpoint foo $ go build -buildmode=shared -linkshared github.com/DataDog/zstd
panic: runtime error: slice bounds out of range [:-2]

goroutine 1 [running]:
cmd/go/internal/load.(*Package).load(0xc0000b6900, 0xc00015d910, 0xc000057180, 0x0, 0x0)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1491 +0x36db
cmd/go/internal/load.loadImport(0xc00050e7a0, 0x7ffceb44b2b1, 0x17, 0xc000024124, 0x18, 0x0, 0xc00015d910, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:511 +0xdf2
cmd/go/internal/load.PackagesAndErrors(0xc000020090, 0x1, 0x1, 0x0, 0x0, 0x0)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:1982 +0x398
cmd/go/internal/load.PackagesForBuild(0xc000020090, 0x1, 0x1, 0xa3a510, 0x2, 0x1)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:2028 +0x5d
cmd/go/internal/work.runBuild(0xea4280, 0xc000020090, 0x1, 0x1)
	/usr/local/go/src/cmd/go/internal/work/build.go:316 +0x88
main.main()
	/usr/local/go/src/cmd/go/main.go:189 +0x57f

14:53:54 kamstrup@mistpoint foo $ go version
go version go1.13.7 linux/amd64

@kamstrup
Copy link
Author

To clarify - I am probably messing up with libs and buildmode on my part (i'll sort that out myself) - I mainly filed the issue because the compiler was panicking, which I assume it shouldn't be doing, even on bad input :-)

@bcmills
Copy link
Contributor

bcmills commented Jan 30, 2020

Please try go1.14beta1 and see if this still reproduces — I suspect that it is a duplicate of #35759 or #34347, which are fixed at head.

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jan 30, 2020
@bcmills bcmills changed the title Go build crash in buildmode=shared for zstd cmd/go: panic when building github.com/DataDog/zstd with buildmode=shared Jan 30, 2020
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Mar 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants