GTest compile error during workspace build
Trying to build my workspace using
sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
but I keep getting the following error while it's building camera_info_manager:
==> Processing catkin package: 'camera_info_manager'
==> Building with env: '/opt/ros/kinetic/env.sh'
Makefile exists, skipping explicit cmake invocation...
==> make cmake_check_build_system in '/home/pi/catkin_ws/build_isolated/camera_info_manager'
==> make -j4 -l4 in '/home/pi/catkin_ws/build_isolated/camera_info_manager'
[ 16%] Building CXX object gtest/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 50%] Built target camera_info_manager
In file included from /usr/src/gtest/src/gtest-all.cc:42:0:
/usr/src/gtest/src/gtest.cc: In destructor ‘virtual testing::Test::~Test()’:
/usr/src/gtest/src/gtest.cc:1897:10: error: type ‘const class testing::internal::scoped_ptr<testing::internal::GTestFlagSaver>’ argument given to ‘delete’, expected pointer
delete gtest_flag_saver_;
^
/usr/src/gtest/src/gtest.cc: At global scope:
/usr/src/gtest/src/gtest.cc:2177:1: error: prototype for ‘testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::TypeId, testing::internal::TestFactoryBase*)’ does not match any in class ‘testing::TestInfo’
TestInfo::TestInfo(const std::string& a_test_case_name,
^
In file included from /usr/local/include/gtest/internal/gtest-internal.h:40:0,
from /usr/local/include/gtest/gtest.h:58,
from /usr/src/gtest/src/gtest-all.cc:39:
/usr/local/include/gtest/gtest.h:772:3: error: candidates are: testing::TestInfo::TestInfo(const testing::TestInfo&)
GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
^
In file included from /usr/src/gtest/src/gtest-all.cc:39:0:
/usr/local/include/gtest/gtest.h:728:3: error: testing::TestInfo::TestInfo(const string&, const string&, const char*, const char*, testing::internal::CodeLocation, testing::internal::TypeId, testing::internal::TestFactoryBase*)
TestInfo(const std::string& test_case_name,
^
//------------------------------------------------------------------
// and a lot more of similar syntax-related issues
//------------------------------------------------------------------
gtest/gtest/CMakeFiles/gtest.dir/build.make:62: recipe for target 'gtest/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o' failed
make[2]: *** [gtest/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
CMakeFiles/Makefile2:1463: recipe for target 'gtest/gtest/CMakeFiles/gtest.dir/all' failed
make[1]: *** [gtest/gtest/CMakeFiles/gtest.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'camera_info_manager':
Command '['/opt/ros/kinetic/env.sh', 'make', '-j4', '-l4']' returned non-zero exit status 2
Reproduce this error by running:
==> cd /home/pi/catkin_ws/build_isolated/camera_info_manager && /opt/ros/kinetic/env.sh make -j4 -l4
Command failed, exiting.
What is strange to me is that it looks like the problems are all contained within gtest. I can't find anything relevant, but I tried installing gtest from source as opposed to from the binaries and it still had no change (even with compiling with C++11).
EDIT:
In camera_info_manager's CMakeLists.txt, gtest isn't in the two first find_package calls:
find_package(catkin REQUIRED COMPONENTS camera_calibration_parsers image_transport roscpp roslib sensor_msgs)
and
find_package(Boost)
I did find gtest in this conditional, however:
if(CATKIN_ENABLE_TESTING)
find_package(rostest)
# Unit test uses gtest, but needs rostest to create a ROS environment.
# Hence ...
Could you please add the
find_package
sections of yourCMakeLists.txt
?@ct2034 It's done; gtest is only mentioned in a conditional statement block though. Would it be as simple as disabling that? EDIT: apparently it is that simple. It has compiled through without problem.