Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gtest-not-found bug #1040

Merged
merged 1 commit into from
Nov 16, 2019
Merged

Fix gtest-not-found bug #1040

merged 1 commit into from
Nov 16, 2019

Conversation

mikepurvis
Copy link
Member

This change fixes #1030, which arises from the changes made in #1022.

It works for me on Ubuntu 16.04, but it should be checked by a user on Debian Buster to confirm that the original fix still works as expected.

@dirk-thomas
Copy link
Member

@sloretz can you please try this with Debian Buster?

@mikepurvis
Copy link
Member Author

@jwhendy Can you also check if this fixes your build issues on Arch?

@@ -226,16 +227,19 @@ endfunction()
# :param[out] gmock_main_libs: GMock's main libraries
# :param[out] base_dir: The base directory containing Google Test and/or GMock CMakeLists.txt
#
function(catkin_find_google_test_source include_path src_path
function(catkin_find_google_test_source gtest_path googletest_path
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this is changing the signature of the function, but I'm pretty sure the only place that's calling it is in this file; it's not really an external interface, so it should be safe to change.

@jwhendy
Copy link

jwhendy commented Nov 9, 2019

I can confirm that the fix-1030 branch from @mikepurvis works when building ros-melodic-realtime-tools on arch linux, while kinetic-devel does not.

I do get a bunch of warnings like this, but they don't seem to affect the build.

CMake Warning (dev) at /usr/src/gmock/CMakeLists.txt:47 (add_subdirectory):
  Policy CMP0013 is not set: Duplicate binary directories are not allowed.
  Run "cmake --help-policy CMP0013" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The binary directory

    /home/jwhendy/catkin_ws/build/moveit_tutorials/gtest

  is already used to build a source directory.  This command uses it to build
  source directory

    /usr/src/gtest

  which can generate conflicting build files.  CMake does not support this
  use case but it used to work accidentally and is being allowed for
  compatibility.
This warning is for project developers.  Use -Wno-dev to suppress it.

Edit: this is one output from my catkin build process, but most/all packages seem to spit it out. Just adding this as it might be confusing that realtime-tools was the topic of discussion and this error was for moveit_tutorials.

Thanks for taking a stab at this @mikepurvis !

@dirk-thomas
Copy link
Member

@jwhendy Please provide more context: what platform are you seeing these warnings on, what version of CMake are you using? Also this seems to be unrelated to this PR. Can you please check if the same warning happens with older versions of catkin?

@sloretz
Copy link
Contributor

sloretz commented Nov 15, 2019

@sloretz can you please try this with Debian Buster?

I'm able to build on Debian buster up to and including realtime_tools (with ros-controls/realtime_tools#46) using this branch, though there are a couple extra include paths passed to g++. The ones ending in /include make sense to me, but the ones without it don't. I haven't figured out where they come from yet.

/usr/bin/c++  -DROSCONSOLE_BACKEND_LOG4CXX -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME=\"realtime_tools\" -I/home/sloretz/rtt/src/realtime_tools/include -I/home/sloretz/ws/noetic/devel_isolated/roscpp/include -I/home/sloretz/ws/noetic/devel_isolated/roscpp/include/ros -I/home/sloretz/ws/noetic/src/ros_comm/clients/roscpp/include -I/home/sloretz/ws/noetic/src/ros_comm/utilities/xmlrpcpp/include -I/home/sloretz/ws/noetic/src/ros_comm/utilities/xmlrpcpp/include/xmlrpcpp -I/home/sloretz/ws/noetic/devel_isolated/rosgraph_msgs/include -I/home/sloretz/ws/noetic/devel_isolated/std_msgs/include -I/home/sloretz/ws/noetic/src/std_msgs/include -I/home/sloretz/ws/noetic/src/rosconsole/include -I/home/sloretz/ws/noetic/src/roscpp_core/roscpp_serialization/include -I/home/sloretz/ws/noetic/src/roscpp_core/rostime/include -I/home/sloretz/ws/noetic/src/roscpp_core/roscpp_traits/include -I/home/sloretz/ws/noetic/src/roscpp_core/cpp_common/include -isystem /usr/src/googletest/googlemock/include -isystem /usr/src/googletest/googlemock -isystem /usr/src/googletest/googletest/include -isystem /usr/src/googletest/googletest  -O3 -DNDEBUG   -pthread -DGTEST_HAS_PTHREAD=1 -o CMakeFiles/realtime_box_tests.dir/test/realtime_box_tests.cpp.o -c /home/sloretz/rtt/src/realtime_tools/test/realtime_box_tests.cpp

From above, highlighting:

    -isystem /usr/src/googletest/googlemock/include
    -isystem /usr/src/googletest/googlemock
    -isystem /usr/src/googletest/googletest/include
    -isystem /usr/src/googletest/googletest

@jwhendy
Copy link

jwhendy commented Nov 15, 2019

@dirk-thomas sorry on the delay, I was out of town. It is unrelated to this PR, but not unrelated to my overall issues of getting catkin and gmock to work on Arch in #1030. I forgot that I already commented on this over there.

I'll add a followup comment there instead of muddying the waters here, but this is almost certainly an issue on how to get Arch + gmock package files correct, nothing to do with catkin. Sorry about that.

@sloretz
Copy link
Contributor

sloretz commented Nov 15, 2019

there are a couple extra include paths passed to g++. The ones ending in /include make sense to me, but the ones without it don't. I haven't figured out where they come from yet.

I think this is from the CMakeLists.txt shipped with googletest, so it can be ignored.

# Where Google Test's .h files can be found.
set(gtest_build_include_dirs
  "${gtest_SOURCE_DIR}/include"
  "${gtest_SOURCE_DIR}")
include_directories(${gtest_build_include_dirs})

Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this works, but it works on Debian Buster. LGTM, though I haven't tried it on all platforms.

@dirk-thomas
Copy link
Member

I don't understand why this works,

🤐

but it works on Debian Buster.

🚢 🤞

@dirk-thomas dirk-thomas merged commit 86afdf7 into ros:kinetic-devel Nov 16, 2019
@dirk-thomas
Copy link
Member

Thanks to everyone for creating / testing the patch.


# Path to gtest from the googletest Debian package.
list(APPEND _gtest_include_paths "${googletest_path}/googletest/include/gtest")
list(APPEND _gtest_source_paths "${googletest_path}/googletest/googletest/src")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double "googletest" seems to be a mistake. The include and src directories should be siblings. See #1088.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gmock issue building realtime_tools on arch linux
4 participants