-
Notifications
You must be signed in to change notification settings - Fork 280
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
Catkin finds system packages instead of Catkin packages of exported dependencies #760
Comments
I do not believe that catkin does anything to the ordering when a catkin package overlays a another system version. I think the issue here is that One thing we could do is check that anything passed to |
What @wjwwood described is the intended CMake behavior (https://cmake.org/cmake/help/v2.8.12/cmake.html#command:find_package):
I don't think that |
I don't disagree with this being the standard behavior of CMake. I think we can agree that this is not intuitive behavior unless you understand both how CMake finds packages, and how Catkin generates config files for packages. I'm not that concerned about the case of deliberately shadowing a system package - if people really want to do this, a note on the Catkin CMakeLists page should be enough to figure out how to do what they want. What concerns me more is that if you do it accidentally, it is very hard to figure out what is going wrong (for example, in the example I've provided, you get a CMake error
when CMake processes the dependant package and that's it), and it's unclear if it's a Catkin issue or a CMake issue. In terms of avoiding this in the future, better documentation is probably a sufficient solution in the short term. In terms of long-term options:
|
Looking into the current implementation it seems that catkin/cmake/catkinConfig.cmake.in Lines 74 to 83 in 3b8a3b9
So it is unclear how the CMake module was found in your example. Regarding the three questions:
|
Is there a good way to get more debugging information so we could track this down? I'm happy to reproduce the issue and try to figure out why
I think the following process is a possible approach:
|
The first thing would be to have a detailed reproducible example. Based on that you can look at the
Since I would consider that a valid use case I don't think it is feasible to warn about it. |
I'll reproduce the issue this week and try to figure out where the issue is actually happening.
Can you clarify when this is actually a valid use case? As far as I can tell based on the current behavior, if you have a Catkin package with the same name as another non-Catkin package, what actually happens depends entirely on whether the other package is found via CMake module or CMake config, which is not necessarily something we should expect every developer know, nor something that should be assumed to be the same across multiple systems in the context of system packages. It seems perfectly reasonable to warn the user that they have created a potentially ambiguous situation. As an example, it's completely possible (albeit unlikely) that on one system a package is found via module, and on another it's found via config - from a developer perspective it normally doesn't matter when calling |
|
To clarify, I'm not suggesting that the check happen during the |
I don't understand. Maybe you can elaborate what you have in mind? |
What I have in mind is that you create a Catkin package Essentially the following process would be added to
|
First of all it is still unclear why the "system package" was found in your case. By only searching for configs and in the order of the Second the |
Without further detailed information I can't act on this. Therefore I will close the ticket for now. Please feel free to comment with more information and the ticket can be reopened. |
So after playing around a bit I found a very simple minimum working example.
I've attached a workspace that demonstrates the problem. catkin_package_name_test_min_working_example.zip If I remove/rename the cmake module for OpenSceneGraph then this workspace is able to build without any issues. Edit: it's worth noting here that OpenSceneGraph is not installed in any form on this system, this is just one library that cmake has a Find<...>.cmake file for already. |
Thanks for providing the example workspace. The original title suggested the problem would be related to catkin/cmake/catkinConfig.cmake.in Lines 73 to 83 in eaba48d
NO_MODULE and therefore doesn't find "system packages".
Based on the example I traced it to this catkin/cmake/templates/pkgConfig.cmake.in Line 165 in eaba48d
|
This change did work for both the minimum working example, as well as my actual project with no problems. |
@dirk-thomas while I think this issue is closed, while reading this I was wondering about your statement:
This use case seems to not be in any of the docs (or I haven't found it). Comparing http://docs.ros.org/hydro/api/catkin/html/howto/format2/catkin_library_dependencies.html#finding-the-library and http://docs.ros.org/hydro/api/catkin/html/howto/format2/system_library_dependencies.html#finding-the-library reads to me like it is suggested to always call Do packages in practice actually use that? Then I think the docs should mention the possibility of using this to get things find-packaged automatically and appended to |
It is not recommended to let |
The find logic has been updated in #782 for Kinetic. Can this be closed? |
Considering that Indigo is a long-term support release, with 14.04+Indigo a standard combination for people with PR2 or Baxter robots, how difficult would it be to (either) port the fix to Indigo and Jade, (or) add additional documentation to help anyone who encounters the problem? As far as I understand, any existing packages for Indigo or Jade that break with this change were already depending on incorrect behavior, so backporting the fix shouldn't cause problems. |
The problem is that you don't know how many (potentially unreleased and non-public) packages use the currently possible behavior. You might be able to audit / fix the publically visible ones but there are many more. And since the current behavior has been present since almost two years I am not inclined to backport it since the regression potential is unforeseeable. Additional document pointing out that potentially problematic behavior is of course always welcome. |
Just adding my two cents: Still, I do agree with @dirk-thomas that backporting the fix would break the "no-surprise" rule of long-term stable releases. |
If a CMake-findable package exists on the system (for example, there is a
FindPACKAGENAME.cmake
in/usr/share/cmake-2.8/Modules
), and a Catkin package with the same name exists,find_package(catkin REQUIRED COMPONENTS PACKAGENAME)
will find the system package, not the Catkin package.An example of when the problem occurs:
Findosg.cmake
forOpenSceneGraph
)osg
osg
viafind_package(catkin REQUIRED COMPONENTS osg)
In this case, the system package
OpenSceneGraph
will be found, rather than your Catkin packageosg
.In contrast, the problem does not appear to occur in the comparable case of local Catkin package that shadows a system Catkin package. In this case, Catkin reorders the packages to ensure that the shadow package is processed before the dependant package. This would be much more reasonable behavior in the case of this bug.
In most cases, having a Catkin package with the same name as a system package should be avoided, but given the long list of system CMake files, some of which (like Findosg.cmake, which is deprecated in favor of FindOpenSceneGraph.cmake, but is still shipped for compatibility) have different names than their respective packages, it is fairly easy to accidentally shadow a system package.
The text was updated successfully, but these errors were encountered: