6
votes

I've been trying to install Mosh (the mobile shell) on the following system:

[ptedder@ukch-dev-lndt03 mosh-1.2.4]$ cat /etc/*-release
CentOS release 5.3 (Final)

It configures okay, however when I try and make Mosh 1.2.4 (or 1.2.0) I get the following error:

make  all-recursive
make[1]: Entering directory `/home/ptedder/bin/mosh-1.2.4'
Making all in src
make[2]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src'
Making all in protobufs
make[3]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make  all-am
make[4]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
  CXX    userinput.pb.o
In file included from userinput.pb.cc:5:
userinput.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
userinput.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
userinput.pb.h:14:2: error: #error your headers.
make[4]: *** [userinput.pb.o] Error 1
make[4]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ptedder/bin/mosh-1.2.4'
make: *** [all] Error 2

This was with Protocol buffers version 2.4.1 (suggested it might be hardcoded into mosh here #import <string> in ios? Protobuf c++ in ios) but I've tried using Protocol buffers version 2.3.0 and 2.5.0 as well and they all give the following error:

"This file was generated by a newer version of protoc which is
userinput.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
userinput.pb.h:14:2: error: #error your headers."

any ideas?

2

2 Answers

6
votes

Two years after this question was asked, I still couldn't find a good solution. I had the same problem, and eventually fixed it after some detective work. The problem was this: I had the latest version of protobuf from the git repo, https://github.com/google/protobuf. When I tried to build my project, it was throwing the error shown in qmp's answer,

#if GOOGLE_PROTOBUF_VERSION < 2004000                                           
#error This file was generated by a newer version of protoc which is...  

I was building code that someone else wrote, and in their .proto file, they didn't specify a version. The default is syntax = "proto2"; I added syntax = "proto3"; to the .proto file just before the package declaration and removed all instances of the optional and required keywords, as they are not part of version 3 syntax. Then from the command line, I regenerated the protobuf output.

prompt@ubuntu$ protoc --cpp_out=. project.proto

This updated all the files generated by protoc to version 3, which solved the issue.

0
votes

If you look at userinput.pb.h, you will notice it reads

#if GOOGLE_PROTOBUF_VERSION < 2004000                                           
#error This file was generated by a newer version of protoc which is            

So protobuf-2.4.1 is sufficient for mosh-1.2.4. If you still get the error, then there may be a stray protobuf installation, likely something in /usr/local.