gokrazy / tools

this repository contains the gok CLI tool of gokrazy
https://gokrazy.org
BSD 3-Clause "New" or "Revised" License
50 stars 28 forks source link

undefined: unix.SYS_IOCTL on OSX #17

Closed andig closed 3 years ago

andig commented 3 years ago

Installing latest fails on OSX 11.1:

❯ go version 
go version go1.15.6 darwin/amd64

~/htdocs/evcc-image main*
❯ go get github.com/gokrazy/tools/cmd/gokr-packer
Alias tip: gog github.com/gokrazy/tools/cmd/gokr-packer
go: found github.com/gokrazy/tools/cmd/gokr-packer in github.com/gokrazy/tools v0.0.0-20201230092410-3ba8b7f3a861
# github.com/gokrazy/tools/cmd/gokr-packer
../../go/pkg/mod/github.com/gokrazy/tools@v0.0.0-20201230092410-3ba8b7f3a861/cmd/gokr-packer/parttable_darwin.go:21:33: undefined: unix.SYS_IOCTL
../../go/pkg/mod/github.com/gokrazy/tools@v0.0.0-20201230092410-3ba8b7f3a861/cmd/gokr-packer/parttable_darwin.go:24:33: undefined: unix.SYS_IOCTL

I'm unsure how this happens as I have run gokr-packer before today?

stapelberg commented 3 years ago

I can’t reproduce this problem:

m1a ~/hello % go version
go version go1.16beta1 darwin/arm64
m1a ~/hello % go get github.com/gokrazy/tools/cmd/gokr-packer
go: downloading github.com/gokrazy/tools v0.0.0-20201230092410-3ba8b7f3a861
go: downloading github.com/gokrazy/gokrazy v0.0.0-20200626095651-fc121e1383ba
go: downloading github.com/gokrazy/internal v0.0.0-20200626090505-539bb61868de
go: downloading golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
go: downloading golang.org/x/sys v0.0.0-20200523222454-059865788121
go get: added github.com/gokrazy/tools v0.0.0-20201230092410-3ba8b7f3a861
m1a ~/hello % gokr-packer -help

gokr-packer packs gokrazy installations into SD card or file system images.
[…]

Can you try in a directory with a fresh go.mod file, or take a look at whether anything else on your system seems off/non-standard?

andig commented 3 years ago

Looks like some weird goish issue. It runs fine in the one second but not in the next:

~/htdocs/gokrazy/tools master*
❯ go run github.com/gokrazy/tools/cmd/gokr-packer -update yes -hostname evcc -tls=self-signed -insecure github.com/gokrazy/breakglass github.com/andig/evcc
github.com/gokrazy/breakglass github.com/andig/evcc
2021/01/04 12:10:29 packer.go:353: building [github.com/gokrazy/breakglass github.com/andig/evcc]
go: finding module for package github.com/gokrazy/firmware
go: finding module for package github.com/gokrazy/kernel
go: finding module for package github.com/andig/evcc
go: finding module for package github.com/gokrazy/breakglass
go: downloading github.com/andig/evcc v0.0.0-20210104105636-b5a98bd15399
go: found github.com/gokrazy/breakglass in github.com/gokrazy/breakglass v0.0.0-20200527163858-efff2172eebe
go: found github.com/andig/evcc in github.com/andig/evcc v0.0.0-20210104105636-b5a98bd15399
go: found github.com/gokrazy/kernel in github.com/gokrazy/kernel v0.0.0-20210101095007-be3fbfd0e58b
go: found github.com/gokrazy/firmware in github.com/gokrazy/firmware v0.0.0-20201230141210-fb0c003a640d
2021/01/04 12:10:43 httpclient.go:46: Using certificate /Users/andig/Library/Application Support/gokrazy/hosts/evcc/cert.pem
2021/01/04 12:10:43 packer.go:825: checking target partuuid support: Get "https://gokrazy:***@evcc/update/features": dial tcp 192.168.0.63:443: connect: connection refused
exit status 1

~/htdocs/gokrazy/tools master* 15s
❯ go run github.com/gokrazy/tools/cmd/gokr-packer -update yes -hostname evcc -tls=self-signed -insecure github.com/gokrazy/breakglass github.com/andig/evcc
github.com/gokrazy/breakglass github.com/andig/evcc
# github.com/gokrazy/tools/cmd/gokr-packer
cmd/gokr-packer/parttable_darwin.go:21:33: undefined: unix.SYS_IOCTL
cmd/gokr-packer/parttable_darwin.go:24:33: undefined: unix.SYS_IOCTL

Should I migrate this to the go repo?

andig commented 3 years ago

Here are steps to reproduce. In only happens on the 2nd build run and it does not happen with the hello app:

git clone https://github.com/gokrazy/tools gokrazy-tools3
cd gokrazy-tools3

go run github.com/gokrazy/tools/cmd/gokr-packer -hostname foo -overwrite foo -target_storage_bytes=1153441792 github.com/gokrazy/hello

go run github.com/gokrazy/tools/cmd/gokr-packer -hostname foo -overwrite foo -target_storage_bytes=1153441792 github.com/gokrazy/hello

go run github.com/gokrazy/tools/cmd/gokr-packer -hostname foo -overwrite foo -target_storage_bytes=1153441792 github.com/andig/evcc

go run github.com/gokrazy/tools/cmd/gokr-packer -hostname foo -overwrite foo -target_storage_bytes=1153441792 github.com/andig/evcc

Last one errors:

cmd/gokr-packer/parttable_darwin.go:21:33: undefined: unix.SYS_IOCTL
cmd/gokr-packer/parttable_darwin.go:24:33: undefined: unix.SYS_IOCTL

Are you able to reproduce this?

andig commented 3 years ago

Inbetween the go.mod gets updated:

golang.org/x/sys v0.0.0-20200523222454-059865788121
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211

Seems that the newer x/sys has the problem?

andig commented 3 years ago

Solved in https://github.com/golang/go/issues/41868