Skip to content

Commit

Permalink
Fix protobuf headers check. (#5381)
Browse files Browse the repository at this point in the history
If installed from a package manager, the header files will be at
/usr/include not /usr/local/include.

This change fixes the check by looking at both places and including
them in the call to protoc.
  • Loading branch information
martinmr committed May 15, 2020
1 parent fffc2ac commit 1d31f4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions protos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ copy-protos:
regenerate: copy-protos check clean
@protoc \
--proto_path=/usr/local/include \
--proto_path=/usr/include \
--proto_path=${PROTO_PATH} \
--gofast_out=plugins=grpc,Mapi.proto=${DGO_PATH}/protos/api:pb \
pb.proto
Expand Down
10 changes: 6 additions & 4 deletions protos/depcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ function CompareSemVer() {
}

function CheckProtobufIncludes() {
echo -n "Checking for directory /usr/local/include/google/protobuf... "
if [ ! -d /usr/local/include/google/protobuf ]; then
echo -n "Checking for directory /usr/include/google/protobuf or /usr/local/include/google/protobuf... "
if !([ -d /usr/include/google/protobuf ] || [ -d /usr/local/include/google/protobuf ]) ; then
echo "FAIL" >&2
echo "Missing protobuf types in /usr/local/include/google/protobuf: directory not found" >&2
echo "Download and install protoc and the protobuf types from protobuf releases page:" >&2
echo "Missing protobuf headers in /usr/include/google/protobuf or /usr/local/include/google/protobuf:" \
"directory not found." >&2
echo "Download and install protoc and the protobuf headers by installing protoc via a package manager" \
"or downloading it from the protobuf releases page:" >&2
echo "https://github.com/protocolbuffers/protobuf/releases/" >&2
exit 1
fi
Expand Down

0 comments on commit 1d31f4b

Please sign in to comment.