robotology / yarp

YARP - Yet Another Robot Platform
http://www.yarp.it
Other
527 stars 195 forks source link

Failure in finding manager YARP component #1989

Open traversaro opened 5 years ago

traversaro commented 5 years ago

Describe the bug A project that contains:

find_package(YARP 3.0 COMPONENTS manager REQUIRED)

fails to configure with the latest YARP master branch, with the following error:

CMake Error at /home/straversaro/src/robotology-superbuild/build-clean/install/lib/cmake/YARP/YARPConfig.cmake:183 (find_package):
  Found package configuration file:

    /home/straversaro/src/robotology-superbuild/build-clean/install/lib/cmake/YARP_manager/YARP_managerConfig.cmake

  but it set YARP_manager_FOUND to FALSE so package "YARP_manager" is
  considered to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  YARP::YARP_sig YARP::YARP_math

Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/straversaro/src/robotology-superbuild/build-clean/robotology/icub-tests/CMakeFiles/CMakeOutput.log".

To Reproduce For an example project, try to configure the current icub-tests master branch against YARP master branch.

Expected behavior The configuration should work correctly.

Configuration (please complete the following information):

Additional context Related robotology-superbuild issue: https://github.com/robotology/robotology-superbuild/issues/192 .

traversaro commented 5 years ago

A possible workaround is to manually search the required component dependency before the component actually required:

find_package(YARP 3.0 COMPONENTS math manager REQUIRED)
traversaro commented 5 years ago

It is possible that the PRIVATE_DEPENDENCIES argument logic in https://github.com/robotology/yarp/blob/master/src/libYARP_manager/CMakeLists.txt#L129 is broken?

traversaro commented 5 years ago

I did not check, but I guess the issue could be due to the fact that I use YCM 0.10 .

drdanz commented 5 years ago

If the project is icub-tests, it is fixed in the robottestingframework-2 branch. The manager component is not used. The manager component is built and installed only if the yarpmanager or yarpmanager-console are built, are you sure they are compiled in the superbuild?

traversaro commented 5 years ago

Yes, they are compiled. Adding the math component works fine, so the manager seems to be installed.

diegoferigo commented 5 years ago

I encountered the same error, maybe this (pretty long) log might help. Just reach the end where it fails.

Here the related CMake configuration.

traversaro commented 5 years ago

@diegoferigo sorry, I forgot to forward merge https://github.com/robotology/icub-tests/pull/46 to devel.

traversaro commented 5 years ago

Should have been fixed (in icub-tests) by https://github.com/robotology/icub-tests/commit/b05df9753ccd1963c83cb0066cb8064e8f5ad673 .

diegoferigo commented 5 years ago

Yes, it seems fixed, great! Thank you

Nicogene commented 5 years ago

Should have been fixed (in icub-tests) by robotology/icub-tests@b05df97 .

Shall we close this issue?

drdanz commented 5 years ago

I think we should still test and eventually fix this

traversaro commented 3 years ago

I tested now with YARP 3.4.3 and the issue is still there, if I configure:

cmake_minimum_required(VERSION 3.12)
project (hello)
find_package(YARP 3.0 COMPONENTS manager REQUIRED)

It fails with:

(yarp1989) traversaro@IITICUBLAP102:~/yarp1989_test/build$ cmake .
CMake Error at /home/traversaro/miniforge3/envs/yarp1989/lib/cmake/YARP/YARPConfig.cmake:162 (find_package):
  Found package configuration file:

    /home/traversaro/miniforge3/envs/yarp1989/lib/cmake/YARP_manager/YARP_managerConfig.cmake

  but it set YARP_manager_FOUND to FALSE so package "YARP_manager" is
  considered to be NOT FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing:
  YARP::YARP_sig YARP::YARP_math

Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/traversaro/yarp1989_test/build/CMakeFiles/CMakeOutput.log".

the workaround is simply to list the transitive dependencies, i.e. this works fine:

cmake_minimum_required(VERSION 3.12)
project (hello)
find_package(YARP 3.0 COMPONENTS math sig manager REQUIRED)

@Nicogene not sure why you assigned this to me back in time (probably you assumed that it was fixed), but I think I can remove myself from the assignee list.

traversaro commented 2 years ago

This issue has the same origin of https://github.com/robotology/yarp/issues/2861#issuecomment-1165438123 . In a nutshell, the problem is that libYARP_manager is hardcoded to be a static library.