Complling lora-app-server source with docker gives proto.ProtoPackageIsVersion3 Error

Getting errors trying to compile lora-app-server from sources as follows:
On Ubuntu 18.04, go version 1.11, node version 10.14.2
Cloned the latest lora-app-server source into a fresh go/src/github.com/brocaar/lora-app-server
cd lora-app-server
docker-compose run --rm appserver bash
make dev-requirements requirements ui-requirements
(all looks ok - requirements writes 59 files)
make clean

bash-4.4# make api
Generating API code from .proto files
/usr/local/include: warning: directory does not exist.
/usr/local/include: warning: directory does not exist.
/usr/local/include: warning: directory does not exist.

bash-4.4# make test
Generating combined Swagger JSON
Generating static files
Generating static files
Running tests

github.com/brocaar/lora-app-server/api

api/application.pb.go:25:11: undefined: proto.ProtoPackageIsVersion3
api/common.pb.go:25:11: undefined: proto.ProtoPackageIsVersion3
api/device.pb.go:27:11: undefined: proto.ProtoPackageIsVersion3
api/deviceProfile.pb.go:26:11: undefined: proto.ProtoPackageIsVersion3
api/deviceQueue.pb.go:25:11: undefined: proto.ProtoPackageIsVersion3
api/gateway.pb.go:27:11: undefined: proto.ProtoPackageIsVersion3
api/gatewayProfile.pb.go:27:11: undefined: proto.ProtoPackageIsVersion3
api/internal.pb.go:26:11: undefined: proto.ProtoPackageIsVersion3
api/multicastGroup.pb.go:26:11: undefined: proto.ProtoPackageIsVersion3
api/networkServer.pb.go:26:11: undefined: proto.ProtoPackageIsVersion3
api/networkServer.pb.go:26:11: too many errors
make: *** [Makefile:20: test] Error 2

Any assistance would be appreciated.
Cheers Ron

Answering my own question, In case this helps somebody else. It seems there is currently a problem with protobuf versions. A workaround solution (worked for me at least) to compile without docker is to implement the following downgrade / upgrade process. I had to install go v1.10.4 rather than the latest v1.11.4! Then after installing protobuf for C++ (which installs the protoc compiler binary in /usr/local/bin), ‘make dev-requirements’ in the lora-app-server folder. Then in the root of the golang protobuf source i.e. ‘git clone https://github.com/golang/protobuf’ then cd protobuf, then execute:

go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/proto
go get -u github.com/golang/protobuf/protoc-gen-go
go get -u go.pedge.io/protoeasy/cmd/protoeasy
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger

cd $GOPATH/src/github.com/ golang/protobuf/protoc-gen-go
git checkout v1.2.0
go install
git checkout master

cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
git checkout v1.5.1
go install
git checkout master

In lora-app-server folder ‘make requirements’, ‘make ui-requirements’, ‘make clean’, ‘make api’, ‘make build’, ‘make snapshot’. There is a problem with lora-app-server ‘make check’, but ‘make build’ and ‘make snapshot’ appear to work ok. The debian PC package created from ‘make snapshot’ installs and lora-app-server runs.
Cheers
Ron

1 Like

I also encounter this problem. I want to modify some .proto files and need to regenerate the files relate to it.
@brocaar could you clarify this issue? Thank you!

1 Like

Actually the above didn’t work properly, there was some wrong behaviour in the application.
It seems that the protoc-gen-go and protoc-gen-crpc-gateway should be build from their respective ‘master’ branches
However when that is done there are undefined errors when ‘make api’ then ‘make test’ is run:
E.g. a bunch similar this:
api/application.pb.gw.go:35:21: undefined: utilities.IOReaderFactory
Don’t understand as the grpc-gateway ‘utilities’ package appears to define an IoReaderFactory function
and the generated .go files import “github.com/grpc-ecosystem/grpc-gateway/utilities
Struggling with golang at this point!

So do I. This seems is issue of protocol buffer, https://github.com/golang/protobuf/issues/763.

I have the same issue, can not find a solution with docker