juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
23.34k stars 1.28k forks source link

Need help compiling for arm #1337

Closed abosaad11 closed 1 year ago

abosaad11 commented 1 year ago

Hello

I really need an armhf binary and I can't compile. To start I tried compiling just as the instructions say (on a 64bit raspberry pi), which should output an arm64 binary but I'm still failing. I installed nix, protobuf tools and go and then I edited the makefile to include:

nix build --extra-experimental-features nix-command --extra-experimental-features flakes

instead of nix build

but it results in an error:

pi@raspi3:~/headscale $ make build
nix build --extra-experimental-features nix-command --extra-experimental-features flakes
warning: Git tree '/home/pi/headscale' is dirty
error: builder for '/nix/store/x3zdq6lh5w1cpiy2xmynsvb3rwy74qi6-headscale-dev.drv' failed with exit code 1;
       last 10 log lines:
       > Building subPackage ./integration
       > Building subPackage ./integration/dockertestutil
       > Building subPackage ./integration/hsic
       > Building subPackage ./integration/integrationutil
       > Building subPackage ./integration/tsic
       > buildPhase completed in 16 minutes 26 seconds
       > running tests
       > github.com/jackc/pgx/v5/pgtype: /nix/store/26gwr82s1bfd1llbwq7cvrkzqkc562in-go-1.20.2/share/go/pkg/tool/linux_arm64/compile: signal: killed
       > FAIL   github.com/juanfont/headscale [build failed]
       > FAIL
       For full logs, run 'nix log /nix/store/x3zdq6lh5w1cpiy2xmynsvb3rwy74qi6-headscale-dev.drv'.
make: *** [Makefile:22: build] Error 1

See the log:

pi@raspi3:~/headscale $ nix log /nix/store/x3zdq6lh5w1cpiy2xmynsvb3rwy74qi6-headscale-dev.drv --extra-experimental-features nix-command
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/v2kfvk4p6babyn6d0i37nlxv2g9j155z-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
Building subPackage .
Building subPackage ./cmd/gh-action-integration-generator
Building subPackage ./cmd/headscale
Building subPackage ./cmd/headscale/cli
Building subPackage ./gen/go/headscale/v1
Building subPackage ./integration
Building subPackage ./integration/dockertestutil
Building subPackage ./integration/hsic
Building subPackage ./integration/integrationutil
Building subPackage ./integration/tsic
buildPhase completed in 16 minutes 26 seconds
@nix { "action": "setPhase", "phase": "checkPhase" }
running tests
github.com/jackc/pgx/v5/pgtype: /nix/store/26gwr82s1bfd1llbwq7cvrkzqkc562in-go-1.20.2/share/go/pkg/tool/linux_arm64/compile: signal: killed
FAIL    github.com/juanfont/headscale [build failed]
FAIL

Now all this is while trying to use nix build. Here are my questions:

  1. Why is the build failing?
  2. How do I compile for armhf? Do I need to edit flake.nix? (I'm forced to use arm64 raspberry pi to install the nix and protobuf tools)

Thank you

kradalby commented 1 year ago

Hi @abosaad11 we are adding back versions for old ARM in the next release, take a look at the current alpha release and give that a go.

abosaad11 commented 1 year ago

Hi @abosaad11 we are adding back versions for old ARM in the next release, take a look at the current alpha release and give that a go.

Thank you the deb arm package works! Please continue supporting arm there are a bunch of us :)