I have a project (let's call it the protobuf_package) that uses grpc (from this package: https://github.com/CogRob/catkin_grpc ) to generate headers from protobufs. protobufs are found in protobuf_package/protobufs/proto/, and the protobuf filename is 'Example.pb'. These headers are then installed into devel/include in the root directory, no further subdirectories. I can see this myself.
I have another project (let's call it linked_package) in which I would like to include these generated headers, but for the life of me I couldn't get it to work. It simply could not find the requested header file. I have tried the following to include it:
#include "Example.pb.h"
#include "proto/Example.pb.h"
#include "protobufs/proto/Example.pb.h"
#include "protobuf_package/Example.pb.h"
#include "protobuf_package/protobufs/proto/Example.pb.h"
But none of these work, all giving me the same error: that the file is not found
Here is my CMakeLists for linked_package:
cmake_minimum_required(VERSION 2.8.3)
project(linked_package)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
grpc
protobuf_package
roscpp
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES linked_package
CATKIN_DEPENDS grpc protobuf_package roscpp
# DEPENDS system_lib
)
###########
## Build ##
###########
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(linked_package src/test.cpp)
target_link_libraries(linked_package ${catkin_LIBRARIES})
add_executable(parrot_comm src/parrot_comm.cpp)
target_link_libraries(parrot_comm ${catkin_LIBRARIES} parrot_common_wrapper)
And here is the CMakeLists for protobuf_package
cmake_minimum_required(VERSION 2.8.3)
project(protobuf_package)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
grpc
roscpp
)
catkin_package(
# INCLUDE_DIRS include
LIBRARIES protobuf_package ${ALL_PROTOBUF_LIBS}
CATKIN_DEPENDS grpc roscpp
# DEPENDS system_lib
)
###########
## Build ##
###########
set(PROTO_DIR ./protobufs/proto)
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
generate_proto(protobuf_package SRC_BASE ${PROTO_DIR} FILES
${PROTO_DIR}/Example.proto
)
I initially thought this was a grpc bug, so I made a test case and sent it to the grpc project in github. This issue can be found here: https://github.com/CogRob/catkin_grpc/issues/31 . The test case zip can be found here: https://github.com/CogRob/catkin_grpc/files/2097761/grpc_header_bug_testcase.zip
However, the problem could not be reproduced, leading me to believe that there is something wrong with my environment. Does anyone have any insights?
My environment:
- Ubuntu MATE 16.04 amd64
- ROS Kinetic
I have also tried this test case on a Raspberry Pi 3 running a much fresher install of Ubuntu MATE and Kinetic. Same issue
↧