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

x/crypto/sha3: When compiling for all platforms undefined: cpu.S390X #31227

Closed
mjarkk opened this issue Apr 3, 2019 · 2 comments
Closed

x/crypto/sha3: When compiling for all platforms undefined: cpu.S390X #31227

mjarkk opened this issue Apr 3, 2019 · 2 comments

Comments

@mjarkk
Copy link

mjarkk commented Apr 3, 2019

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

My laptop:
$ go version
go version go1.10.4 linux/amd64

In docker container:
$ go version:
go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
Laptop:
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mark/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mark/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build171862865=/tmp/go-build -gno-record-gcc-switches"

In container:
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build425469403=/tmp/go-build -gno-record-gcc-switches"
/go/src/github.com/mjarkk/test # go version
go version go1.12 linux/amd64

What did you do?

Code on play.golang.org: https://play.golang.org/p/oUY0D25kCzz
Code:

package main

import (
	"fmt"

	"golang.org/x/crypto/sha3"
)

func main() {
	fmt.Println(sha3.New256().Sum(nil))
}

How i compiled the code:

$ GOARCH=s390x GOOS=linux go get
# golang.org/x/crypto/sha3
../../../golang.org/x/crypto/sha3/sha3_s390x.go:235:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:244:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:253:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:262:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:271:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:280:5: undefined: cpu.S390X
$ GOARCH=s390x GOOS=linux go build
# golang.org/x/crypto/sha3
../../../golang.org/x/crypto/sha3/sha3_s390x.go:235:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:244:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:253:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:262:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:271:5: undefined: cpu.S390X
../../../golang.org/x/crypto/sha3/sha3_s390x.go:280:5: undefined: cpu.S390X

What did you expect to see?

$ GOARCH=s390x GOOS=linux go get
$ GOARCH=s390x GOOS=linux go build

What did you see instead?

For some reason while trying to compile a docker container after a while it did just compile but i'm not sure why it did that. After i removed the compiled binary it showed the same error again.

@gopherbot gopherbot added this to the Unreleased milestone Apr 3, 2019
@mundaym
Copy link
Member

mundaym commented Apr 3, 2019

Hmmm, not sure what is happening here. I just tried that command sequence on my laptop and it worked fine.

One thing you could try is adding '-u' to your go get command line options. That will download dependencies automatically:

GOARCH=s390x GOOS=linux go get -u

@mjarkk
Copy link
Author

mjarkk commented Apr 3, 2019

That didn't work.
But i think that I've found it,
What i did:

  • removed ~/go/src/golang.org/
  • ran go get
  • ran GOARCH=s390x GOOS=linux go build
  • no errors

This doesn't explain why docker also didn't compile but it works.
I'm going to close this issue.

@mjarkk mjarkk closed this as completed Apr 3, 2019
@golang golang locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants