Ask Your Question

Cannot find -lusb when building ni package!

asked 2011-03-06 14:39:03 -0500

nhanndt gravatar image

updated 2011-03-06 14:41:57 -0500

Eric Perko gravatar image

Hi everyone, When i run "rosmake ni". the following error appears: Linking CXX executable ../bin/openni_example /usr/bin/ld: cannot find -lusb collect2: ld returned 1 exit status Please help me fix it. Thanks a lot!

edit retag flag offensive close merge delete


What OS are you on? Which version of ROS (Cturtle/Diamondback/Unstable)?
Eric Perko gravatar image Eric Perko  ( 2011-03-06 14:43:47 -0500 )edit
What is the output of `rosdep satisfy ni`?
Eric Perko gravatar image Eric Perko  ( 2011-03-06 17:30:33 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted

answered 2011-03-07 09:53:13 -0500

blueskin gravatar image

okay, here's a solution, after trying the above mentioned approaches I still had the same problem but I finally figured it out.

Open System->Administration->Synaptic manager, search libusb and then select libusb-1.0-0-dev, libusb++-0.1-4c2 for installation.

and rerun rosmake ni --rosdep-install. It works perfectly if it doesn't work then for reference I have the following lib-usb* packages installed libhpmud0,libusb-0.1-4,libusb-1.0-0,libusb-dev,libusb-1.0-0-dev, libusb++-0.1-4c2,libusbsr,libftdi1,libusbmuxd1.

Make sure you have these and if you still have a problem then let me know

Best, CV

edit flag offensive delete link more


Thanks bro! I fixed it by running this command: " sudo apt-get install libusb -1.0-0-dev libusb-dev".
nhanndt gravatar image nhanndt  ( 2011-03-07 13:43:34 -0500 )edit
cool... if you want you can accept this answer by checking the tick mark.
blueskin gravatar image blueskin  ( 2011-03-07 14:19:15 -0500 )edit

answered 2011-03-06 14:42:59 -0500

Eric Perko gravatar image

It appears libusb is not installed. Try running rosmake --rosdep-install ni and allow it to install any required dependencies.

edit flag offensive delete link more

answered 2011-03-07 17:10:20 -0500

Daniel Stonier gravatar image

Actually, I wouldn't say this is fixed. It does raise some issues as there's a bit more to this than it seems at first glance. Two packages are involved on lucid:

  • libusb-dev (this is pointer to libusb-0.1)
  • libusb-1.0.0-dev

From nhanndt's experience, it turns out ni won't compile if libusb-dev is not installed, which may quite often be the case on a fresh install.

Which begs the question - does ni need libusb-dev as an rosdep? Is ni even linking with libusb-1.0? Does it need libusb-1.0?

Looking at the CMakeLists.txt in openni_camera - it's pulling in libusb-0.1 into the example binaries. You can take out the usb reference there and still compile as libusb-1.0 is getting pulled in libraries in the openni package.

So probably the usb linking in target_link_libraries in openni_camera/CMakeLists.txt can be dropped and it will resolve the problem for future users. Can this be confirmed (should probably ticket this)?

edit flag offensive delete link more


actually this is true, we tried this last nite on my colleague's desktop and he had the same issue, he had to do an apt-get upgrade and then install libusb-dev which worked fine after that.
blueskin gravatar image blueskin  ( 2011-03-08 00:48:28 -0500 )edit

answered 2011-03-07 00:00:49 -0500

Farhad gravatar image

I am on ubuntu 10.10 and having the same issue.

. . .

make[3]: Entering directory /home/farhad/ni/ni/openni_camera/build' Linking CXX executable ../bin/openni_example /usr/bin/ld: cannot find -lusb collect2: ld returned 1 exit status make[3]: *** [../bin/openni_example] Error 1 make[3]: Leaving directory/home/farhad/ni/ni/openni_camera/build' make[2]: * [CMakeFiles/openni_example.dir/all] Error 2 make[2]: Leaving directory /home/farhad/ni/ni/openni_camera/build' make[1]: *** [all] Error 2 make[1]: Leaving directory/home/farhad/ni/ni/openni_camera/build' make: * [all] Error 2

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-03-06 14:39:03 -0500

Seen: 3,734 times

Last updated: Mar 07 '11