Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 46

No rule to make target for gTest

$
0
0
While using ```$ catkin_make run_tests_test_pkg```, the following error is generated by cmake: ``` *** No rule to make target '/usr/lib/libgtest.so', needed by '/home/username/catkin_ws/devel/lib/test_pkg/sampleTest'. Stop.``` I uninstalled gtest (and ROS) and reinstalled it again, but the error persists. The tests are successfully built on another system (ensured via git) with same OS (ubuntu 14.04) What are the possible reasons for this error, and how can this be removed? **EDIT**: CMakeLists.txt (unchanged, except for minor filename modifications: cmake_minimum_required(VERSION 2.8.3) project(my_library) find_package(catkin REQUIRED COMPONENTS my_msgs geometry_msgs roscpp roslib sensor_msgs std_msgs actionlib actionlib_msgs) catkin_package( INCLUDE_DIRS include CATKIN_DEPENDS my_msgs geometry_msgs roscpp roslib sensor_msgs std_msgs actionlib actionlib_msgs ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fprofile-arcs -ftest-coverage") include_directories( include/ ${catkin_INCLUDE_DIRS} ) set(math_HDRS include/my_library/math/abc.h include/my_library/math/xyz.h ) set(math_SRCS src/math/xyz.cpp ) set(math_test_HDRS ${math_HDRS} include/my_library/math/abc_test.h include/my_library/math/xyz_test.h ) set(math_test_SRCS ${math_SRCS} src/math/main_test.cpp ) add_library(my_library ${actionlib_HDRS} ${actionlib_SRCS} ${math_HDRS} ${math_SRCS}) # ${param_HDRS} ${param_SRCS}) add_dependencies(my_library ${catkin_EXPORTED_TARGETS}) target_link_libraries(my_library ${catkin_LIBRARIES} ${Boost_LIBRARIES} yaml-cpp) set(CMAKE_C++_CREATE_SHARED_LIBRARY) SET_TARGET_PROPERTIES(my_library PROPERTIES LINKER_LANGUAGE CXX) catkin_add_gtest(math_test ${math_test_SRCS} ${math_test_HDRS}) **EDIT**: clean cmake output (removed mangled c++ function names, and repetition of errors): Base path: /home/kunaltyagi/catkin_ws Source space: /home/kunaltyagi/catkin_ws/src Build space: /home/kunaltyagi/catkin_ws/build Devel space: /home/kunaltyagi/catkin_ws/devel Install space: /home/kunaltyagi/catkin_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/kunaltyagi/catkin_ws/build" #### #### #### Running command: "make run_tests_my_library -j8 -l8" in "/home/kunaltyagi/catkin_ws/build" #### Scanning dependencies of target math_test [100%] Building CXX object my_library/CMakeFiles/math_test.dir/src/math/main_test.cpp.o Linking CXX executable /home/kunaltyagi/catkin_ws/devel/lib/my_library/math_test CMakeFiles/math_test.dir/src/math/main_test.cpp.o:(txt+0x07): In file /home/kunaltyagi/catkin_ws/my_library/src/math/main_test.cpp *** No rule to make target '/usr/lib/libgtest.so', needed by '/home/kunaltyagi/catkin_ws/devel/lib/my_library/math_test'. Stop. CMakeFiles/math_test.dir/src/math/main_test.cpp.o:(txt+0xc1): In function 'testing::internal::FormatForComparisonFailureMessage(char const*, std::string const&)': /usr/include/gtest/gtest.h:1328: error: undefined reference to 'testing::internal::EqFailure(char const, char const, testing::internal::String const&, testing::internal::String const&, bool)' **** repeat this multiple times for each usage of ASSERT_EQ and EXPECT_EQ**** /usr/include/gtest/gtest.h:1328: error: undefined reference to 'testing::internal::EqFailure(char const, char const, testing::internal::String const&, testing::internal::String const&, bool)' collect2: error: ld returned 1 exit status make[3]: *** [my_library/CMakeFiles/math_test.dir/src/math/main_test.cpp.o] Error 1 make[2]: *** [my_library/CMakeFiles/math_test.dir/all] Error 2 make[1]: *** [my_library/CMakeFiles/run_tests_my_library.dir/rule] Error 2 make: *** [run_tests_my_library] Error 2 Invoking "make" failed

Viewing all articles
Browse latest Browse all 46

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>