building armhf snap on amd64 (almost works)

knitzsche kyle.nitzsche at canonical.com
Thu Mar 24 21:21:20 UTC 2016


When I snacpraft build (2.6) my golang project on an amd64 xenial system 
(after having set go env vars for arm) [1], it fails with this:

Building learnit
env GOPATH=/root/flashcards/parts/learnit/go go install ./flashcards/...
[Errno 21] Is a directory:
'/root/flashcards/parts/learnit/go/bin/linux_arm'

Problem seems that the go.py snapcraft module is trying to copy a *file* 
with [2] but in the case of arm, it finds a directory. For golang builds 
when arm env vars are exported that (linux_arm) is a directory that 
*contains* the executable.

(When building go snaps for amd64 on amd64 host that subdir does not 
exist and all is well.)

Anyway, I hacked go.py so I coul build my armhf snap on the amd64 host 
(resulting in learnit snap in store), but: am I doing this the wrong way? :)

[1] export GOARCH=arm GOARM=7 CGO_ENABLED=1 CC=arm-linux-gnueabihf-gcc
[2] 
https://github.com/ubuntu-core/snapcraft/blob/master/snapcraft/plugins/go.py#L123

Cheers,
Kyle



More information about the snappy-app-devel mailing list