Caddy: Unable to build Caddy from Source

Created on 12 Oct 2016  路  7Comments  路  Source: caddyserver/caddy

1. What version of Caddy are you running (caddy -version)?

Pulled commit #1178

2. What are you trying to do?

Trying to recompile Caddy from source using _build.bash_

3. What is your entire Caddyfile?

(Put Caddyfile here)

4. How did you run Caddy (give the full command and describe the execution environment)?

$ go get github.com/mholt/caddy
$ cd $GOPATH/src/github.com/mholt/caddy/caddy
$ ./build.bash 

5. What did you expect to see?

Expected to see Caddy's binary in my _$GOPATH/bin_ folder

6. What did you see instead (give full error messages and/or log)?

../../../mholt/caddy/caddyhttp/browse/browse.go:18:2: cannot find package "github.com/dustin/go-humanize" in any of:
    /usr/local/go/src/github.com/dustin/go-humanize (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/dustin/go-humanize (from $GOPATH)
../../../mholt/caddy/caddyhttp/websocket/websocket.go:17:2: cannot find package "github.com/gorilla/websocket" in any of:
    /usr/local/go/src/github.com/gorilla/websocket (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/gorilla/websocket (from $GOPATH)
../../../mholt/caddy/caddyhttp/errors/setup.go:10:2: cannot find package "github.com/hashicorp/go-syslog" in any of:
    /usr/local/go/src/github.com/hashicorp/go-syslog (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/hashicorp/go-syslog (from $GOPATH)
../../../mholt/caddy/caddyhttp/basicauth/basicauth.go:20:2: cannot find package "github.com/jimstudt/http-authentication/basic" in any of:
    /usr/local/go/src/github.com/jimstudt/http-authentication/basic (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/jimstudt/http-authentication/basic (from $GOPATH)
../../../mholt/caddy/caddyhttp/httpserver/server.go:17:2: cannot find package "github.com/lucas-clemente/quic-go/h2quic" in any of:
    /usr/local/go/src/github.com/lucas-clemente/quic-go/h2quic (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/lucas-clemente/quic-go/h2quic (from $GOPATH)
../../../mholt/caddy/caddyhttp/markdown/metadata/metadata_toml.go:6:2: cannot find package "github.com/naoina/toml" in any of:
    /usr/local/go/src/github.com/naoina/toml (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/naoina/toml (from $GOPATH)
../../../mholt/caddy/caddyhttp/httpserver/context.go:15:2: cannot find package "github.com/russross/blackfriday" in any of:
    /usr/local/go/src/github.com/russross/blackfriday (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/russross/blackfriday (from $GOPATH)
../../../mholt/caddy/caddytls/client.go:15:2: cannot find package "github.com/xenolf/lego/acme" in any of:
    /usr/local/go/src/github.com/xenolf/lego/acme (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/github.com/xenolf/lego/acme (from $GOPATH)
../../../mholt/caddy/caddytls/certificates.go:13:2: cannot find package "golang.org/x/crypto/ocsp" in any of:
    /usr/local/go/src/golang.org/x/crypto/ocsp (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/golang.org/x/crypto/ocsp (from $GOPATH)
../../../mholt/caddy/caddyhttp/httpserver/roller.go:9:2: cannot find package "gopkg.in/natefinch/lumberjack.v2" in any of:
    /usr/local/go/src/gopkg.in/natefinch/lumberjack.v2 (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/gopkg.in/natefinch/lumberjack.v2 (from $GOPATH)
../../../mholt/caddy/caddyhttp/markdown/metadata/metadata_yaml.go:6:2: cannot find package "gopkg.in/yaml.v2" in any of:
    /usr/local/go/src/gopkg.in/yaml.v2 (from $GOROOT)
    /home/ashwin/Documents/go-workspace/src/gopkg.in/yaml.v2 (from $GOPATH)

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Well, someone can install latest version of Go, get Caddy from the source by go get github.com/mholt/caddy and then try to compile/run it.

I understand that the problem arises because certain packages are missing. It would be a much cleaner install if during installation the build script automatically finds missing packages and installs them as well.

All 7 comments

You need to use go get github.com/mholt/caddy/caddy

I wanted to see if I got the same result and I did, but then I looked at the instructions, you should be running:

go get github.com/mholt/caddy/caddy

I followed the instructions from the README.md & it installed properly.

Edit: @elcore beat me to the response, but as a general recommendation, make sure to read documentation closely. :smile:

@elcore @chaseadamsio - Yes, it did work, I should have read the documentation better. Thank you so much! :+1:

Just in case someone would need to build it:

go get github.com/mholt/caddy/caddy
cd $GOPATH/src/github.com/mholt/caddy/caddy/
go run build.go

Then:

$ caddy --version
Caddy (untracked dev build) (unofficial)

@greenpau Instead of go build, use go run build.go according to the build instructions on the README. It'd be great if you update your post with these instructions, so that others who find this via search don't miss out on proper builds with versioning, etc. It helps a lot in debugging and error reporting.

It'd be great if you update your post with these instructions

@mholt , done 馃憤

Excellent!! Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crvv picture crvv  路  3Comments

kilpatty picture kilpatty  路  3Comments

wayneashleyberry picture wayneashleyberry  路  3Comments

mschneider82 picture mschneider82  路  3Comments

xfzka picture xfzka  路  3Comments