google/protobuf/any.proto: file not found on RHEL 7.

4,410 views
Skip to first unread message

Jon Kruger

unread,
Nov 6, 2019, 11:08:33 PM11/6/19
to Protocol Buffers
when I try to compile my .proto to python and cpp, I get the following:
$ protoc --python_out=./py_msgs --cpp_out=./cpp_msgs ./spm.proto

google
/protobuf/any.proto: File not found.
spm
.proto:4:1: Import "google/protobuf/any.proto" was not found or had errors.
spm
.proto:228:3: "google.protobuf.Any" is not defined.
$


Code:
syntax = "proto3";
package myMessages;


import "google/protobuf/any.proto";  // line 4
...// skip a bunch of lines where I define sub messages and enums
message
SpmMyMessage { // line 226
 
MessageIdType       ID   = 1; // an enum
  google
.protobuf.Any body = 2;
}


System:
Redhat 7.6
kernel 3.10.0-957.10.1.el7.x86_64

When I did the make install, it didn't finish, so I had to finish "by hand", and here is what I did:
tar -xvf protobuf-all-3.10.1.tar.gz
cd protobuf
-3.10.1
./configure
make
-j
make check
sudo make install  
# fails, so need to execute the following extra commands
 
cd src
/.libs
sudo cp libprotobuf
.a /usr/local/lib
sudo cp libprotobuf
-lite.a /usr/local/lib
sudo cp libprotoc
.a /usr/local/lib
sudo cp libprotoc
.la /usr/local/lib
sudo cp libprotoc
.so.21.0.1 /usr/local/lib
sudo cp protoc
/usr/local/bin
 
cd  
/usr/local/lib
sudo ln
-s libprotoc.so.21.0.1 libprotoc.so
sudo ln
-s libprotoc.so.21.0.1 libprotoc.so.21


Python modules installed:
sudo pip3 install --trusted-host pypi.org clint zmq mock pyserial google protobuf protobuf3

Does anyone know what I'm doing wrong?  If I look in the unzipped source, in src/google/protobuf/ there are a bunch of non-test .proto files.  I just don't know if they need to be copied somewhere as well.  I'm thinking my failed install also failed to copy those files.

Jon Kruger

unread,
Nov 7, 2019, 9:10:37 AM11/7/19
to Protocol Buffers
Found the solution on an Ubuntu install: there are 11 .proto files that go in /usr/local/include/google/protobuf/ :
any.proto
api.proto
descriptor.proto
duration.proto
empty.proto
field_mask.proto
source_context.proto
struct.proto
timestamp.proto
type.proto
wrappers.proto 
Reply all
Reply to author
Forward
0 new messages