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

Building for Raspberry PI fail #408

Closed
jaboto opened this issue Aug 26, 2019 · 9 comments
Closed

Building for Raspberry PI fail #408

jaboto opened this issue Aug 26, 2019 · 9 comments

Comments

@jaboto
Copy link

jaboto commented Aug 26, 2019

Hello,

I have been having some issues while getting chezmoi working on my Raspbian. After some issues already reported and successfully solved I ran into the following:

jaime@piBRU:~ $ go get -u github.com/twpayne/chezmoi`
[*many packaged found, downloaded and extracted* ]
go/pkg/mod/github.com/twpayne/chezmoi@v1.6.1/cmd/completion.go:31:17: rootCmd.GenFishCompletion undefined (type *cobra.Command has no field or method GenFishCompletion)
jaime@piBRU:~ $ go env
GOARCH="arm"
GOBIN=""
GOCACHE="/home/jaime/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jaime/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm"
GCCGO="gccgo"
GOARM="6"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build181371003=/tmp/go-build -gno-record-gcc-switches"

As I was having some issues while getting go-github (see #issue-355 ) I have set the GO111MODULE as below:

jaime@piBRU:~ $ export | grep -i GO
declare -x GO111MODULE="on"
declare -x OLDPWD="/home/jaime/go"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin"

Not sure if someone has run into this and how to solve it.

Thanks.

@twpayne
Copy link
Owner

twpayne commented Aug 26, 2019

You need to build with Go 1.12 or later and GO111MODULE=on.

@twpayne
Copy link
Owner

twpayne commented Aug 26, 2019

BTW the explanation for this line:

@twpayne twpayne closed this as completed Aug 26, 2019
@twpayne twpayne reopened this Aug 26, 2019
@twpayne
Copy link
Owner

twpayne commented Aug 26, 2019

(sorry hit wrong button)

The explanation for this line:

go/pkg/mod/github.com/twpayne/chezmoi@v1.6.1/cmd/completion.go:31:17: rootCmd.GenFishCompletion undefined (type *cobra.Command has no field or method GenFishCompletion)

is:

  1. chezmoi includes completions for the fish shell.
  2. These completions are generated by github.com/spf13/cobra.
  3. We're still waiting for fish completions to be merged into cobra (add fish completion support spf13/cobra#754).
  4. In the meantime chezmoi is using a fork of spf13/cobra with the fish completion PR merged.
  5. This fork is selected using this line in go.mod.

The above error likely comes from the go.mod file not being respected, e.g. by using an older version of Go or having Go modules disabled.

@jaboto
Copy link
Author

jaboto commented Aug 26, 2019

Hi @twpayne. Thanks for your quick response.

I am using Go version 1.12.9:

jaime@piBRU:~ $ go version
go version go1.12.9 linux/arm

Also, the GO111MODULE is on:

jaime@piBRU:~ $ export | grep -i GO
declare -x GO111MODULE="on"
declare -x OLDPWD="/home/jaime/go/pkg/mod/cache/download/github.com/twpayne/chezmoi/@v"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/go/bin"

So not sure why is not working.

Trace:

jaime@piBRU:~ $ GO111MODULE=on go get -u github.com/twpayne/chezmoi
go: finding github.com/zalando/go-keyring latest
go: finding golang.org/x/net latest
go: finding golang.org/x/sys latest
go: finding golang.org/x/crypto latest
go: finding github.com/hectane/go-acl latest
go: finding github.com/tmc/grpc-websocket-proxy latest
go: finding github.com/golang/groupcache latest
go: finding golang.org/x/oauth2 latest
go: finding golang.org/x/time latest
go: finding golang.org/x/sync latest
go: finding github.com/armon/consul-api latest
go: finding gopkg.in/check.v1 latest
go: finding golang.org/x/tools latest
go: finding google.golang.org/genproto latest
go: finding github.com/coreos/go-systemd latest
go: finding github.com/golang/glog latest
go: finding github.com/coreos/pkg latest
go: finding golang.org/x/lint latest
go: finding github.com/alecthomas/template latest
go: finding golang.org/x/exp latest
go: finding github.com/xiang90/probing latest
go: finding github.com/mwitkow/go-conntrack latest
go: finding github.com/prometheus/client_model latest
go: finding github.com/dgryski/go-sip13 latest
go: finding golang.org/x/xerrors latest
go: finding github.com/BurntSushi/xgb latest
go: finding github.com/kr/logfmt latest
go: finding github.com/alecthomas/units latest
go: finding golang.org/x/image latest
go: finding github.com/modern-go/concurrent latest
go: finding golang.org/x/mobile latest
go: finding github.com/google/pprof latest
go: finding github.com/jstemmer/go-junit-report latest
# github.com/twpayne/chezmoi/cmd
go/pkg/mod/github.com/twpayne/chezmoi@v1.6.1/cmd/completion.go:31:17: rootCmd.GenFishCompletion undefined (type *cobra.Command has no field or method GenFishCompletion)

@jaboto
Copy link
Author

jaboto commented Aug 26, 2019

It seems that despite the error the go/bin folder is created and chezmoi is there... Sorry to have bothered you and thanks for the quick support! :)

@jaboto jaboto closed this as completed Aug 26, 2019
@martinburger
Copy link

I have the same -- or at least a very similar -- issue.

I run a Raspberry Pi 3 Modell B Plus with the latest Raspbian Buster OS:

$ uname -a
Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

I installed the latest Go version into /opt/go:

$ /opt/go/bin/go version
go version go1.13.1 linux/arm

When I try to install chezmoi, I get the following error:

$ GO111MODULE=on /opt/go/bin/go get -u github.com/twpayne/chezmoi
go: finding golang.org/x/sys latest
go: finding golang.org/x/net latest
go: finding golang.org/x/oauth2 latest
go: finding golang.org/x/crypto latest
go: finding github.com/hectane/go-acl latest
go: finding github.com/zalando/go-keyring latest
# github.com/twpayne/chezmoi/cmd
/home/pi/go/pkg/mod/github.com/twpayne/chezmoi@v1.6.5/cmd/completion.go:31:17: rootCmd.GenFishCompletion undefined (type *cobra.Command has no field or method GenFishCompletion)

In contrast to @jaboto, I do net get any executable:

$ tree -L 2 ~/go
/home/pi/go
├── pkg
│   ├── mod
│   └── sumdb
└── src
    ├── github.com
    ├── go.etcd.io
    ├── golang.org
    └── gopkg.in

Any idea how to build chezmoi on my Raspberry Pi?

@martinburger
Copy link

@jaboto Could you reopen this issue, please? As far as I can see, I am not allowed to do this.

@twpayne
Copy link
Owner

twpayne commented Sep 29, 2019

The reason for the build failure on your machine is the one described above. This is not a bug in chezmoi. Go on your machine is not respecting the replace lines in go.mod.

There are three options for you:

@tsaarni
Copy link

tsaarni commented Dec 28, 2019

I guess there is no version of Go that respects replace lines in go.mod yet in combination with go get, so users will not be able to fix that. While replace line is needed and until Go has golang/go#31173 solved, I believe From source install method in the documentation will fail for users.

I ended up just cloning manually to work around this problem:

git clone --depth=1 https://github.com/twpayne/chezmoi.git
cd chezmoi/
go install

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants