Boost and Protobuf dependency

Asked by Laszlo Techy

I have been trying to compile goby 2.0.0 using the instructions in the INSTALL.txt, and have been having trouble with the Google Protocol buffers and boost dependency.
The latest Google Protocol buffers (2.4.1) didn't seem to be compatible. The problem was solved using 2.3.0.

Upon compilation I experienced linking errors to some of the boost binary libraries (boost::system) using the latest boost 1.49. Somewhere in the documentation I saw that boost 1.36 was used. Boost 1.36 didn't compile due to an issue with gcc > 4.4. Boost 1.37 did compile properly, but then I got build errors:

/usr/local/include/boost-1_37/boost/date_time/tz_db_base.hpp:161:58: error: declaration of ‘typedef class boost::date_time::dst_adjustment_offsets<typename time_zone_type::time_duration_type> boost::date_time::tz_db_base<time_zone_type, rule_type>::dst_adjustment_offsets’
/usr/local/include/boost-1_37/boost/date_time/time_zone_base.hpp:76:3: error: changes meaning of ‘dst_adjustment_offsets’ from ‘class boost::date_time::dst_adjustment_offsets<typename time_zone_type::time_duration_type>’
make[2]: *** [src/common/CMakeFiles/goby_common.dir/time.cpp.o] Error 1
make[1]: *** [src/common/CMakeFiles/goby_common.dir/all] Error 2
make: *** [all] Error 2

Can you point me to the boost version that was tested with the current version of goby?

Thank you!
Best,
Laszlo

Question information

Language:
English Edit question
Status:
Solved
For:
Goby Edit question
Assignee:
No assignee Edit question
Solved by:
Laszlo Techy
Solved:
Last query:
Last reply:
Revision history for this message
toby schneider (tes) said :
#1

Hi -

The Ubuntu packages all built nightly against Ubuntu versions 10.04 -> 12.04. So, they're building against Google Protobuf 2.3.0 through 2.4.1, and Boost 1.40 through 1.48.

Could you post the error you get when using Protobuf 2.4.1?

As for Boost, I think version 1.36 should also be supported but that's mostly to support older systems without a newer compiler (e.g. gcc 3.3 / gcc 3.4). I haven't tested that recently though, so stick with Boost >=1.40 if you can.

If you need more help, please let me know what system you're using (e.g. Ubuntu 64 bit, MAC OS X Lion)

Revision history for this message
Laszlo Techy (techy) said :
#2

Thanks for the quick response. I am using Ubuntu Natty Narwhal 11.04 64 bit.

The error I get using protobuf is

/usr/include/goby/common/protobuf/logger.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
/usr/include/goby/common/protobuf/logger.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
/usr/include/goby/common/protobuf/logger.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.

This is an excerpt. The problem goes away using protobuf 2.3.0.

Revision history for this message
toby schneider (tes) said :
#3

Are you using the packaged version of Goby from here: https://launchpad.net/~goby-dev/+archive/ppa or did you compile from source? In the former case, you should have gotten the same version of Google Protocol Buffers as Goby was built against when you installed the package.

In the latter case I would only expect that message if you had compiled (make/make install) Goby with one version of the Google Protobuf Compiler ('protoc') and then were using the headers (/usr/include/google/protobuf) of a different version.

Either way, if 2.3.0 works for you, that's good.

Did you solve your problem with boost? Is there a reason you're not using the package manager to install it? That is:

sudo apt-get install libboost-dev libboost-system-dev libboost-date-time-dev libboost-thread-dev libboost-program-options-dev libboost-filesystem-dev libboost-signals-dev libboost-regex-dev

Revision history for this message
Laszlo Techy (techy) said :
#4

I tried compiling from source and also downloading it following the instructions here:

http://gobysoft.org/wiki/UbuntuLinuxInstall

The download and install from repositories went without errors. Then I tried to run examples as described here

http://gobysoft.org/wiki/Examples

The error I got was

[ 4%] Building CXX object acomms/chat/CMakeFiles/goby_chat.dir/chat.cpp.o
/home/techy/Documents/VTUG/WHOI/Goby/test/examples/acomms/chat/chat.cpp:31:28: fatal error: goby/util/time.h: No such file or directory
compilation terminated.
make[2]: *** [acomms/chat/CMakeFiles/goby_chat.dir/chat.cpp.o] Error 1
make[1]: *** [acomms/chat/CMakeFiles/goby_chat.dir/all] Error 2
make: *** [all] Error 2

I realize that the time.h file is missing (and I could copy it from the source package from under src/common/time.h), but not sure where the preprocessor looks for the include files when the software comes from the repository.

I also tried compiling from source following

http://gobysoft.org/wiki/InstallFromSource

When doing that I got a number of errors, depending what version of boost or protobuf I was working with. The last time I tried I got an error for a missing file MOOSLIB/MOOSMsg.h.

Thanks for the help!

Best,
Laszlo

Revision history for this message
toby schneider (tes) said :
#5

If you're using Ubuntu, you probably don't need to waste your time compiling from source.

As for the examples, that's a bug, my apologies.

Change the line:
#include "goby/util/time.h"
to:
#include "goby/common/time.h"

in examples/acomms/chat/chat.cpp

I'll commit a fix, but that will do for now.

Also, this example is broken at the moment: examples/acomms/queue/encode_on_demand, so disable compilation by changing:
add_subdirectory(encode_on_demand)

to:
#add_subdirectory(encode_on_demand)

in examples/acomms/queue/CMakeLists.txt

Revision history for this message
Laszlo Techy (techy) said :
#6

Thanks! The suggestion is helpful. To start a clean install I removed all instances from previous protobuf installs:

Includes from: /usr/local/include/google/protobuf
Shared libraries from /usr/local/lib

I removed goby using
sudo apt-get remove libgoby2 libgoby2-dev

Then I installed protobuf 2.4.1. Then I installed goby using

sudo apt-get install libgoby2 libgoby2-dev

Then cp -r /usr/share/goby/examples/ /home/myDir/

cmake .
make

I am still getting errors with the protocol buffers for some reason :

/usr/include/goby/acomms/protobuf/amac_config.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
/usr/include/goby/acomms/protobuf/amac_config.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
/usr/include/goby/acomms/protobuf/amac_config.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
make[2]: *** [acomms/chat/CMakeFiles/goby_chat.dir/chat.cpp.o] Error 1
make[1]: *** [acomms/chat/CMakeFiles/goby_chat.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
toby schneider (tes) said :
#7

If you're going to use the packaged version of Goby, you need to use the same version of the protobuf library (libprotobuf-dev) that Goby was built with. This happens to be 2.3.0, since that is the version packaged in Natty (see http://packages.ubuntu.com/natty/libprotobuf-dev)

If must use 2.4.1, you'll need to install Goby from source after removing the packaged versions (sudo apt-get remove libgoby2 libgoby2-dev).

If you can live with 2.3.0, then I'd suggest using it.

In general, don't fight the package manager unless you need to.

Revision history for this message
Laszlo Techy (techy) said :
#8

Thank you for all the help! The only remaining thing to do was to remove the clutter I created trying to install different versions of protobuf and boost. I still had issues with boost 1.48 and 1.49, but removing all boost files from /usr/local/lib and /usr/local/include and installing using

sudo apt-get install libboost-dev libboost-system-dev libboost-date-time-dev libboost-thread-dev libboost-program-options-dev libboost-filesystem-dev libboost-signals-dev libboost-regex-dev

Fixed the problem. Cmake found that the version of boost was 1.42 (not sure where those files are located).

In any case, it compiles now.