[Bug] Unable to compile latest codes #936

Closed
opened 2025-12-29 02:26:24 +01:00 by adam · 15 comments
Owner

Originally created by @Blason on GitHub (Feb 3, 2025).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi Team,

Since this morning I am unable to compile the codes. I tried all possibilities even completely cleaned my go Env and downloaded latest one but still no luck.

error: builder for '/nix/store/gqn8m6053n2kvn902p5dh2sfss5r2h5v-headscale-dev.drv' failed with exit code 1; last 10 log lines: > Running phase: unpackPhase > unpacking source archive /nix/store/zjyrrwswkpdsq1h38p8gn3yyk4b06dxy-source > source root is source > Running phase: patchPhase > Running phase: updateAutotoolsGnuConfigScriptsPhase > Running phase: configurePhase > Running phase: buildPhase > Building subPackage ./cmd/headscale > cmd/headscale/cli/api_key.go:8:2: cannot find module providing package github.com/juanfont/headscale/gen/go/headscale/v1: import lookup disabled by -mod=vendor > swagger.go:12:12: pattern gen/openapiv2/headscale/v1/headscale.swagger.json: no matching files found For full logs, run 'nix log /nix/store/gqn8m6053n2kvn902p5dh2sfss5r2h5v-headscale-dev.drv'.

Expected Behavior

These are all commands we tried but no luck
2015 make generate 2016 make build 2017 go build -o headscale . 2018 go build -mod=vendor -o headscale . 2019 go mod vendor 2020 make generate 2021 go get github.com/juanfont/headscale/gen/go/headscale/v1 2022 go mod tidy 2023 go mod vendor 2024 make genrate 2025 make generate 2026 which protoc-gen-go-grpc 2027 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2028 export PATH="$PATH:$(go env GOPATH)/bin" 2029 which protoc-gen-go-grpc 2030 go version 2031 go clean -modcache 2032 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2033 go env GOROOT 2034 sudo rm -rf /usr/local/go 2035 cd /opt/ 2036 ls 2037 wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz 2038 tar -C /usr/local/ -xzf go1.23.5.linux-amd64.tar.gz 2039 export PATH=$PATH:/usr/local/go/bin 2040 unset GOROOT 2041 export GOROOT=/usr/local/go 2042 go clean -modcache 2043 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2044 cd headscale/ 2045 ls 2046 make generate 2047 make build 2048 go mod vendor 2049 go get github.com/juanfont/headscale/gen/go/headscale/v1 2050 make clean 2051 make build 2052 go build -mod=mod ./... 2053 make generate 2054 nix build 2055 history

Steps To Reproduce

OS is Ubuntu 22.04

Environment

- OS: Ubuntu 22.04
- Headscale version: 0.24.2
- Tailscale version: NA

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

I am unable to compile

Originally created by @Blason on GitHub (Feb 3, 2025). ### Is this a support request? - [x] This is not a support request ### Is there an existing issue for this? - [x] I have searched the existing issues ### Current Behavior Hi Team, Since this morning I am unable to compile the codes. I tried all `possibilities` even completely cleaned my go Env and downloaded latest one but still no luck. `error: builder for '/nix/store/gqn8m6053n2kvn902p5dh2sfss5r2h5v-headscale-dev.drv' failed with exit code 1; last 10 log lines: > Running phase: unpackPhase > unpacking source archive /nix/store/zjyrrwswkpdsq1h38p8gn3yyk4b06dxy-source > source root is source > Running phase: patchPhase > Running phase: updateAutotoolsGnuConfigScriptsPhase > Running phase: configurePhase > Running phase: buildPhase > Building subPackage ./cmd/headscale > cmd/headscale/cli/api_key.go:8:2: cannot find module providing package github.com/juanfont/headscale/gen/go/headscale/v1: import lookup disabled by -mod=vendor > swagger.go:12:12: pattern gen/openapiv2/headscale/v1/headscale.swagger.json: no matching files found For full logs, run 'nix log /nix/store/gqn8m6053n2kvn902p5dh2sfss5r2h5v-headscale-dev.drv'. ` ### Expected Behavior These are all commands we tried but no luck ` 2015 make generate 2016 make build 2017 go build -o headscale . 2018 go build -mod=vendor -o headscale . 2019 go mod vendor 2020 make generate 2021 go get github.com/juanfont/headscale/gen/go/headscale/v1 2022 go mod tidy 2023 go mod vendor 2024 make genrate 2025 make generate 2026 which protoc-gen-go-grpc 2027 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2028 export PATH="$PATH:$(go env GOPATH)/bin" 2029 which protoc-gen-go-grpc 2030 go version 2031 go clean -modcache 2032 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2033 go env GOROOT 2034 sudo rm -rf /usr/local/go 2035 cd /opt/ 2036 ls 2037 wget https://go.dev/dl/go1.23.5.linux-amd64.tar.gz 2038 tar -C /usr/local/ -xzf go1.23.5.linux-amd64.tar.gz 2039 export PATH=$PATH:/usr/local/go/bin 2040 unset GOROOT 2041 export GOROOT=/usr/local/go 2042 go clean -modcache 2043 go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest 2044 cd headscale/ 2045 ls 2046 make generate 2047 make build 2048 go mod vendor 2049 go get github.com/juanfont/headscale/gen/go/headscale/v1 2050 make clean 2051 make build 2052 go build -mod=mod ./... 2053 make generate 2054 nix build 2055 history ` ### Steps To Reproduce OS is Ubuntu 22.04 ### Environment ```markdown - OS: Ubuntu 22.04 - Headscale version: 0.24.2 - Tailscale version: NA ``` ### Runtime environment - [ ] Headscale is behind a (reverse) proxy - [ ] Headscale runs in a container ### Anything else? I am unable to compile
adam added the bug label 2025-12-29 02:26:24 +01:00
adam closed this issue 2025-12-29 02:26:24 +01:00
Author
Owner

@kradalby commented on GitHub (Feb 3, 2025):

Hi

What is the previous version you tried to compile? Just try to narrow down what might have changed.

Are you compiling main or the v0.24.2 tag?

@kradalby commented on GitHub (Feb 3, 2025): Hi What is the previous version you tried to compile? Just try to narrow down what might have changed. Are you compiling main or the `v0.24.2` tag?
Author
Owner

@Blason commented on GitHub (Feb 3, 2025):

Yes - previously I compiled 0.24.0 and it was susccessful and then 0.24.2 released I pull the reqeust and then tried compiling again

@Blason commented on GitHub (Feb 3, 2025): Yes - previously I compiled 0.24.0 and it was susccessful and then 0.24.2 released I pull the reqeust and then tried compiling again
Author
Owner

@Blason commented on GitHub (Feb 5, 2025):

Any luck guys? I am still unable to compile the latest one. How do I do that?

@Blason commented on GitHub (Feb 5, 2025): Any luck guys? I am still unable to compile the latest one. How do I do that?
Author
Owner

@Blason commented on GitHub (Feb 12, 2025):

How to I compile statically linked binary? Whenver I am compiling binary it is getting created with dynamically linked

@Blason commented on GitHub (Feb 12, 2025): How to I compile statically linked binary? Whenver I am compiling binary it is getting created with dynamically linked
Author
Owner

@kradalby commented on GitHub (Feb 12, 2025):

Hi, your output is really hard to understand, could you try again and format it line by line?

dynamic vs static, are you setting CGO_ENABLED=0, that is the only thing I can imagine causing it to not be static.

While I agree it should be compilable, why cant you use the binaries we publish?

@kradalby commented on GitHub (Feb 12, 2025): Hi, your output is really hard to understand, could you try again and format it line by line? dynamic vs static, are you setting `CGO_ENABLED=0`, that is the only thing I can imagine causing it to not be static. While I agree it should be compilable, why cant you use the binaries we publish?
Author
Owner

@Blason commented on GitHub (Feb 14, 2025):

Well yes I am using CGO_ENABLED=0 however even after that binary is getting created with dynamically linked and since I a made certain changes in oidc_callback html page wanted to compile on my own. But well the binary gets compiled but If I move to my existing installation it just say the /usr/bin/headscale is not found.

@Blason commented on GitHub (Feb 14, 2025): Well yes I am using `CGO_ENABLED=0` however even after that binary is getting created with dynamically linked and since I a made certain changes in oidc_callback html page wanted to compile on my own. But well the binary gets compiled but If I move to my existing installation it just say the /usr/bin/headscale is not found.
Author
Owner

@celevra commented on GitHub (Feb 14, 2025):

same here

wget https://github.com/juanfont/headscale/archive/refs/tags/v0.25.0.tar.gz
tar xvfz v0.25.0.tar.gz
cd headscale-0.25.0/
nix develop
cd /root/headscale-0.25.0/
nix build

results in

vpn headscale-0.25.0 # nix build
error: builder for '/nix/store/pdd66r2zn1pknl2mczyqxhs6y47w81jg-headscale-dev-go-modules.drv' failed with exit code 1;
       last 10 log lines:
       > find: '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/..': Permission denied
       > Running phase: patchPhase
       > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied
       > Running phase: updateAutotoolsGnuConfigScriptsPhase
       > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied
       > Running phase: configurePhase
       > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied
       > Running phase: buildPhase
       > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied
       > go: go.mod file not found in current directory or any parent directory; see 'go help modules'
       For full logs, run 'nix log /nix/store/pdd66r2zn1pknl2mczyqxhs6y47w81jg-headscale-dev-go-modules.drv'.
error: 1 dependencies of derivation '/nix/store/bj4br4r4m60f0f7w4xcn2qp2j7x0s7lz-headscale-dev.drv' failed to build
@celevra commented on GitHub (Feb 14, 2025): same here ``` wget https://github.com/juanfont/headscale/archive/refs/tags/v0.25.0.tar.gz tar xvfz v0.25.0.tar.gz cd headscale-0.25.0/ nix develop cd /root/headscale-0.25.0/ nix build ``` results in ``` vpn headscale-0.25.0 # nix build error: builder for '/nix/store/pdd66r2zn1pknl2mczyqxhs6y47w81jg-headscale-dev-go-modules.drv' failed with exit code 1; last 10 log lines: > find: '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/..': Permission denied > Running phase: patchPhase > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied > Running phase: updateAutotoolsGnuConfigScriptsPhase > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied > Running phase: configurePhase > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied > Running phase: buildPhase > install: cannot stat '/tmp/nix-shell.zQuqMF/nix-build-headscale-dev-go-modules.drv-0/env-vars': Permission denied > go: go.mod file not found in current directory or any parent directory; see 'go help modules' For full logs, run 'nix log /nix/store/pdd66r2zn1pknl2mczyqxhs6y47w81jg-headscale-dev-go-modules.drv'. error: 1 dependencies of derivation '/nix/store/bj4br4r4m60f0f7w4xcn2qp2j7x0s7lz-headscale-dev.drv' failed to build ```
Author
Owner

@Blason commented on GitHub (Feb 17, 2025):

There is one more issue that I am facing with 0.25

`CGO_ENABLED=0 nix build
warning: Git tree '/opt/headscale' is dirty
error: attribute 'dirtyShortRev' missing

   at /nix/store/14bjcjlp1x3dxikzr3abjbf7cphrfm5w-source/flake.nix:15:41:

       14|   }: let
       15|     headscaleVersion = self.shortRev or self.dirtyShortRev;
         |                                         ^
       16|     commitHash = self.rev or self.dirtyRev;

(use '--show-trace' to show detailed location information)
`

@Blason commented on GitHub (Feb 17, 2025): There is one more issue that I am facing with 0.25 `CGO_ENABLED=0 nix build warning: Git tree '/opt/headscale' is dirty error: attribute 'dirtyShortRev' missing at /nix/store/14bjcjlp1x3dxikzr3abjbf7cphrfm5w-source/flake.nix:15:41: 14| }: let 15| headscaleVersion = self.shortRev or self.dirtyShortRev; | ^ 16| commitHash = self.rev or self.dirtyRev; (use '--show-trace' to show detailed location information) `
Author
Owner

@kradalby commented on GitHub (Feb 17, 2025):

Can you try to update your nix installation?

@kradalby commented on GitHub (Feb 17, 2025): Can you try to update your nix installation?
Author
Owner

@Blason commented on GitHub (Feb 17, 2025):

Any thing else that I need to do? I am not very familiar with nix
`
cd /opt/headscale/

/opt/headscale# nix-channel --update
unpacking channels...

/opt/headscale# nix-env -u

/opt/headscale# sudo nixos-rebuild switch --upgrade
sudo: nixos-rebuild: command not found

/opt/headscale# CGO_ENABLED=0 nix build
warning: Git tree '/opt/headscale' is dirty
error: attribute 'dirtyShortRev' missing

   at /nix/store/14bjcjlp1x3dxikzr3abjbf7cphrfm5w-source/flake.nix:15:41:

       14|   }: let
       15|     headscaleVersion = self.shortRev or self.dirtyShortRev;
         |                                         ^
       16|     commitHash = self.rev or self.dirtyRev;

(use '--show-trace' to show detailed location information)
`

@Blason commented on GitHub (Feb 17, 2025): Any thing else that I need to do? I am not very familiar with nix ` cd /opt/headscale/ /opt/headscale# nix-channel --update unpacking channels... /opt/headscale# nix-env -u /opt/headscale# sudo nixos-rebuild switch --upgrade sudo: nixos-rebuild: command not found /opt/headscale# CGO_ENABLED=0 nix build warning: Git tree '/opt/headscale' is dirty error: attribute 'dirtyShortRev' missing at /nix/store/14bjcjlp1x3dxikzr3abjbf7cphrfm5w-source/flake.nix:15:41: 14| }: let 15| headscaleVersion = self.shortRev or self.dirtyShortRev; | ^ 16| commitHash = self.rev or self.dirtyRev; (use '--show-trace' to show detailed location information) `
Author
Owner

@kradalby commented on GitHub (Feb 17, 2025):

I think it is the nix binary that might need an upgrade, you need to consult how you installed it.

@kradalby commented on GitHub (Feb 17, 2025): I think it is the nix binary that might need an upgrade, you need to consult how you installed it.
Author
Owner

@nblock commented on GitHub (Feb 17, 2025):

I think it is the nix binary that might need an upgrade, you need to consult how you installed it.

It seems that nix 2.17 or later is now required to build from source - check via nix --version

@nblock commented on GitHub (Feb 17, 2025): > I think it is the nix binary that might need an upgrade, you need to consult how you installed it. It seems that nix 2.17 or later is now required to build from source - check via `nix --version`
Author
Owner

@Blason commented on GitHub (Feb 18, 2025):

Mine is
nix --version nix (Nix) 2.6.0

@Blason commented on GitHub (Feb 18, 2025): Mine is `nix --version nix (Nix) 2.6.0 `
Author
Owner

@Blason commented on GitHub (Feb 18, 2025):

Yes after upgrading to nix build 2.24 i was able to compile however even after that my binary is dynamically compiled
CGO_ENABLED=0 nix build

@Blason commented on GitHub (Feb 18, 2025): Yes after upgrading to nix build 2.24 i was able to compile however even after that my binary is dynamically compiled `CGO_ENABLED=0 nix build`
Author
Owner

@chengongpp commented on GitHub (Jun 23, 2025):

Add env.CGO_ENABLED = 0 to buildGo {} block in flake.nix would solve this.

@chengongpp commented on GitHub (Jun 23, 2025): Add `env.CGO_ENABLED = 0` to `buildGo {}` block in `flake.nix` would solve this.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#936