0
$\begingroup$

Rosanswers logo

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?


Originally posted by fmrico on ROS Answers with karma: 85 on 2018-08-06

Post score: 0


Original comments

Comment by Dirk Thomas on 2018-08-06:
What version of the package ros-kinetic-catkin do you have installed?

Comment by fmrico on 2018-08-06:
0.7.11-0xenial-20180222-175501-0800

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You will need to update ros-kinetic-catkin to at least version 0.7.12 (see https://github.com/ros/catkin/blob/kinetic-devel/CHANGELOG.rst#0712-2018-05-01).


Originally posted by Dirk Thomas with karma: 16276 on 2018-08-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by fmrico on 2018-08-06:
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...

Comment by Dirk Thomas on 2018-08-06:
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.

Comment by fmrico on 2018-08-07:
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.

Comment by roboticom314 on 2018-08-10:
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?

Comment by Dirk Thomas on 2018-08-10:
Version 0.7.14 has recently been released into Kinetic. The status page (http://repositories.ros.org/status_page/ros_kinetic_default.html?q=catkin) 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...

Comment by Dirk Thomas on 2018-08-10:
(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).

Comment by Dirk Thomas on 2018-08-10:
The Debian package is in the building repo (http://repositories.ros.org/ubuntu/building/pool/main/r/ros-kinetic-catkin/) if you want to install it ahead of time. In this case that should be fine - in other cases I wouldn't recommend it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.