Build caddy from source error

(Xpt) #1

Following the build instructions in the README https://github.com/mholt/caddy#build, I didn’t get a binary in $GOPATH/bin. So I investigated myself. Here is the log:

cd .../src/github.com/mholt/caddy/caddy

export GO111MODULE=on

$ go get -v -u ./... 
Fetching https://gopkg.in/mcuadros/go-syslog.v2?go-get=1
Fetching https://gopkg.in/natefinch/lumberjack.v2?go-get=1
go: finding github.com/mholt/certmagic v0.5.0
go: finding github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4
go: finding github.com/hashicorp/go-syslog v1.0.0
go: finding github.com/lucas-clemente/quic-go v0.10.2
go: finding github.com/naoina/go-stringutil v0.1.0
go: finding github.com/klauspost/cpuid v1.2.0
go: finding github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: finding github.com/BurntSushi/toml v0.3.1
Parsing meta tags from https://gopkg.in/natefinch/lumberjack.v2?go-get=1 (status code 200)
get "gopkg.in/natefinch/lumberjack.v2": found meta tag get.metaImport{Prefix:"gopkg.in/natefinch/lumberjack.v2", VCS:"git", RepoRoot:"https://gopkg.in/natefinch/lumberjack.v2"} at https://gopkg.in/natefinch/lumberjack.v2?go-get=1
go: finding gopkg.in/natefinch/lumberjack.v2 v2.0.0
Parsing meta tags from https://gopkg.in/mcuadros/go-syslog.v2?go-get=1 (status code 200)
get "gopkg.in/mcuadros/go-syslog.v2": found meta tag get.metaImport{Prefix:"gopkg.in/mcuadros/go-syslog.v2", VCS:"git", RepoRoot:"https://gopkg.in/mcuadros/go-syslog.v2"} at https://gopkg.in/mcuadros/go-syslog.v2?go-get=1
go: finding gopkg.in/mcuadros/go-syslog.v2 v2.2.1
Fetching https://gopkg.in/yaml.v2?go-get=1
Fetching https://golang.org/x/crypto?go-get=1
go: finding github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
get "golang.org/x/crypto": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
go: finding golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b
go: finding github.com/naoina/toml v0.1.1
go: finding gopkg.in/yaml.v2 v2.2.2
Fetching https://golang.org/x/sync?go-get=1
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/sync?go-get=1 (status code 200)
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
get "golang.org/x/net": found meta tag get.metaImport{Prefix:"golang.org/x/net", VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net?go-get=1
get "golang.org/x/sync": found meta tag get.metaImport{Prefix:"golang.org/x/sync", VCS:"git", RepoRoot:"https://go.googlesource.com/sync"} at https://golang.org/x/sync?go-get=1
go: finding golang.org/x/net v0.0.0-20190328230028-74de082e2cca
go: finding golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced
Fetching https://gopkg.in/square/go-jose.v2?go-get=1
go: finding github.com/onsi/gomega v1.5.0
go: finding github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47
Parsing meta tags from https://gopkg.in/square/go-jose.v2?go-get=1 (status code 200)
get "gopkg.in/square/go-jose.v2": found meta tag get.metaImport{Prefix:"gopkg.in/square/go-jose.v2", VCS:"git", RepoRoot:"https://gopkg.in/square/go-jose.v2"} at https://gopkg.in/square/go-jose.v2?go-get=1
go: finding gopkg.in/square/go-jose.v2 v2.2.2
go: finding github.com/cenkalti/backoff v2.1.1+incompatible
go: finding github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f
go: finding golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
go: finding github.com/lucas-clemente/quic-clients v0.1.0
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/golang/mock v1.2.0
go: finding github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
Fetching https://golang.org/x/sys?go-get=1
Fetching https://gopkg.in/tomb.v1?go-get=1
go: finding github.com/go-acme/lego v2.5.0+incompatible
go: finding github.com/dustin/go-humanize v1.0.0
Parsing meta tags from https://golang.org/x/sys?go-get=1 (status code 200)
get "golang.org/x/sys": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at https://golang.org/x/sys?go-get=1
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
Parsing meta tags from https://gopkg.in/tomb.v1?go-get=1 (status code 200)
get "gopkg.in/tomb.v1": found meta tag get.metaImport{Prefix:"gopkg.in/tomb.v1", VCS:"git", RepoRoot:"https://gopkg.in/tomb.v1"} at https://gopkg.in/tomb.v1?go-get=1
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: finding golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
go: finding github.com/hpcloud/tail v1.0.0
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
Fetching https://golang.org/x/text?go-get=1
go: finding github.com/google/uuid v1.1.1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
get "golang.org/x/text": found meta tag get.metaImport{Prefix:"golang.org/x/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text?go-get=1
go: finding golang.org/x/text v0.3.0
go: finding github.com/marten-seemann/qtls v0.2.3
Fetching https://gopkg.in/fsnotify.v1?go-get=1
go: finding github.com/gorilla/websocket v1.4.0
go: finding github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115
Parsing meta tags from https://gopkg.in/fsnotify.v1?go-get=1 (status code 200)
get "gopkg.in/fsnotify.v1": found meta tag get.metaImport{Prefix:"gopkg.in/fsnotify.v1", VCS:"git", RepoRoot:"https://gopkg.in/fsnotify.v1"} at https://gopkg.in/fsnotify.v1?go-get=1
Fetching https://gopkg.in/check.v1?go-get=1
go: finding gopkg.in/fsnotify.v1 v1.4.7
Parsing meta tags from https://gopkg.in/check.v1?go-get=1 (status code 200)
get "gopkg.in/check.v1": found meta tag get.metaImport{Prefix:"gopkg.in/check.v1", VCS:"git", RepoRoot:"https://gopkg.in/check.v1"} at https://gopkg.in/check.v1?go-get=1
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/miekg/dns v1.1.3
go: finding golang.org/x/sys v0.0.0-20190124100055-b90733256f2e
go: finding github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9
go: finding github.com/stretchr/testify v1.3.0
go: finding github.com/onsi/ginkgo v1.6.0
go: finding github.com/golang/protobuf v1.2.0
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e
go: finding github.com/onsi/ginkgo v1.8.0
go: finding github.com/stretchr/objx v0.1.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/golang/mock v1.3.1
go: finding github.com/bifurcation/mint latest
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/flynn/go-shlex latest
go: finding golang.org/x/sys latest
go: finding github.com/cheekybits/genny v1.0.0
go: finding github.com/jimstudt/http-authentication latest
go: finding github.com/stretchr/objx v0.2.0
go: finding golang.org/x/net latest
go: finding github.com/golang/protobuf v1.3.1
go: finding github.com/mholt/certmagic v0.5.1
go: finding github.com/russross/blackfriday v2.0.0+incompatible
go: finding golang.org/x/crypto latest
go: finding github.com/miekg/dns v1.1.9
go: finding gopkg.in/square/go-jose.v2 v2.3.1
go: finding gopkg.in/check.v1 latest
go: finding golang.org/x/text v0.3.2
go: finding github.com/kylelemons/godebug v1.1.0
go: finding github.com/hashicorp/golang-lru v0.5.1
go: finding golang.org/x/sync latest
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding gopkg.in/tomb.v1 latest
go: finding github.com/lucas-clemente/quic-go v0.11.1
go: finding github.com/klauspost/cpuid v1.2.1
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding github.com/lucas-clemente/aes12 latest
go: finding github.com/lucas-clemente/quic-go-certificates latest
Fetching https://golang.org/x/tools?go-get=1
Parsing meta tags from https://golang.org/x/tools?go-get=1 (status code 200)
get "golang.org/x/tools": found meta tag get.metaImport{Prefix:"golang.org/x/tools", VCS:"git", RepoRoot:"https://go.googlesource.com/tools"} at https://golang.org/x/tools?go-get=1
go: finding golang.org/x/tools v0.0.0-20190425150028-36563e24a262
go: finding golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
go: finding github.com/onsi/ginkgo v1.7.0
go: finding github.com/onsi/gomega v1.4.3
go: finding golang.org/x/tools latest
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: downloading github.com/google/uuid v1.1.1
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading github.com/mholt/certmagic v0.5.1
go: downloading github.com/hashicorp/go-syslog v1.0.0
go: downloading github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: extracting github.com/mholt/certmagic v0.5.1
go: extracting gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: extracting github.com/google/uuid v1.1.1
go: extracting github.com/hashicorp/go-syslog v1.0.0
go: extracting github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: downloading github.com/go-acme/lego v2.5.0+incompatible
go: downloading github.com/russross/blackfriday v2.0.0+incompatible
go: extracting github.com/russross/blackfriday v2.0.0+incompatible
go: downloading github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: downloading golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529
go: extracting github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/lucas-clemente/quic-go v0.11.1
go: finding github.com/shurcooL/sanitized_anchor_name v1.0.0
go: extracting github.com/dustin/go-humanize v1.0.0
go: extracting github.com/lucas-clemente/quic-go v0.11.1
go: extracting github.com/go-acme/lego v2.5.0+incompatible
go: downloading github.com/cheekybits/genny v1.0.0
go: downloading golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5
go: downloading github.com/klauspost/cpuid v1.2.1
go: downloading github.com/marten-seemann/qtls v0.2.3
go: downloading github.com/cenkalti/backoff v2.1.1+incompatible
go: downloading github.com/gorilla/websocket v1.4.0
go: downloading github.com/shurcooL/sanitized_anchor_name v1.0.0
go: extracting golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529
go: extracting github.com/cenkalti/backoff v2.1.1+incompatible
go: downloading github.com/naoina/toml v0.1.1
go: extracting github.com/cheekybits/genny v1.0.0
go: extracting github.com/marten-seemann/qtls v0.2.3
go: extracting github.com/gorilla/websocket v1.4.0
go: extracting github.com/shurcooL/sanitized_anchor_name v1.0.0
go: downloading gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/klauspost/cpuid v1.2.1
go: downloading github.com/miekg/dns v1.1.9
go: downloading golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
go: downloading gopkg.in/square/go-jose.v2 v2.3.1
go: extracting golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5
go: extracting gopkg.in/yaml.v2 v2.2.2
go: extracting github.com/naoina/toml v0.1.1
go: downloading github.com/naoina/go-stringutil v0.1.0
go: downloading golang.org/x/text v0.3.2
go: extracting gopkg.in/square/go-jose.v2 v2.3.1
go: extracting github.com/naoina/go-stringutil v0.1.0
go: extracting github.com/miekg/dns v1.1.9
go: extracting golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
go: extracting golang.org/x/text v0.3.2
github.com/klauspost/cpuid
github.com/google/uuid
github.com/flynn/go-shlex
github.com/mholt/caddy/telemetry
github.com/hashicorp/go-syslog
github.com/mholt/caddy/caddyfile
github.com/jimstudt/http-authentication/basic
github.com/cheekybits/genny/generic
github.com/mholt/caddy
github.com/lucas-clemente/quic-go/internal/protocol
github.com/lucas-clemente/quic-go/internal/utils
golang.org/x/crypto/internal/subtle
github.com/lucas-clemente/quic-go/internal/congestion
golang.org/x/crypto/internal/chacha20
golang.org/x/crypto/poly1305
golang.org/x/sys/cpu
golang.org/x/crypto/cryptobyte/asn1
golang.org/x/crypto/chacha20poly1305
golang.org/x/crypto/cryptobyte
golang.org/x/crypto/curve25519
golang.org/x/crypto/hkdf
golang.org/x/text/transform
github.com/marten-seemann/qtls
golang.org/x/text/unicode/bidi
golang.org/x/text/secure/bidirule
golang.org/x/text/unicode/norm
golang.org/x/net/idna
golang.org/x/net/http/httpguts
golang.org/x/net/http2/hpack
golang.org/x/net/http2
github.com/lucas-clemente/quic-go/internal/qerr
github.com/lucas-clemente/quic-go/internal/wire
github.com/lucas-clemente/quic-go/internal/ackhandler
github.com/lucas-clemente/quic-go/internal/flowcontrol
github.com/lucas-clemente/quic-go/internal/handshake
github.com/lucas-clemente/quic-go
github.com/mholt/caddy/caddyhttp/staticfiles
golang.org/x/crypto/ocsp
github.com/go-acme/lego/certcrypto
github.com/go-acme/lego/acme
github.com/go-acme/lego/challenge
github.com/lucas-clemente/quic-go/h2quic
github.com/cenkalti/backoff
github.com/go-acme/lego/acme/api/internal/sender
github.com/go-acme/lego/acme/api/internal/nonces
golang.org/x/crypto/ed25519/internal/edwards25519
golang.org/x/crypto/pbkdf2
gopkg.in/square/go-jose.v2/cipher
gopkg.in/square/go-jose.v2/json
golang.org/x/crypto/ed25519
github.com/go-acme/lego/log
github.com/go-acme/lego/platform/wait
golang.org/x/net/bpf
golang.org/x/net/internal/iana
gopkg.in/square/go-jose.v2
golang.org/x/net/internal/socket
golang.org/x/net/ipv4
golang.org/x/net/ipv6
github.com/go-acme/lego/acme/api/internal/secure
github.com/go-acme/lego/acme/api
github.com/go-acme/lego/challenge/tlsalpn01
github.com/go-acme/lego/certificate
github.com/go-acme/lego/challenge/http01
golang.org/x/sys/unix
github.com/go-acme/lego/registration
github.com/shurcooL/sanitized_anchor_name
github.com/russross/blackfriday
gopkg.in/natefinch/lumberjack.v2
github.com/miekg/dns
github.com/dustin/go-humanize
github.com/naoina/go-stringutil
github.com/naoina/toml/ast
github.com/naoina/toml
gopkg.in/yaml.v2
github.com/mholt/caddy/caddyhttp/markdown/metadata
github.com/mholt/caddy/caddyhttp/markdown/summary
# github.com/mholt/caddy/caddyhttp/markdown/summary
../caddyhttp/markdown/summary/render.go:24:5: cannot use (*renderer)(nil) (type *renderer) as type blackfriday.Renderer in assignment:
   *renderer does not implement blackfriday.Renderer (missing RenderFooter method)
../caddyhttp/markdown/summary/summary.go:26:44: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(input, renderer literal, 0)
github.com/go-acme/lego/challenge/dns01
github.com/gorilla/websocket
github.com/go-acme/lego/challenge/resolver
github.com/go-acme/lego/lego
github.com/mholt/certmagic
github.com/mholt/caddy/onevent/hook
github.com/mholt/caddy/onevent
github.com/mholt/caddy/caddytls
github.com/mholt/caddy/caddyhttp/httpserver
# github.com/mholt/caddy/caddyhttp/httpserver
../caddyhttp/httpserver/tplcontext.go:279:14: undefined: blackfriday.HtmlRenderer
../caddyhttp/httpserver/tplcontext.go:281:11: undefined: blackfriday.EXTENSION_TABLES
../caddyhttp/httpserver/tplcontext.go:282:11: undefined: blackfriday.EXTENSION_FENCED_CODE
../caddyhttp/httpserver/tplcontext.go:283:11: undefined: blackfriday.EXTENSION_STRIKETHROUGH
../caddyhttp/httpserver/tplcontext.go:284:11: undefined: blackfriday.EXTENSION_DEFINITION_LISTS
../caddyhttp/httpserver/tplcontext.go:285:34: too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown([]byte(body), renderer, extns)

That undefined: blackfriday.HtmlRenderer error leaded me to #2560, but the very latest solution there doesn’t work for me either.

what’s wrong?

(Matthew Fay) #2

Not sure.

What happens if you try the plugins/versioninfo method?

Make a Caddy folder (anywhere) and put this inside in a main.go:

package main

import (
	"github.com/mholt/caddy/caddy/caddymain"
	
	// plug in plugins here, for example:
	// _ "import/path/here"
)

func main() {
	// optional: disable telemetry
	// caddymain.EnableTelemetry = false
	caddymain.Run()
}

Then run go mod init caddy and go build.

1 Like
(Xpt) #3

Thanks for your reply @Whitestrake.

  • The error I have is at the go get phase. I.e., I’m not even at the compile stage yet.
  • Judging from the error of too many arguments to conversion to blackfriday.Markdown: blackfriday.Markdown(...), it seems that the blackfriday package that I’m getting:
go: downloading github.com/russross/blackfriday v2.0.0+incompatible
go: extracting github.com/russross/blackfriday v2.0.0+incompatible

is somehow not the correct version to be used along with caddyhttp.

I’m still unable to fix it on my home machine.
Will try to find another machine to redo the whole thing and see …

(Matthew Fay) #4

There is no need to run the go get phase. The above instructions are all that should be required.

(Xpt) #5

Quoting from https://github.com/mholt/caddy#build

To build Caddy without plugins:

  1. Set the transitional environment variable for Go modules: export GO111MODULE=on
  2. Run go get github.com/mholt/caddy/caddy

I’m only at step 2.

(Xpt) #6

But your message prompted me to try another thing @Whitestrake,

So instead of using go get -v -u ..., I’m using go get -v github.com/mholt/caddy/caddy this time. I.e., without the -u, and the go get went fine.

Yet, I still didn’t get the caddy binary in my $GOPATH/bin.
When I try to build/install myself, I get:

.../src/github.com/mholt/caddy/caddy$ go install -v
github.com/lucas-clemente/quic-go/internal/crypto
# github.com/lucas-clemente/quic-go/internal/crypto
../../../../../pkg/mod/github.com/lucas-clemente/quic-go@v0.10.1-no-integrationtests/internal/crypto/key_derivation.go:46:37: cs.KeyLen undefined (type mint.CipherSuiteParams has no field or method KeyLen)
../../../../../pkg/mod/github.com/lucas-clemente/quic-go@v0.10.1-no-integrationtests/internal/crypto/key_derivation.go:47:35: cs.IvLen undefined (type mint.CipherSuiteParams has no field or method IvLen)

I think I need to find another machine to redo the whole thing…

(Matthew Fay) #7

Did you run go install from inside the folder with the main.go and go.mod files, or did you run it from the Caddy source directory?

(Xpt) #8

Yes, I run it from the Caddy source directory.

No good?

(Matthew Fay) #9

No, it should be run in a new folder, like suggested in my previous post, which was based off the instructions here: https://github.com/mholt/caddy/wiki/Plugging-in-Plugins-Yourself. The process in this case should be exactly like building Caddy with plugins, but not actually plugging anything in, and shouldn’t require go get at all.

(Xpt) #10

Ah Thanks @Whitestrake!

Sorry for being dense previously – this is the first time I’m playing with go mod, and my old knowledge/practices are not helping this time.

Thanks to your suggestion (and the wiki), I have the caddy binary in my $GOPATH/bin now, by just following your suggestion / the wiki. Horay~~~

Thanks again!

1 Like
(Matt Holt) #11

Using -u causes the latest versions of each module to be installed, rather than the versions in our manifest. This breaks caddy’s build, which is why our instructions do not include that flag. :slight_smile:

2 Likes