We are working on a project, where we need protbuf in order to deserialize some specific messages received over tcp.
First, we want to build for the host - but even this is not working like expected.
Build LibProtobuf on Host
We are using cmake to build protobuf on the host machine.
Excerpt from our CMakeCache.txt:
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++
CMAKE_INSTALL_PREFIX:PATH=/home/ubuntu/Projects/Protobuf/INSTALL_SO
protobuf_BUILD_SHARED_LIBS:BOOL=ON
Use LibProtobuf within Driveworks
To see if building is working, we hardcoded the CMakeLists changes. This will be resolved lateron.
Changed the default CMakeLists.txt of the render example app to include protobuf:
include_directories("/home/ubuntu/Projects/Protobuf/INSTALL_SO/include")
Also we added the lib to the libraries:
set(LIBRARIES
dw_samples_framework
${Driveworks_LIBRARIES}
/home/ubuntu/Projects/JohannHaselberger/testBuff/INSTALL/lib/libprotobuf.so
)
And finally added the Protobuf generated files:
set(SOURCES
main.cpp
testPB.pb.h
testPB.pb.cc
)
Building
The CMake command runs perfectly but make stops with this error message:
/home/ubuntu/Projects/Protobuf/INSTALL_SO/lib/libprotobuf.so: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Side note
We actually are doing the same procedure with libzmq (build libzmq with cmake and inlcude it the same way as protbuf). Here, building works like a charm.