ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Gtest errors when compiling workspace

asked 2018-08-06 13:14:51 -0600

fmrico gravatar image

For some time now (due to some update, probably), I have problems with GTest when compiling a workspace.

When installing GTest on the system, libgtest.so and libgtest_main.so are created, and cmake finds them. They are static or dynamic depending on how it is installed. Everithing is OK (I suppose)

When compiling a workspace, I always have the same error:

-- Using empy: /usr/bin/empy

-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/paco/ros_ws/tests_ws/build/test_results
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found gtest: gtests will be built 
CMake Error at /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:372 (add_library):   add_library cannot create imported target "gtest" because another target   with the same name already exists. Call Stack (most recent call first):   /opt/ros/kinetic/share/catkin/cmake/all.cmake:147 (include)   /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)   CMakeLists.txt:52 (find_package)

CMake Error at /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:374 (add_library):   add_library cannot create imported target "gtest_main" because another   target with the same name already exists. Call Stack (most recent call first):   /opt/ros/kinetic/share/catkin/cmake/all.cmake:147 (include)   /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)   CMakeLists.txt:52 (find_package)

-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11

This is caused because in /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:363, libgtest.so is required to be built, even if it exists in the system, producing that error.

Is there something I'm doing wrong, or is it misconfigured in my system?

edit retag flag offensive close merge delete

Comments

What version of the package ros-kinetic-catkin do you have installed?

Dirk Thomas gravatar image Dirk Thomas  ( 2018-08-06 14:14:17 -0600 )edit

0.7.11-0xenial-20180222-175501-0800

fmrico gravatar image fmrico  ( 2018-08-06 16:41:35 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-08-06 17:03:06 -0600

Dirk Thomas gravatar image

You will need to update ros-kinetic-catkin to at least version 0.7.12 (see https://github.com/ros/catkin/blob/ki... ).

edit flag offensive delete link more

Comments

Yes, it fixed my problem :) Thanks!!!

The point is that, as far as I know, 0.7.11 is the current version for kinetic xenial, and it seems to be broken...

fmrico gravatar image fmrico  ( 2018-08-06 17:16:35 -0600 )edit

Since other Xenial systems don't face the problem I would assume there is a difference on your system. Do you have a custom version of gtest / googletest installed? Anyway the latest version of catkin should become available in Kinetic in a future sync.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-08-06 19:07:21 -0600 )edit

It is an updated xenial distro, and gtest is installed using the libgtest-dev package in the distro (1.7.0-4). Obviously, there is a particularity, but I do not figure out which.

fmrico gravatar image fmrico  ( 2018-08-07 07:24:08 -0600 )edit

What is the process of updating ros-kinetic-catkin to 0.7.12 since there's only one candidate (0.7.11) to install with apt install?

I suppose to build from source and install. What's the preferred install location?

roboticom314 gravatar image roboticom314  ( 2018-08-10 10:35:44 -0600 )edit

Version 0.7.14 has recently been released into Kinetic. The status page ( http://repositories.ros.org/status_pa... ) shows that it has been built already (first green square), once all other Kinetic packages have been rebuild it becomes available in the testing repo...

Dirk Thomas gravatar image Dirk Thomas  ( 2018-08-10 10:56:05 -0600 )edit

(second square, currently blue since it has still the old version) - that should happen within 24h. After that it becomes available in the main repo when the "ROS Boss" decides to sync which is announced on Discourse (usually within a couple of weeks).

Dirk Thomas gravatar image Dirk Thomas  ( 2018-08-10 10:58:42 -0600 )edit

The Debian package is in the building repo ( http://repositories.ros.org/ubuntu/bu... ) if you want to install it ahead of time. In this case that should be fine - in other cases I wouldn't recommend it.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-08-10 10:59:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-08-06 13:14:51 -0600

Seen: 1,019 times

Last updated: Aug 06 '18