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/ssh/terminal: build failing on darwin/amd64: undefined: unix.IoctlGetTermios #22688

Closed
sapiens-sapide opened this issue Nov 13, 2017 · 19 comments
Milestone

Comments

@sapiens-sapide
Copy link

@sapiens-sapide sapiens-sapide commented Nov 13, 2017

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/goland"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y2/dnhd02vs2k3bmty6w3f0j7940000gn/T/go-build493794240=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
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"

What did you do?

go get -u golang.org/x/crypto/ssh/terminal

What did you expect to see?

no error. The package should be fetched and built.

What did you see instead?

../../../../golang.org/x/crypto/ssh/terminal/util.go:30:12: undefined: unix.IoctlGetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:38:18: undefined: unix.IoctlGetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:54:12: undefined: unix.IoctlSetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:64:18: undefined: unix.IoctlGetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:75:9: undefined: unix.IoctlSetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:80:13: undefined: unix.IoctlGetWinsize
../../../../golang.org/x/crypto/ssh/terminal/util.go:98:18: undefined: unix.IoctlGetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:107:12: undefined: unix.IoctlSetTermios
../../../../golang.org/x/crypto/ssh/terminal/util.go:112:3: undefined: unix.IoctlSetTermios

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 13, 2017

687d4b8 is likely to blame.

I can't reproduce the failure on Linux, though - not even with GOOS=darwin.

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 13, 2017

/cc @tklauser

@mvdan mvdan changed the title `go get -u golang.org/x/crypto/ssh/terminal` failed x/crypto/ssh/terminal: build failing on darwin/amd64: undefined: unix.IoctlGetTermios Nov 13, 2017
@gopherbot gopherbot added this to the Unreleased milestone Nov 13, 2017
@tklauser
Copy link
Member

@tklauser tklauser commented Nov 13, 2017

Cannot reproduce on neither Darwin not Linux with GOOS=darwin.

@sapiens-sapide Could you try to go get -u golang.org/x/sys/unix and then go get -u golang.org/x/crypto/ssh/terminalagain?

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 13, 2017

Could be that the unix repository clone is in a weird git state and go get -u didn't pull it properly, or another weird update flake?

@sapiens-sapide
Copy link
Author

@sapiens-sapide sapiens-sapide commented Nov 13, 2017

@tklauser I did go get -u golang.org/x/sys/unix and then go get -u golang.org/x/crypto/ssh/terminal, but failed with the exact same error.

@tklauser
Copy link
Member

@tklauser tklauser commented Nov 13, 2017

@sapiens-sapide as @mvdan mentioned, did you check that your x/sys/unix clone wasn't on a branch or some other detached git state? Did you get an error, e.g. like the following while doing go get -u golang.org/x/sys/unix:

# cd /Users/tklauser/go/src/golang.org/x/sys; git pull --ff-only
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

package golang.org/x/sys/unix: exit status 1

Could you check the result of running git symbolic-ref HEAD in $GOPATH/src/golang.org/x/sys? If this doesn't return refs/heads/master make sure to git checkout master and then try go get -u golang.org/x/crypto/ssh/terminal again?

@sapiens-sapide
Copy link
Author

@sapiens-sapide sapiens-sapide commented Nov 13, 2017

@tklauser cd $GOPATH/src/golang.rog/x/sys then git symbolic-ref HEAD returned :
refs/heads/master

@sapiens-sapide
Copy link
Author

@sapiens-sapide sapiens-sapide commented Nov 13, 2017

I'm up to date with commit 1e2299c

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 13, 2017

@sapiens-sapide Look in the file $GOPATH/src/golang.org/x/sys/unix/syscall_darwin.go. Do you see the functions IoctlGetTermios there?

Like others, I don't see how you could be getting this error. Could you show us the output of go build -x golang.org/x/crypto/ssh/terminal ?

@sapiens-sapide
Copy link
Author

@sapiens-sapide sapiens-sapide commented Nov 14, 2017

@ianlancetaylor :

  1. yes, func IoctlGetTermios is within the $GOPATH/src/golang.org/x/sys/unix/syscall_darwin.go file.
  2. go build -x golang.org/x/crypto/ssh/terminal outputs :
WORK=/var/folders/y2/dnhd02vs2k3bmty6w3f0j7940000gn/T/go-build600856943
mkdir -p $WORK/golang.org/x/crypto/ssh/terminal/_obj/
mkdir -p $WORK/golang.org/x/crypto/ssh/
cd /usr/local/goland/src/golang.org/x/crypto/ssh/terminal
/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64/compile -o $WORK/golang.org/x/crypto/ssh/terminal.a -trimpath $WORK -goversion go1.9.2 -p golang.org/x/crypto/ssh/terminal -complete -buildid bcd1798bffc85edf80f82fe0ab8c432bac7d04ae -importmap golang.org/x/sys/unix=golang.org/x/crypto/vendor/golang.org/x/sys/unix -D _/usr/local/goland/src/golang.org/x/crypto/ssh/terminal -I $WORK -I /usr/local/goland/pkg/darwin_amd64 -pack ./terminal.go ./util.go ./util_bsd.go
# golang.org/x/crypto/ssh/terminal
../../crypto/ssh/terminal/util.go:30:12: undefined: unix.IoctlGetTermios
../../crypto/ssh/terminal/util.go:38:18: undefined: unix.IoctlGetTermios
../../crypto/ssh/terminal/util.go:54:12: undefined: unix.IoctlSetTermios
../../crypto/ssh/terminal/util.go:64:18: undefined: unix.IoctlGetTermios
../../crypto/ssh/terminal/util.go:75:9: undefined: unix.IoctlSetTermios
../../crypto/ssh/terminal/util.go:80:13: undefined: unix.IoctlGetWinsize
../../crypto/ssh/terminal/util.go:98:18: undefined: unix.IoctlGetTermios
../../crypto/ssh/terminal/util.go:107:12: undefined: unix.IoctlSetTermios
../../crypto/ssh/terminal/util.go:112:3: undefined: unix.IoctlSetTermios
@tklauser
Copy link
Member

@tklauser tklauser commented Nov 14, 2017

/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64/compile [...] -importmap golang.org/x/sys/unix=golang.org/x/crypto/vendor/golang.org/x/sys/unix [...]

@sapiens-sapide looks like your build is using a (outdated) vendored copy of x/sys/unix in x/crypto. But upstream x/crypto doesn't even have a vendor directory. Looks like your copy of x/crypto was somehow changed. Could you reset it to master and make sure to git clean all untracked files?

@sapiens-sapide
Copy link
Author

@sapiens-sapide sapiens-sapide commented Nov 14, 2017

@tklauser : removing the vendor directory within x/crypto fix the issue, thanks.

Could it be the brew upgrade go recipe that messed up my go repo ?

Thank your for your quick help !

Regards,
Stan.

@tklauser
Copy link
Member

@tklauser tklauser commented Nov 14, 2017

@sapiens-sapide I don't use homebrew, so I cannot really tell, sorry. AFAIK the Go package in homebrew is not maintained by the Go project, so it's probably best to check with the package's maintainer.

@janisz
Copy link

@janisz janisz commented Nov 14, 2017

I was hit by this after updating my vendor https://travis-ci.org/allegro/marathon-consul/builds/301938144#L596

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Nov 14, 2017

Thanks all for the investigation. Closing because there is nothing to fix in the Go project.

@Ullaakut
Copy link

@Ullaakut Ullaakut commented Dec 1, 2017

Happens to my CI as well with a fresh context, in an alpine Docker image.

It downloads all vendors from scratch everytime using glide, and yet it always gives me the same errors as the other people here:

Step 6/12 : RUN go build -o cameradar
 ---> Running in 4d75c30fe5bc
# github.com/EtixLabs/cameradar/vendor/golang.org/x/crypto/ssh/terminal
../vendor/golang.org/x/crypto/ssh/terminal/util.go:30:12: undefined: unix.IoctlGetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:38:18: undefined: unix.IoctlGetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:54:12: undefined: unix.IoctlSetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:64:18: undefined: unix.IoctlGetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:75:9: undefined: unix.IoctlSetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:80:13: undefined: unix.IoctlGetWinsize
../vendor/golang.org/x/crypto/ssh/terminal/util.go:98:18: undefined: unix.IoctlGetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:107:12: undefined: unix.IoctlSetTermios
../vendor/golang.org/x/crypto/ssh/terminal/util.go:112:3: undefined: unix.IoctlSetTermios
The command '/bin/sh -c go build -o cameradar' returned a non-zero code: 2

See https://travis-ci.org/EtixLabs/cameradar/builds/310140604 for full build logs.

The version of golang.org/x/crypto that it uses is the commit 2509b142fb2b797aa7587dad548f113b2c0f20ce.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Dec 1, 2017

@Ullaakut This issue is closed, and it was about Darwin, not Alpine. Please open a new issue with full details.

@shoenseiwaso
Copy link

@shoenseiwaso shoenseiwaso commented Feb 14, 2018

For those encountering this issue on Go 1.9.3 or 1.9.4 on Darwin (macOS), the following worked for me to fix the problem:

$ cd $GOPATH/src/golang.org/x/sys/unix
$ git pull
$ go build -x golang.org/x/crypto/ssh/terminal  # <== should no longer return errors
@Ullaakut
Copy link

@Ullaakut Ullaakut commented Feb 14, 2018

And if you have this issue in your CI, it's probably because of glide. Turns out that switching to dep fixed the issue for me.

@golang golang locked as resolved and limited conversation to collaborators Feb 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.