Skip to content

Instantly share code, notes, and snippets.

@bgulla
Last active November 18, 2021 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgulla/43a9834cd2d4a42a210e9e29737126e4 to your computer and use it in GitHub Desktop.
Save bgulla/43a9834cd2d4a42a210e9e29737126e4 to your computer and use it in GitHub Desktop.
Installing oc-cli on Jetson Nano

Building oc-cli for ARM Architectures

ARM64/AARCH64 (Jetson Nano) or RPi 4

cd $GOPATH
git clone -b release-3.11 https://github.com/openshift/origin.git
sudo apt install libgpgme-dev -y 
mkdir -p src/github.com/openshift
mv origin src/github.com/openshift/
go build -v github.com/openshift/origin/cmd/oc

armv7l Raspberry Pi 3 - built on OSX with cross-compile due to RAM constraints

cd $GOPATH
git clone -b release-3.11 https://github.com/openshift/origin.git
mkdir -p src/github.com/openshift
mv origin src/github.com/openshift/
env GOOS=linux GOARCH=arm GOARM=7 go build -v github.com/openshift/origin/cmd/oc

armv6l Raspberry Pi Zero - built on OSX with cross-compile due to RAM constraints

cd $GOPATH
git clone -b release-3.11 https://github.com/openshift/origin.git
mkdir -p src/github.com/openshift
mv origin src/github.com/openshift/
env GOOS=linux GOARCH=arm GOARM=6 go build -v github.com/openshift/origin/cmd/oc
@yusufhm
Copy link

yusufhm commented Nov 18, 2021

Building on Apple M1

I tried the steps above on the M1, but it failed with the new versions of Go. What I ended up doing was building it in a container instead, with an older version of Origin (3.6) and an older version of Go (1.9). Later versions of Origin threw a gssapi missing error, while on version 3.6, it recognised Go >= 1.10 as being lower than 1.7, which was the minimum requirement.

Here's what I had to do:

cd $GOPATH
mkdir -p src/github.com/openshift
git clone -b release-3.6 https://github.com/openshift/origin.git src/github.com/openshift/origin
cd src/github.com/openshift/origin
docker run --rm -v $PWD:/go/src/github.com/openshift/origin -w /go/src/github.com/openshift/origin -it golang:1.9 make build WHAT=cmd/oc
docker run --rm -v $PWD/_output/local/bin/linux/arm64/oc:/usr/local/bin/oc -it golang:1.9 oc version

That obviously means you cannot run it on Mac directly but will always have to go through docker, but that's a compromise I'm fine with. The other way would have been to compile Go 1.9 on the Mac and then build oc from there, which I didn't have time to figure out how to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment