5 Replies Latest reply on Nov 16, 2014 1:17 PM by DimitriM

    How to install libusb-dev


      Hi everyone!


      I have flashed my edison with the lastest yocto image (found here : https://communities.intel.com/docs/DOC-23242)


      I'm trying to use a Pololu board in order to control some servomotors. In this way, I need to use the libusb in my code and so need libusb-dev in order to compile it.


      So my problem is : I can't find a way to install the libusb-dev.

      I tried to compile the sources on the board (autoconf ./configure), it has libudev has depedency. So I tried to download and compile it but it also has depedencies.


      I have read everything I could on the forum, but nobody seems to have any problem with libusb.


      Am I missing something? How could I install this lib?



      Thank you in advance.

        • 1. Re: How to install libusb-dev

          You could follow these instructions: Edison Package Repo Configuration Instructions

          to setup you Edison to work with the unofficial package repo.


          then you should be able to install libusb-dev by running


          opkg install libusb-1.0-dev

          • 2. Re: How to install libusb-dev

            Great! It's working well.


            However I have also found another solution if anybody want it: I have copied all the header files of libusb (from sources) in /usr/lib/libusb-1.0/ and put some -L flags when compiling. Not really clean though..


            Thank you Dan!

            • 3. Re: How to install libusb-dev

              I've completed the process outlined above by intel_dan, but I'm having trouble locating the libusb header files. I'm trying to compile libnfc but it always results in the error: "configure: error: The libusb headers are missing".


              I have the Edison Breakout Board powered through the DC port on J21, and the USB-OTG cable on J16. lsusb reports back:


              root@edison:~# lsusb

              Bus 001 Device 002: ID 072f:2200 Advanced Card Systems, Ltd

              Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

              Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub


              Which I think would indicate that libusb is operating correctly.


              Any idea where the headers are located? Thanks.

              • 4. Re: How to install libusb-dev

                The header (AFAICS there's only one usb.h there) is in /usr/include.


                The easiest way to check that for the installed package is to use the "opkg files libusb" command.

                If you haven't yet installed it, you can use 7-zip to look into the ipk file, which you can get directly from the repo at http://repo.opkg.net/edison/repo

                • 5. Re: How to install libusb-dev

                  just for heads-up. The version of libusb in that repro is rather old: 1.0.9 instead is the current 1.0.19. The hotplug detection with callback functions is not included in 1.0.9. It is implemented starting from 1.0.16.


                  I managed to compile ver. 1.0.19 from tarball on Edison and use linusb-1.0.so in Eclipse for cross-compiling. Really quick and dirty. It should be put into "\iotdk-ide-win\devkit-x86\sysroots\i586-poky-linux\usr\lib"  where libm.so is located  (math lib for sqrt etc) and linked as -lusb-1.0 in the linker preferences. Once compiled on Edison, it can be relocated to /usr/lib or /lib from ..../.lib <== a hidden dir where is lands. Consider relocating everything starting with libusb-1.0* since *.la files are are as important as so-files because they store the list of dynamically liked functions and are used for lookup.  *.SO is a kind of *.DLL while *.LA holds the list of functions. It can happen that it compiles nicely in Eclipse, however, you'll get an error while running the program on Edison when the corresponding la-file does not contain the needed function (older version). It was the case after I used so-files of ver 1.0.19 while la-file were still of 1.0.9 (without hotplug stuff). I could compile, but I could not run it on target.


                  I wish I knew how to compile libusb natively in Eclipse to get *.so. In the same time, I think once compiled on Edison I don't need to bother to transfer them to Edison.