klzgrad / naiveproxy

Make a fortune quietly
BSD 3-Clause "New" or "Revised" License
6.68k stars 885 forks source link

Caddy build error #440

Closed aquawius closed 1 year ago

aquawius commented 1 year ago

I think there is a compilation problem with the dependent component, but I don't know where to report back. I have tried this many times, but it always returns the same error.

Here the complie log:

root@US125007:~# go version
go version go1.19.4 linux/amd64

root@US125007:~# ~/go/bin/xcaddy build --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive
2022/12/30 07:15:39 [INFO] Temporary folder: /tmp/buildenv_2022-12-30-0715.3040930434
2022/12/30 07:15:39 [INFO] Writing main module: /tmp/buildenv_2022-12-30-0715.3040930434/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/caddyserver/forwardproxy"
)

func main() {
        caddycmd.Main()
}
2022/12/30 07:15:39 [INFO] Initializing Go module
2022/12/30 07:15:39 [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
2022/12/30 07:15:39 [INFO] Replace github.com/caddyserver/forwardproxy => github.com/klzgrad/forwardproxy@naive
2022/12/30 07:15:39 [INFO] exec (timeout=10s): /usr/bin/go mod edit -replace github.com/caddyserver/forwardproxy=github.com/klzgrad/forwardproxy@naive 
2022/12/30 07:15:39 [INFO] Pinning versions
2022/12/30 07:15:39 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2 
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.6.2
go: added github.com/caddyserver/certmagic v0.17.2
go: added github.com/cespare/xxhash/v2 v2.1.2
go: added github.com/fsnotify/fsnotify v1.5.1
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/uuid v1.3.0
go: added github.com/klauspost/cpuid/v2 v2.1.1
go: added github.com/libdns/libdns v0.2.1
go: added github.com/lucas-clemente/quic-go v0.29.2
go: added github.com/marten-seemann/qpack v0.2.1
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/nxadm/tail v1.4.8
go: added github.com/onsi/ginkgo v1.16.4
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.32.1
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-20220722155217-630584e8d5aa
go: added golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
go: added golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
go: added golang.org/x/net v0.0.0-20220812165438-1d4ff48094d1
go: added golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
go: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go: added golang.org/x/tools v0.1.10
go: added golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f
go: added google.golang.org/protobuf v1.28.0
go: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
2022/12/30 07:15:45 [INFO] exec (timeout=0s): /usr/bin/go get -d -v  
go: added github.com/caddyserver/forwardproxy v0.0.0-20211013034647-8c6ef2bd4a8f
2022/12/30 07:15:57 [INFO] Build environment ready
2022/12/30 07:15:57 [INFO] Building Caddy
2022/12/30 07:15:57 [INFO] exec (timeout=0s): /usr/bin/go mod tidy 
2022/12/30 07:15:58 [INFO] exec (timeout=0s): /usr/bin/go build -o /root/caddy -ldflags -w -s -trimpath 
go build github.com/yuin/goldmark/util: /usr/lib/go-1.19/pkg/tool/linux_amd64/compile: signal: killed
2022/12/30 07:16:09 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-12-30-0715.3040930434
2022/12/30 07:16:09 [FATAL] exit status 1
root@US125007:~# 
aquawius commented 1 year ago

I also tried ~/go/bin/caddy build (without --with option) It also like that

2022/12/30 07:23:42 [INFO] exec (timeout=0s): /usr/bin/go build -o /root/go/bin/caddy -ldflags -w -s -trimpath 
go build github.com/yuin/goldmark/util: /usr/lib/go-1.19/pkg/tool/linux_amd64/compile: signal: killed
2022/12/30 07:23:51 [INFO] Cleaning up temporary folder: /tmp/buildenv_2022-12-30-0723.570449764
2022/12/30 07:23:51 [FATAL] exit status 1
aquawius commented 1 year ago

Sorry, I reboot my machine, the problem solved. That's my fault.

zedifen commented 1 year ago

I suggest that you use GitHub Actions for building artifacts. The runner image already has lots of tools set up so that you don't need to install anything on your own computer.

name: xcaddy build

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: 'stable'

    - name: Install prebuilt xcaddy from Cloudsmith
      run: |
        sudo apt update
        sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
        curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg
        curl -1sLf 'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list
        sudo apt update
        sudo apt install xcaddy

    - name: Run xcaddy build with
      run: |
        xcaddy build \
          --with github.com/caddyserver/forwardproxy@caddy2=github.com/klzgrad/forwardproxy@naive

    - name: Tar artifact
      run: |
        tar -czvf caddy-linux-amd64.tar.gz ./caddy

    - name: Print SHA256 sum
      run: |
        sha256sum ./caddy
        sha256sum ./caddy-linux-amd64.tar.gz

    - name: Upload artifact
      uses: actions/upload-artifact@v3
      with:
        name: caddy-linux-amd64.tar.gz
        path: ./caddy-linux-amd64.tar.gz
        if-no-files-found: error