question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CMake Warning: libusb dependency

See original GitHub issue

Hey Wolfgang,

I’m running into the following issue whenever I try to build the crazyflie_ros workspace for the crazyswarm package:

CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:166 (message): catkin_package() DEPENDS on '/usr/lib/x86_64-linux-gnu/libusb-1.0.so but neither '/usr/lib/x86_64-linux-gnu/libusb-1.0.so_INCLUDE_DIRS' nor /usr/lib/x86_64-linux-gnu/libusb-1.0.so_LIBRARIES' is defined.

Call Stack (most recent call first): /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:102 (_catkin_package) crazyflie_ros/crazyflie_cpp/CMakeLists.txt:19 (catkin_package)

Running the command dpkg -l libusb* gives me:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libusb-0.1-4:a 2:0.1.12-28  amd64        userspace USB programming library
ii  libusb-1.0-0:a 2:1.0.20-1   amd64        userspace USB programming library
ii  libusb-1.0-0-d 2:1.0.20-1   amd64        userspace USB programming library
ii  libusb-1.0-doc 2:1.0.20-1   all          documentation for userspace USB p
un  libusb-dev     <none>       <none>       (no description available)
un  libusbmuxd-too <none>       <none>       (no description available)
ii  libusbmuxd4:am 1.0.10-2ubun amd64        USB multiplexor daemon for iPhone

Running locate libusb | grep .so gives me:

/lib/x86_64-linux-gnu/libusb-0.1.so.4
/lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4
/lib/x86_64-linux-gnu/libusb-1.0.so.0
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/usr/lib/x86_64-linux-gnu/libusbmuxd.so.4
/usr/lib/x86_64-linux-gnu/libusbmuxd.so.4.0.0

I am using a “fresh” installation of ubuntu 16.04 (as an admin) and ROS Kinetic. I’ve been searching online for answers but I am coming up short (I probably don’t know the right questions to ask).

Do you have any ideas?

Thanks, Kyle

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
whoenigcommented, Mar 22, 2019

Your understanding is correct. Actually you only need to change ROS.cmake files (the other ones are used if you want to build crazyflie_tools standalone, i.e. without any ROS [which might be useful for debugging/trouble shooting]).

If it works with WSL, please let us know and we can update the documentation accordingly.

1reaction
kgslovakcommented, Jun 18, 2017

So after doing some digging around, I think I’ve figured out what is going on. The appearance of this warning is due to a change in the catkin_package.cmake files of catkin from version 0.6.19 (included with indigo) to version 0.7.6 (included with kinetic). When parsing through the list of provided dependencies, this script checks a different set of conditions based on which version is being used:

catkin 0.6.19 (line 160): if(NOT ${${depend_name}_FOUND}) catkin 0.7.6 (line 165): if(NOT DEFINED ${depend_name}_INCLUDE_DIRS AND NOT DEFINED ${depend_name}_LIBRARIES)

The “issue” is that the CMakeLists.txt files of the crazyswarm package use find_library(USB_LIB usb-1.0) which only sets the variable USB_LIB to the full path of the desired library. It does not define USB_LIB_FOUND, USB_LIB_INCLUDE_DIRS, or USB_LIB_LIBRARIES. So Catkin 0.6.19 did not throw a warning (which is probably why this condition was changed), however the Kinetic version does.

A search utilizing something like:

find_package(PkgConfig REQUIRED)
pkg_search_module(USB_LIB REQUIRED usb-1.0)

might be more appropriate to “properly” link the library?

As it is, since ${USB_LIB} assess to the full path of the library’s ‘.so’ file and the CMakeLists.txt files use:

target_link_libraries(crazyflie_cpp
  ${USB_LIB}
)

I don’t think this warning is pointing to any issues linking the usb library. BTW, what does the catkin_make -k command do? I have not been able to find any documentation on that option.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[USRP-users] Libusb Problems on Windows - The Mail Archive
I have tried moving the libusb files to different locations, ... In CMake I get the warnings and missing packages included below.
Read more >
How to set up libusb dependency with CMake? - Stack Overflow
To start, I need to be able to use the libusb library. I'm working with Ubuntu 20.04. I have a simple CMakeLists.txt file...
Read more >
Building and Installing UHD and GNU Radio to a Custom Prefix
Abstract. This application note provides step-by-step instructions on building and installing UHD and GNU Radio to a local directory.
Read more >
How to Link a third Party Library (LibUSB) in CMake-C++
A common pitfall is to not delete the CMakeCache.txt file in the build directory. CMake caches the values for LIBUSB_INCLUDE_DIR and LIBUSB_LIBRARY and...
Read more >
Relocation: QMake -> CMake - PVS-Studio
On our way there, we′ll walk along the Cross Compilers Street, sit in the Build System Square, and have a drink at the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found