Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building caddy (using xcaddy) with main branch throws an error #5301

Closed
girlbossceo opened this issue Jan 12, 2023 · 16 comments
Closed

Building caddy (using xcaddy) with main branch throws an error #5301

girlbossceo opened this issue Jan 12, 2023 · 16 comments
Labels
upstream ⬆️ Relates to some dependency of this project

Comments

@girlbossceo
Copy link
Contributor

Commit that seems to cause this is 798c4a3 as that's when google/pprof was added

panic: internal error: can't find reason for requirement on github.com/google/pprof@v0.0.0-20210407192527-94a9f03dee38

Go version: go version go1.19.4 linux/amd64 (Fedora 37) and go version go1.19.5 linux/amd64 (Arch Linux)
Error happens on both distros

2023/01/12 22:07:54 [INFO] Temporary folder: /tmp/buildenv_2023-01-12-2207.4152728799
2023/01/12 22:07:54 [INFO] Writing main module: /tmp/buildenv_2023-01-12-2207.4152728799/main.go
package main

import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"

        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
        _ "github.com/Odyssey346/ListenCaddy"
)

func main() {
        caddycmd.Main()
}
2023/01/12 22:07:54 [INFO] Initializing Go module
2023/01/12 22:07:54 [INFO] exec (timeout=10s): /usr/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2023/01/12 22:07:54 [INFO] Pinning versions
2023/01/12 22:07:54 [INFO] exec (timeout=0s): /usr/bin/go get -d -v -ldflags -w -s -race -strictdups 2 -linkshared -aslr -buildmode=pie -linkmode=external -trimpath github.com/caddyserver/caddy/v2@master
go: downloading github.com/caddyserver/caddy/v2 v2.6.3-0.20230110050823-223cbe3d0b50
go: downloading github.com/caddyserver/caddy v1.0.6-0.20200303163406-891446d06340
go: downloading github.com/lucas-clemente/quic-go v0.31.0
go: downloading golang.org/x/sys v0.1.1-0.20221102194838-fc697a31fa06
go: downloading golang.org/x/term v0.1.0
go: downloading github.com/klauspost/cpuid/v2 v2.1.2
go: downloading golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b
go: downloading golang.org/x/net v0.1.0
go: downloading github.com/onsi/ginkgo/v2 v2.2.0
go: downloading github.com/marten-seemann/qpack v0.3.0
go: downloading github.com/prometheus/common v0.33.0
go: downloading google.golang.org/protobuf v1.28.1
go: downloading golang.org/x/tools v0.1.12
go: downloading golang.org/x/text v0.4.0
go: downloading golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
go: downloading github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.6.3-0.20230110050823-223cbe3d0b50
go: added github.com/caddyserver/certmagic v0.17.2
go: added github.com/cespare/xxhash/v2 v2.1.2
go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: added github.com/golang/mock v1.6.0
go: added github.com/golang/protobuf v1.5.2
go: added github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38
go: added github.com/google/uuid v1.3.0
go: added github.com/klauspost/cpuid/v2 v2.1.2
go: added github.com/libdns/libdns v0.2.1
go: added github.com/lucas-clemente/quic-go v0.31.0
go: added github.com/marten-seemann/qpack v0.3.0
go: added github.com/marten-seemann/qtls-go1-18 v0.1.3
go: added github.com/marten-seemann/qtls-go1-19 v0.1.1
go: added github.com/matttproud/golang_protobuf_extensions v1.0.1
go: added github.com/mholt/acmez v1.0.4
go: added github.com/miekg/dns v1.1.50
go: added github.com/onsi/ginkgo/v2 v2.2.0
go: added github.com/prometheus/client_golang v1.12.2
go: added github.com/prometheus/client_model v0.2.0
go: added github.com/prometheus/common v0.33.0
go: added github.com/prometheus/procfs v0.7.3
go: added go.uber.org/atomic v1.9.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.23.0
go: added golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b
go: added golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
go: added golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
go: added golang.org/x/net v0.1.0
go: added golang.org/x/sys v0.1.1-0.20221102194838-fc697a31fa06
go: added golang.org/x/term v0.1.0
go: added golang.org/x/text v0.4.0
go: added golang.org/x/tools v0.1.12
go: added google.golang.org/protobuf v1.28.1
2023/01/12 22:08:30 [INFO] exec (timeout=0s): /usr/bin/go get -d -v -ldflags -w -s -race -strictdups 2 -linkshared -aslr -buildmode=pie -linkmode=external -trimpath github.com/Odyssey346/ListenCaddy github.com/caddyserver/caddy/v2@master
go: downloading google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c
go: downloading github.com/smallstep/certificates v0.23.0
go: downloading go.step.sm/crypto v0.23.1
go: downloading github.com/spf13/cobra v1.6.0
go: downloading github.com/smallstep/nosql v0.5.0
go: downloading go.step.sm/cli-utils v0.7.5
go: downloading go.step.sm/linkedca v0.19.0
go: downloading google.golang.org/grpc v1.50.1
go: downloading github.com/slackhq/nebula v1.6.1
go: downloading github.com/inconshreveable/mousetrap v1.0.1
go: downloading github.com/urfave/cli v1.22.10
go: downloading filippo.io/edwards25519 v1.0.0
go: downloading github.com/jackc/pgx/v4 v4.17.2
go: downloading github.com/rs/xid v1.4.0
go: downloading github.com/sirupsen/logrus v1.9.0
go: downloading github.com/go-logfmt/logfmt v0.5.1
go: downloading github.com/dgraph-io/ristretto v0.1.0
go: downloading github.com/jackc/pgconn v1.13.0
go: downloading github.com/jackc/pgproto3/v2 v2.3.1
go: downloading github.com/jackc/pgtype v1.12.0
go: downloading github.com/golang/glog v1.0.0
panic: internal error: can't find reason for requirement on github.com/google/pprof@v0.0.0-20210407192527-94a9f03dee38

goroutine 1 [running]:
cmd/go/internal/modget.(*resolver).updateBuildList.func1({{0xc000260648?, 0xc0004fcf90?}, {0xc0000366f0?, 0xc0002893b8?}})
        /usr/lib/go/src/cmd/go/internal/modget/get.go:1760 +0x114
cmd/go/internal/modget.(*resolver).updateBuildList(0xc000150100, {0xb2e7b0, 0xc00002a0a8}, {0x0, 0x0, 0x0})
        /usr/lib/go/src/cmd/go/internal/modget/get.go:1765 +0x597
cmd/go/internal/modget.(*resolver).applyUpgrades(0xc000150100, {0xb2e7b0, 0xc00002a0a8}, {0x0?, 0x2?, 0x472485?})
        /usr/lib/go/src/cmd/go/internal/modget/get.go:1312 +0x105
cmd/go/internal/modget.runGet({0xb2e7b0, 0xc00002a0a8}, 0xc000028498?, {0xc000024100, 0x2, 0x2})
        /usr/lib/go/src/cmd/go/internal/modget/get.go:351 +0x45e
main.invoke(0xe28fe0, {0xc0000240a0, 0x8, 0x8})
        /usr/lib/go/src/cmd/go/main.go:225 +0x34e
main.main()
        /usr/lib/go/src/cmd/go/main.go:179 +0x7d1
2023/01/12 22:08:43 [FATAL] exit status 2
@francislavoie
Copy link
Member

francislavoie commented Jan 12, 2023

Weird. It works in CI for us, obviously.

Apparently there's some issues with this upstream golang/go#56494

xcaddy build master works for me on PopOS (Ubuntu-ish) with Go 1.19.5. So 🤷‍♂️

@girlbossceo
Copy link
Contributor Author

Definitely seems related :(

Was able to build with 817470d at least.

@mholt mholt added the upstream ⬆️ Relates to some dependency of this project label Jan 13, 2023
@mholt
Copy link
Member

mholt commented Jan 14, 2023

That's weird... I am not able to see that behavior either...

The panic is definitely coming from within go get. I'm going to close this since I'm not sure there's anything actionable for us to do, but feel free to continue discussion if needed.

@mholt mholt closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2023
@girlbossceo
Copy link
Contributor Author

No worries, I wasn't aware this is an upstream bug. Hope this gets solved soon. I even tried Fedora Rawhide but still no luck :(

@excid3
Copy link

excid3 commented Feb 9, 2023

I ran into this a couple of times. I'm not entirely what's going on, but I did manage to get it to compile.

I'm compiling Caddy with several plugins and had them in alphabetical order:

./xcaddy build latest \
  --with github.com/caddy-dns/alidns \
  --with github.com/caddy-dns/azure \
  --with github.com/caddy-dns/cloudflare \
  --with github.com/caddy-dns/digitalocean \
  --with github.com/caddy-dns/dnspod \
  --with github.com/caddy-dns/duckdns \
  --with github.com/caddy-dns/gandi \
  --with github.com/caddy-dns/hetzner \
  --with github.com/caddy-dns/namecheap \
  --with github.com/caddy-dns/netlify \
  --with github.com/caddy-dns/ovh \
  --with github.com/caddy-dns/porkbun \
  --with github.com/caddy-dns/route53 \
  --with github.com/caddy-dns/scaleway \
  --with github.com/caddy-dns/vercel \
  --with github.com/caddy-dns/vultr \
  --with github.com/caddy-dns/godaddy \
  --with github.com/caddy-dns/googleclouddns

I was getting the same error with github.com/google/pprof in this thread, but previously it was with google.golang.org/appengine.

I tried commenting out googleclouddns thinking that was the issue, but that didn't change anything. I then moved godaddy and googleclouddns to the bottom of the list and it compiles fine now. 🤷‍♂️

No idea why and I'm not very familiar with Go, but I thought I'd mention that I ran into the same thing. Maybe it's an issue with one of these DNS plugins?

@CamilleScholtz
Copy link

Running into the same issue with xcaddy build v2.6.3 --with github.com/awoodbeck/caddy-validate-github

@mholt
Copy link
Member

mholt commented Feb 9, 2023

I get the error with that command too, @onodera-punpun -- unfortunately, this is an upstream issue in the go command, and I don't know that there's anything we can do about it. There are workarounds described in golang/go#56494.

Based on user reports above, it seems like the order of dependencies in go.mod matters (which it shouldn't), and I wonder if the dependencies of the plugins (i.e. their go.mod files) matters; like maybe if they're targeting older versions of Caddy or even Go. I dunno.

@francislavoie
Copy link
Member

I did some investigating, that I outlined here golang/go#56494 (comment). I have no solution right now 😬

@francislavoie
Copy link
Member

@excid3 @onodera-punpun FYI I've figured out that the issue can be fixed by the plugins bumping their Caddy dependency in their go.mod to Caddy v2.6.3 (i.e. latest right now) and running go mod tidy. That way, the plugins will sync its dependencies with Caddy's, and it should resolve the build issues. You'll have to reach out to the relevant plugin authors to get them to do so.

This problem really shouldn't have happened. Go's module system is still proving to not be quite robust enough. We keep running into little issues like this and it feels like there's rarely much we can do.

@excid3
Copy link

excid3 commented Feb 10, 2023

Very interesting. Thanks for looking into this @francislavoie. 👍

Are the caddy-dns modules updated?

@mholt
Copy link
Member

mholt commented Feb 10, 2023

@excid3 The caddy-dns modules are independently maintained.

It's not clear to me which plugins need updating yet. For example, xcaddy build --with github.com/mholt/caddy-ratelimit works fine, even though that plugin doesn't target v2.6.3.

@mario-moreira
Copy link

I have the same problem. I'm building caddy with this docker file:

FROM caddy:builder AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/godaddy

FROM caddy:latest

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

And I get the same error. This should be easy to reproduce.

Is there any workaround I can do to keep using godaddy?

@mholt
Copy link
Member

mholt commented Feb 10, 2023

@mario-moreira This is very convoluted but I was able to get your build to work with:

xcaddy build \
    --with github.com/caddy-dns/godaddy \
    --with github.com/caddyserver/caddy/v2=github.com/caddyserver/caddy/v2@v2.6.4

Do not ask me why. 🤷‍♂️

@mario-moreira
Copy link

@mholt yes, it worked. Problem solved for the moment. Thank you.

poettig added a commit to poettig/caddy_leierkasten_auth that referenced this issue Feb 15, 2023
ueffel added a commit to ueffel/caddy-imagefilter that referenced this issue Mar 5, 2023
@mattvb91
Copy link

mattvb91 commented Mar 10, 2023

@mario-moreira This is very convoluted but I was able to get your build to work with:

xcaddy build \
    --with github.com/caddy-dns/godaddy \
    --with github.com/caddyserver/caddy/v2=github.com/caddyserver/caddy/v2@v2.6.4

Do not ask me why. man_shrugging

@mholt this was working fine until today. Can no longer build it again even with your fix:

#0 30.13 panic: internal error: can't find reason for requirement on github.com/google/pprof@v0.0.0-20210407192527-94a9f03dee38

Sorry about the ping matt. Turns out an upstream: /caddy-dns/route53/releases had a new release which for some reason broke it again. Downgrading to --with github.com/caddy-dns/route53@v1.3.0 worked.

So now im going and hard locking all deps (probably a good thing anyway but pain in the ass to upgrade)

@mholt
Copy link
Member

mholt commented Mar 10, 2023

We are hoping the Go team fixes the bug ASAP.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream ⬆️ Relates to some dependency of this project
Projects
None yet
Development

No branches or pull requests

7 participants