Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
feat(arm): Add build and install support for armv6 and arm64
Browse files Browse the repository at this point in the history
On path to close #1807 on [oauth2_proxy arm support](oauth2-proxy/oauth2-proxy#16)

Tested:
- Building armv6 and arm64 binaries on amd64
- Running arm binaries
- Using armv6 binary on RPi 3B to build another project [oauth2_proxy](https://github.com/kskewes/oauth2_proxy/tree/build)
  (`dep ensure`)

Not verified:
- Install script completes as binaries not published, looks okay
though.
- `hack/test.bash` - must have missed something.

armv6 (RPi 3B):
```
karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ dep version
dep:
 version     : v0.5.0-31-g73b3afef-dirty
 build date  : 2019-02-01
 git hash    : 73b3afe
 go version  : go1.11.5
 go compiler : gc
 platform    : linux/arm
 features    : ImportDuringSolve=false

karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ make dep
dep ensure --vendor-only

karl@pi1:~/go/src/github.com/pusher/oauth2_proxy $ uname -m
armv7l

karl@pi1:~ $ ./install.sh
ARCH = arm
OS = linux
Will install into /home/karl/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm..
Request failed with code 404

karl@pi1:~ $ ./test.bash
go test: -race is only supported on linux/amd64, linux/ppc64le, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
```

arm64 (Rock64):
```
rock64@k8s-w-01:~$ ./dep-linux-arm64 version
dep:
 version     : v0.5.0-31-g73b3afef-dirty
 build date  : 2019-02-01
 git hash    : 73b3afe
 go version  : go1.11.5
 go compiler : gc
 platform    : linux/arm64
 features    : ImportDuringSolve=false

rock64@k8s-w-01:~$ uname -m
aarch64

rock64@k8s-w-01:~$ ./install.sh
ARCH = arm64
OS = linux
Will install into /home/rock64/go/bin
Fetching https://github.com/golang/dep/releases/latest..
Release Tag = v0.5.0
Fetching https://github.com/golang/dep/releases/tag/v0.5.0..
Fetching https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-arm64..
Request failed with code 404
```
  • Loading branch information
karlskewes committed Jan 31, 2019
1 parent 73b3afe commit 5ae9d8b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ jobs:
- release/dep-linux-ppc64le.sha256
- release/dep-linux-s390x
- release/dep-linux-s390x.sha256
- release/dep-linux-armv6
- release/dep-linux-armv6.sha256
- release/dep-linux-arm64
- release/dep-linux-arm64.sha256
skip_cleanup: true
on:
repo: golang/dep
Expand Down
6 changes: 3 additions & 3 deletions hack/build-all.bash
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if [[ -z "${DEP_BUILD_PLATFORMS}" ]]; then
fi

if [[ -z "${DEP_BUILD_ARCHS}" ]]; then
DEP_BUILD_ARCHS="amd64 386 ppc64 ppc64le s390x"
DEP_BUILD_ARCHS="amd64 386 ppc64 ppc64le s390x arm arm64"
fi

mkdir -p "${DEP_ROOT}/release"
Expand All @@ -50,8 +50,8 @@ for OS in ${DEP_BUILD_PLATFORMS[@]}; do
else
CGO_ENABLED=0
fi
if [[ "${ARCH}" == "ppc64" || "${ARCH}" == "ppc64le" || "${ARCH}" == "s390x" ]] && [[ "${OS}" != "linux" ]]; then
# ppc64, ppc64le, and s390x are only supported on Linux.
if [[ "${ARCH}" == "ppc64" || "${ARCH}" == "ppc64le" || "${ARCH}" == "s390x" || "${ARCH}" == "arm" || "${ARCH}" == "arm64" ]] && [[ "${OS}" != "linux" ]]; then
# ppc64, ppc64le, s390x, arm and arm64 are only supported on Linux.
echo "Building for ${OS}/${ARCH} not supported."
else
echo "Building for ${OS}/${ARCH} with CGO_ENABLED=${CGO_ENABLED}"
Expand Down
3 changes: 3 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ initArch() {
ppc64) ARCH="ppc64";;
ppc64le) ARCH="ppc64le";;
s390x) ARCH="s390x";;
armv6*) ARCH="arm";;
armv7*) ARCH="arm";;
aarch64) ARCH="arm64";;
*) echo "Architecture ${ARCH} is not supported by this installation script"; exit 1;;
esac
echo "ARCH = $ARCH"
Expand Down

0 comments on commit 5ae9d8b

Please sign in to comment.