Reputation: 2922
I'm trying to compile kaniko on a raspberry pi.
I don't program in golang, but I was able to compile kaniko successfully a few weeks ago on the same raspberry pi, and even wrote myself a guide of the steps to follow, but now, following the same steps, something is broken.
kaiko requires go
, but a more recent version of go
then found in the raspberry pi repos, so I download and install go
from scratch. go
requires go
to compile, so I first install it (an older version) from the repos, and then remove it after it's done compiling a more recent version of itself:
Install go
:
sudo apt-get install golang
wget https://dl.google.com/go/go1.17.6.src.tar.gz
tar -xvf go1.17.6.src.tar.gz
cd go/src
./make.bash
sudo apt-get purge golang golang-go
sudo mv -v ../bin/* /usr/local/bin
echo 'export GOPATH=~/.go' >> ~/.profile
echo 'export GOROOT=/usr/local/bin' >> ~/.profile
source ~/.profile
Compile kaniko:
sudo apt-get install git
git clone https://github.com/GoogleContainerTools/kaniko.git
cd kaniko
make
What I get is this:
GOARCH=arm GOOS=linux CGO_ENABLED=0 go build -ldflags '-extldflags "-static" -X github.com/GoogleContainerTools/kaniko/pkg/version.version=v1.7.0 -w -s ' -o out/executor github.com/GoogleContainerTools/kaniko/cmd/executor
pkg/util/fs_util.go:20:2: cannot find package "." in:
/home/pi/kaniko/vendor/archive/tar
vendor/google.golang.org/grpc/internal/binarylog/sink.go:22:2: cannot find package "." in:
/home/pi/kaniko/vendor/bufio
vendor/cloud.google.com/go/storage/storage.go:18:2: cannot find package "." in:
/home/pi/kaniko/vendor/bytes
pkg/util/tar_util.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/compress/bzip2
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/compressed.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/compress/flate
vendor/google.golang.org/protobuf/internal/impl/legacy_file.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/compress/gzip
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/compressed.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/compress/zlib
vendor/golang.org/x/text/unicode/bidi/bracket.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/container/list
vendor/cloud.google.com/go/compute/metadata/metadata.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/context
vendor/golang.org/x/oauth2/jws/jws.go:19:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto
vendor/google.golang.org/grpc/credentials/alts/internal/conn/aeadrekey.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/aes
vendor/google.golang.org/grpc/credentials/alts/internal/conn/aeadrekey.go:24:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/cipher
vendor/github.com/ProtonMail/go-crypto/openpgp/internal/algorithm/cipher.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/des
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/private_key.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/dsa
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/private_key.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/ecdsa
vendor/golang.org/x/crypto/ed25519/ed25519_go113.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/ed25519
vendor/github.com/ProtonMail/go-crypto/openpgp/ecdh/ecdh.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/elliptic
vendor/golang.org/x/oauth2/google/internal/externalaccount/aws.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/hmac
vendor/github.com/google/uuid/hash.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/md5
vendor/golang.org/x/net/http2/transport.go:14:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/rand
vendor/golang.org/x/crypto/ssh/cipher.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/rc4
vendor/golang.org/x/oauth2/internal/oauth2.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/rsa
vendor/github.com/google/uuid/hash.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/sha1
vendor/golang.org/x/oauth2/google/internal/externalaccount/aws.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/sha256
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/public_key.go:15:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/sha512
vendor/github.com/ProtonMail/go-crypto/eax/eax.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/subtle
vendor/google.golang.org/grpc/credentials/tls.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/tls
vendor/google.golang.org/grpc/credentials/tls.go:24:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/x509
vendor/golang.org/x/crypto/pkcs12/crypto.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/crypto/x509/pkix
vendor/github.com/google/uuid/null.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/database/sql/driver
vendor/github.com/cilium/ebpf/elf_reader.go:6:2: cannot find package "." in:
/home/pi/kaniko/vendor/debug/elf
vendor/github.com/golang/protobuf/proto/text_decode.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/signature.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/asn1
vendor/google.golang.org/protobuf/encoding/protojson/decode.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/base64
vendor/google.golang.org/protobuf/internal/detrand/rand.go:13:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/binary
vendor/github.com/moby/buildkit/frontend/dockerfile/instructions/commands_runmount.go:4:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/csv
vendor/github.com/go-git/gcfg/set.go:5:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/gob
vendor/golang.org/x/oauth2/google/internal/externalaccount/aws.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/hex
vendor/cloud.google.com/go/compute/metadata/metadata.go:24:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/json
vendor/golang.org/x/oauth2/internal/oauth2.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/pem
vendor/github.com/Azure/azure-storage-blob-go/azblob/zc_storage_error.go:5:2: cannot find package "." in:
/home/pi/kaniko/vendor/encoding/xml
vendor/google.golang.org/protobuf/internal/errors/errors.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/errors
vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go:18:2: cannot find package "." in:
/home/pi/kaniko/vendor/expvar
vendor/github.com/docker/docker/pkg/chrootarchive/archive_unix.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/flag
cmd/executor/cmd/root.go:20:2: cannot find package "." in:
/home/pi/kaniko/vendor/fmt
vendor/github.com/cilium/ebpf/internal/output.go:6:2: cannot find package "." in:
/home/pi/kaniko/vendor/go/format
vendor/github.com/cilium/ebpf/internal/output.go:7:2: cannot find package "." in:
/home/pi/kaniko/vendor/go/scanner
vendor/google.golang.org/protobuf/internal/strs/strings.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/go/token
vendor/github.com/google/uuid/hash.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/hash
vendor/google.golang.org/protobuf/internal/impl/legacy_export.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/hash/crc32
vendor/github.com/vbatts/tar-split/tar/storage/getter.go:6:2: cannot find package "." in:
/home/pi/kaniko/vendor/hash/crc64
vendor/google.golang.org/protobuf/internal/detrand/rand.go:14:2: cannot find package "." in:
/home/pi/kaniko/vendor/hash/fnv
vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go:15:2: cannot find package "." in:
/home/pi/kaniko/vendor/html
vendor/golang.org/x/net/trace/events.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/html/template
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/userattribute.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/image
vendor/github.com/ProtonMail/go-crypto/openpgp/packet/userattribute.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/image/jpeg
vendor/cloud.google.com/go/compute/metadata/retry.go:19:2: cannot find package "." in:
/home/pi/kaniko/vendor/io
vendor/github.com/opencontainers/selinux/pkg/pwalkdir/pwalkdir.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/io/fs
vendor/cloud.google.com/go/compute/metadata/metadata.go:26:2: cannot find package "." in:
/home/pi/kaniko/vendor/io/ioutil
vendor/golang.org/x/net/internal/timeseries/timeseries.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/log
vendor/github.com/Azure/azure-pipeline-go/pipeline/defaultlog_syslog.go:7:2: cannot find package "." in:
/home/pi/kaniko/vendor/log/syslog
vendor/google.golang.org/protobuf/encoding/protowire/wire.go:14:2: cannot find package "." in:
/home/pi/kaniko/vendor/math
vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/math/big
vendor/google.golang.org/protobuf/encoding/protowire/wire.go:15:2: cannot find package "." in:
/home/pi/kaniko/vendor/math/bits
vendor/cloud.google.com/go/compute/metadata/retry.go:20:2: cannot find package "." in:
/home/pi/kaniko/vendor/math/rand
vendor/golang.org/x/oauth2/internal/token.go:15:2: cannot find package "." in:
/home/pi/kaniko/vendor/mime
vendor/google.golang.org/api/internal/gensupport/media.go:13:2: cannot find package "." in:
/home/pi/kaniko/vendor/mime/multipart
vendor/cloud.google.com/go/compute/metadata/metadata.go:27:2: cannot find package "." in:
/home/pi/kaniko/vendor/net
vendor/cloud.google.com/go/compute/metadata/metadata.go:28:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/http
vendor/github.com/Azure/go-autorest/autorest/adal/sender.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/http/cookiejar
vendor/golang.org/x/net/http2/go111.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/http/httptrace
vendor/google.golang.org/grpc/internal/transport/proxy.go:29:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/http/httputil
vendor/golang.org/x/net/http/httpguts/guts.go:13:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/textproto
vendor/cloud.google.com/go/compute/metadata/metadata.go:29:2: cannot find package "." in:
/home/pi/kaniko/vendor/net/url
vendor/cloud.google.com/go/compute/metadata/metadata.go:30:2: cannot find package "." in:
/home/pi/kaniko/vendor/os
vendor/google.golang.org/api/transport/cert/default_cert.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/os/exec
vendor/github.com/moby/term/term.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/os/signal
vendor/golang.org/x/oauth2/google/sdk.go:16:2: cannot find package "." in:
/home/pi/kaniko/vendor/os/user
vendor/golang.org/x/oauth2/google/internal/externalaccount/aws.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/path
vendor/google.golang.org/grpc/internal/transport/http2_client.go:28:2: cannot find package "." in:
/home/pi/kaniko/vendor/path/filepath
vendor/google.golang.org/protobuf/internal/descfmt/stringer.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/reflect
vendor/google.golang.org/protobuf/internal/encoding/text/decode.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/regexp
vendor/cloud.google.com/go/compute/metadata/metadata.go:31:2: cannot find package "." in:
/home/pi/kaniko/vendor/runtime
vendor/github.com/google/go-containerregistry/pkg/v1/remote/transport/useragent.go:20:2: cannot find package "." in:
/home/pi/kaniko/vendor/runtime/debug
vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/runtime/metrics
vendor/go.opencensus.io/tag/profile_19.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/runtime/pprof
vendor/go.opencensus.io/trace/trace_go11.go:21:2: cannot find package "." in:
/home/pi/kaniko/vendor/runtime/trace
vendor/google.golang.org/protobuf/internal/order/range.go:9:2: cannot find package "." in:
/home/pi/kaniko/vendor/sort
vendor/google.golang.org/protobuf/reflect/protoreflect/source.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/strconv
vendor/cloud.google.com/go/compute/metadata/metadata.go:32:2: cannot find package "." in:
/home/pi/kaniko/vendor/strings
vendor/cloud.google.com/go/compute/metadata/metadata.go:33:2: cannot find package "." in:
/home/pi/kaniko/vendor/sync
vendor/google.golang.org/protobuf/internal/filedesc/desc.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/sync/atomic
vendor/cloud.google.com/go/compute/metadata/retry_linux.go:20:8: cannot find package "." in:
/home/pi/kaniko/vendor/syscall
vendor/github.com/otiai10/copy/test_setup.go:8:2: cannot find package "." in:
/home/pi/kaniko/vendor/testing
vendor/github.com/docker/docker/pkg/fileutils/fileutils.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/text/scanner
vendor/golang.org/x/net/trace/events.go:20:2: cannot find package "." in:
/home/pi/kaniko/vendor/text/tabwriter
pkg/timing/timing.go:23:2: cannot find package "." in:
/home/pi/kaniko/vendor/text/template
vendor/cloud.google.com/go/compute/metadata/metadata.go:34:2: cannot find package "." in:
/home/pi/kaniko/vendor/time
vendor/google.golang.org/protobuf/internal/strs/strings.go:11:2: cannot find package "." in:
/home/pi/kaniko/vendor/unicode
vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/unicode/utf16
vendor/google.golang.org/protobuf/internal/strs/strings.go:12:2: cannot find package "." in:
/home/pi/kaniko/vendor/unicode/utf8
vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go:10:2: cannot find package "." in:
/home/pi/kaniko/vendor/unsafe
make: *** [Makefile:51: out/executor] Error 1
It seems that go
can't find the kaniko source code. Why is that? What am I doing wrong?
Upvotes: 1
Views: 5885
Reputation: 20430
Based on the comments, my suggestion is to add $HOME/go/bin
to the path and use the default GOPATH.
Go mod depends on the bin directory inside the GOPATH. It installs new packages there. The go binary itself can actually reside somewhere else. If you follow these install instruction https://go.dev/doc/install, go itself will actually be in /usr/local/go
but the GOPATH
is still $HOME/go
.
I would also recommend, not involving apt in this at all. This looks like trouble in the form of conflicts with different installations.
Upvotes: 1