Closed ekristen closed 7 years ago
Can you paste the errors you are running into?
First I had to upgrade the boltdb vendor dependency, after doing that this is the error I get.
gox -osarch="darwin/arm64" -ldflags '-w -s' ./tool/teleport ⏎
Number of parallel builds: 7
--> darwin/arm64: github.com/gravitational/teleport/tool/teleport
1 errors occurred:
--> darwin/arm64 error: exit status 2
Stderr: # github.com/gravitational/teleport/lib/client
lib/client/api.go:1282: undefined: GetLoginShell
# github.com/gravitational/teleport/lib/srv
lib/srv/exec.go:125: undefined: "github.com/gravitational/teleport/lib/utils".GetLoginShell
lib/srv/exec.go:176: undefined: "github.com/gravitational/teleport/lib/utils".GetLoginShell
It seems to be because there is an import C in the go file, so I modified the compile command to enable CGO but that spits out an entirely different set of errors ...
CGO_ENABLED=1 gox -osarch="darwin/arm64" -ldflags '-w -s' ./tool/teleport ⏎
Number of parallel builds: 7
--> darwin/arm64: github.com/gravitational/teleport/tool/teleport
1 errors occurred:
--> darwin/arm64 error: exit status 2
Stderr: # runtime/cgo
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:27:16: error: brackets expression not supported on this target
stp x19, x20, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:28:16: error: brackets expression not supported on this target
stp x21, x22, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:29:16: error: brackets expression not supported on this target
stp x23, x24, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:30:16: error: brackets expression not supported on this target
stp x25, x26, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:31:16: error: brackets expression not supported on this target
stp x27, x28, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:32:16: error: brackets expression not supported on this target
stp x29, x30, [sp, #-16]!
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:33:2: error: unknown use of instruction mnemonic without a size suffix
mov x29, sp
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:35:2: error: unknown use of instruction mnemonic without a size suffix
mov x19, x0
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:36:2: error: unknown use of instruction mnemonic without a size suffix
mov x20, x1
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:37:2: error: unknown use of instruction mnemonic without a size suffix
mov x0, x2
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:39:2: error: invalid instruction mnemonic 'blr'
blr x20
^~~
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:40:2: error: invalid instruction mnemonic 'blr'
blr x19
^~~
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:42:16: error: brackets expression not supported on this target
ldp x29, x30, [sp], #16
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:43:16: error: brackets expression not supported on this target
ldp x27, x28, [sp], #16
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:44:16: error: brackets expression not supported on this target
ldp x25, x26, [sp], #16
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:45:16: error: brackets expression not supported on this target
ldp x23, x24, [sp], #16
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:46:16: error: brackets expression not supported on this target
ldp x21, x22, [sp], #16
^
/usr/local/Cellar/go/1.8/libexec/src/runtime/cgo/gcc_arm64.S:47:16: error: brackets expression not supported on this target
ldp x19, x20, [sp], #16
@ekristen currently some teleport dependencies cannot be compiled for ARM64. have you tried 32-bit arm?
That gets me a little closer, I can try and dig in some more, but this is the error now
Number of parallel builds: 7
--> darwin/arm: github.com/gravitational/teleport/tool/teleport
1 errors occurred:
--> darwin/arm error: exit status 2
Stderr: # runtime/cgo
clang: error: argument unused during compilation: '-mno-thumb' [-Werror,-Wunused-command-line-argument]
darmin/arm
? are you cross-compiling? if you are, we've never tried that. for ARM builds we've used Raspberry PIs and then moved to renting Linux ARM servers on https://www.scaleway.com
Here's the latest master build for you to try: http://s3.gravitational.io/ev/teleport-v2.1.0-alpha.2-linux-arm-bin.tar.gz
md5sum: 4cc50b8a459326f123c72daa9b678e71
sha256: 9d6772f397471b24484a3713aef5a6cf5003c35c2767e1a9580cd3713535a2f1
I am attempting to cross compile using gox
Thanks for the link, this will let me PoC!
FWIW, my target platforms are iOS ARM and Android ARM.
On linux/amd64, I was able to do it with:
stephen@sdeb:~/go/src/github.com/gravitational/teleport$ GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc make
https://askubuntu.com/questions/250696/cross-compile-for-arm was my reference for how to get the cgo part working.
@ekristen did you figure this out? sorry, we've been super busy with other stuff and haven't gotten to iOS ARM (and very unlikely to look into this any time soon).
Currently I'm stuck on the following error, if anyone has experience with cross compiling, clang, etc and can offer hints or suggestions as to how to fix this I would greatly appreciate it.
Stderr: # runtime/cgo
clang: error: argument unused during compilation: '-mno-thumb' [-Werror,-Wunused-command-line-argument]
I cannot seem to figure out how to get it to ignore unused arguments unfortunately just to see if I can get it passed this point.
@ekristen we do not cross-compile Teleport. Our ARM builds are tested on Raspberry Pi 3 and on scaleway ARM servers. Get the latest Golang 1.8.3, get the repo and simply run make
.
clarification: cross-compiling CGO targets is hard, because you get into managing gcc toolchain.
I've made more progress.
export CGO_CFLAGS="-Wno-unused-command-line-argument"
gox -osarch="darwin/arm" -cgo -verbose ./tool/teleport
Number of parallel builds: 7
--> darwin/arm: github.com/gravitational/teleport/tool/teleport
1 errors occurred:
--> darwin/arm error: exit status 2
Stderr: # runtime/cgo
In file included from $WORK/runtime/cgo/_obj/_cgo_export.c:3:
cgo-gcc-export-header-prolog:25:55: error: '_check_for_32_bit_pointer_matching_GoInt' declared as an array with a negative size
@ekristen Just a heads up, with Teleport 2.2 we've announced we will be releasing ARM binaries with our releases: http://gravitational.com/blog/teleport-release-2-2/
You can download the ARM binary for Teleport 2.2 from here: https://github.com/gravitational/teleport/releases/tag/v2.2.0
+1 glad to see that, that'll be nice for a lot of different platforms. Thanks for all the work you've been doing.
Unfortunately AFAIK not all ARMs are the same, and I really need it for android and ios devices, hence my attempt to cross compile for darwin/arm(32).
@ekristen AFAIK Golang only supports ARMv6 [1] so regardless of the compilation method, you're getting the same binary unless you tell me what I do not know. ;) Please do.
For anyone else stuck on this, I was running into the same issue when cross compiling Teleport using GitLab CI, which uses Docker. I got it working by using the golang:latest
Docker image, and running
apt-get update
apt-get install -y zip gcc-arm-linux-gnueabihf
mkdir -p $GOPATH/src/github.com/gravitational
cd $GOPATH/src/github.com/gravitational
git clone https://github.com/gravitational/teleport.git
cd teleport
make full GOARCH=arm CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc VERSION=2.7.4
I have also encountered this problem (about "-mno-thumb").
The solution is disable cgo , for example follows:
export CGO_ENABLE=0; GOARCH=arm GOOS=linux go build -o foo.
I hope this will help you.
I've got a lot of ARM devices that would benefit from being able to use teleport to include mobile devices such as iPhones and Androids.
Would you consider adding ARM architectures to your build process?
I've attempted to cross compile the teleport binary for ARM but have run into a few problems with the fact that C is imported in a single location that causes compilation problems.