etix / mirrorbits

Mirrorbits is a geographical download redirector written in Go for distributing files efficiently across a set of mirrors.
MIT License
497 stars 90 forks source link

Unable to compile #88

Closed manno closed 5 years ago

manno commented 5 years ago

I'm trying to build mirrorbits, but run into an error. Doesn't matter if I do it on Ubuntu or in Docker:

Step 6/9 : RUN mkdir /srv/repo /var/log/mirrorbits &&     cd /go/src/github.com/etix/mirrorbits &&     make install PREFIX=/usr
 ---> Running in 2d3cca9f4a75
go get github.com/kardianos/govendor
Package systemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `systemd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'systemd' found
govendor sync github.com/etix/mirrorbits
go get -u github.com/golang/protobuf/protoc-gen-go
protoc -I rpc rpc/rpc.proto --go_out=plugins=grpc:rpc
go build -ldflags "-X github.com/etix/mirrorbits/core.VERSION=v0.5.1-2-gd6949fe -X github.com/etix/mirrorbits/core.BUILD=d6949fe-mm-upgrade-2018 -X github.com/etix/mirrorbits/config.TEMPLATES_PATH=/usr/share/mirrorbits" -o bin/mirrorbits .
# github.com/etix/mirrorbits/rpc
rpc/rpc.pb.go:25:11: undefined: "github.com/etix/mirrorbits/vendor/github.com/golang/protobuf/proto".ProtoPackageIsVersion3
make: *** [build] Error 2
Makefile:37: recipe for target 'build' failed
The command '/bin/sh -c mkdir /srv/repo /var/log/mirrorbits &&     cd /go/src/github.com/etix/mirrorbits &&     make install PREFIX=/usr' returned a non-zero code: 2
derchrisuk commented 5 years ago

Try this. Edit the Makefile, and modify the protoc section as follows:

protoc:
     go get -u github.com/golang/protobuf/protoc-gen-go
     git -C ${GOPATH}/src/github.com/golang/protobuf checkout v1.2.0
     go install github.com/golang/protobuf/protoc-gen-go
     protoc -I rpc rpc/rpc.proto --go_out=plugins=grpc:rpc
manno commented 5 years ago

Thanks, with 1.2.0 I can build again!

theel0ja commented 5 years ago

Try this. Edit the Makefile, and modify the protoc section as follows:

protoc:
     [snip]

I had to change the spaces in it to tabs.

manno commented 5 years ago

Also the make target didn't work for me the second time, because go get -u didn't like the checkout.

the-maldridge commented 5 years ago

The provided solution doesn't seem to have fixed my build. I still get a number of errors like this:

rpc.proto:65:5: "google.protobuf.Timestamp" is not defined.