christianrauch / apriltag_ros

ROS2 node for AprilTag detection
MIT License
128 stars 85 forks source link

Fix cmake complaining about apriltag::apriltag #6

Closed potaito closed 2 years ago

potaito commented 2 years ago

Can't build on Ubuntu 20.04 because cmake keeps running into an error when trying to compile:

CMake Error at CMakeLists.txt:24 (add_library):
Target "AprilTagNode" links to target "apriltag::apriltag" but the target
was not found.  Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?

@christianrauch not sure why you had the namespace apriltag:: recently, but besides trying to compile on my local Ubuntu 20.04 I also tested compiling on a clean docker container with docker run -it ros:foxy-ros-core and the same error occurs. Removing the namespace fixes the issue and allows the package to be compiled.

Feel free to close the PR if it turns out to be an error on my end.

christianrauch commented 2 years ago

It seems you are trying to fix issue https://github.com/christianrauch/apriltag_ros/issues/2.

Which version of the library and ROS node are you using? You have to use compatible versions. Either use the binary released version of the library and node or the the upstream (source) version.

Edit: Never mind, there is no binary release of the node :-) I recommend to use the upstream version of both. The namespace was added to the library in https://github.com/AprilRobotics/apriltag/commit/35f4ef2825745a08ec4690ce8c15f8dc903c2868 and it was used in the node in https://github.com/christianrauch/apriltag_ros/commit/78696e0da603c3f4c2ded8210ee3487e934bd49d. I think there was no binary release of the apriltag library since this was added. You can ask them for a binary release to get the package with the namespace, or just build from source.

potaito commented 2 years ago

Aha, interesting. I have not seen this issue, thanks!

I simply used rosdep install on ros-foxy-core and ended up with this packaged version of apriltag:

$ dpkg --list | grep april

ros-foxy-apriltag                               3.1.2-2focal.20210422.234707

Thanks for your help. I'll see which build method makes most sense in my case!

potaito commented 2 years ago

Just checked and the binary version of apriltag for ros-galactic is also still on 3.1.2

Package: ros-galactic-apriltag
Version: 3.1.2-4focal.20210507.015544
Architecture: amd64
Maintainer: Max Krogius <mkrogius@umich.edu>
Installed-Size: 4695
Depends: libc6 (>= 2.29), ros-galactic-ros-workspace
Homepage: https://april.eecs.umich.edu/software/apriltag.html
Priority: optional
Section: misc
Filename: pool/main/r/ros-galactic-apriltag/ros-galactic-apriltag_3.1.2-4focal.20210507.015544_amd64.deb
Size: 1250352
SHA256: 6b51a9b2d249fb44b5b5135d0f570aaeb109d8798852004928ed21e71e1cfb8e
SHA1: a65817b9cbaa460d668dbf6a16cdca401ed77f5e
MD5sum: 96a4eafd948d6d1c9b847be6c1c88153
Description: AprilTag detector library

source: http://packages.ros.org/ros2/ubuntu/lists/ros-galactic-focal-amd64_focal_main_amd64_Packages

So it's not a matter of galactic VS foxy, but whether it's compiled from source or not. I don't know what the proper solution for everyone is to be honest.

christianrauch commented 2 years ago

I asked for a new binary release at https://github.com/AprilRobotics/apriltag/issues/166 so these incompatibility issues does not occur again when using the binary packages.

I am going to close this since this now depends on upstream to release a new version to the repos and the proposed change would break the build for upstream source builds and any future binary releases of the library.

potaito commented 2 years ago

Thanks a bunch Christian!

christianrauch commented 2 years ago

So it's not a matter of galactic VS foxy, but whether it's compiled from source or not. I don't know what the proper solution for everyone is to be honest.

Yes, all the released versions are the same. The "proper" solution is to get a new release of the library out so that rosdep will pick up and install a version that is compatible to the upstream source of the node. Until then, you have to build from source.