Gitea ARM7 build (Raspberry PI 2)

I’m hosting my projects code on a Gitea instance running on a Raspberry PI. Thing is, the last Raspbian update broke the gitea binary: probably some change in the kernel or libc. The official gitea build for ARM kept crashing with a segmentation fault before even entering the main. Of course, latest gitea builds were also broken. Only building Gitea from source eventually fixed the issue.

I had to bump the swapfile size a bit as the build process burst to 1.2Go of memory (RPI2 have 1Go, and default swap was set to 100Mo… Murphy strikes again) :

$ dphys-swapfile swapoff
# Edit the size in /etc/dphys-swapfile
# Then recreate the swap
$ dphys-swapfile setup
$ dphys-swapfile swapon

Grab an up-to-date golang compiler:

$ docker pull golang
$ docker run -it golang bash

Now, inside the container, retrieve the source and build:

% export GOOS=linux GOARCH=arm GOARM=7
% go get -d -u code.gitea.io/gitea
% cd $GOPATH/src/code.gitea.io/gitea
% git checkout v1.12.5
% TAGS="bindata sqlite sqlite_unlock_notify" make build

Retrieve the file:

$ docker cp [your container name]:/go/src/code.gitea.io/gitea/gitea gitea-1.12.5-linux-arm-7
# My service file references the gitea symlimk, just point to the new file
$ ln -sf gitea-1.12.5-linux-arm-7 gitea
$ systemctl restart gitea
Cyrille Froehlich
Cyrille Froehlich
Software developer