[Author:bo Shen <[email Protected]>]
Assume you has the cross toolchain installed on your Linux host, where I use Ubuntu 12.04 with ARM-LINUX-GNUEABIHF-GCC ins Talled. (If not, here is the command)
--->8---
For the SoC support hard float point
$ sudo apt-get install GCC-ARM-LINUX-GNUEABIHF
For the SoC only support soft float point
$ sudo apt-get install GCC-ARM-LINUX-GNUEABIHF
---8<---
Then set the environment
--->8---
$ Export Arch=arm
$ Export cross_compile=arm-linux-gnueabi-
---8<---
The following steps is real to build the LIBUSB.
1. Get The source code
$ git clone git://git.libusb.org/libusb.git
2. Configure the source
2.1 Edit The autogen.sh file, remove following lines
--->8---
./configure--enable-maintainer-mode--enable-debug-log \
--enable-examples-build "[Email protected]"
---8<---
2.2 Then run the autogen.sh script
$./autogen.sh
2.3 Configure The Libusb
$./configure--host=arm-linux-gnueabihf---prefix=/tmp/_install--enable-examples-build
Note:the--enable-examples-build is used to generate the Makefile.
2.4 Make
$ make
3. Build the examples
$ CD Examples
$ arm-linux-gnueabihf-gcc-i/tmp/_install/include/libusb-1.0-l/tmp/_install/lib/-lusb-1.0-o Listdevs LISTDEVS.C
If you meet the error: ' Can not find the Libusb.h ', please edit the LISTDEVS.C and change the following lines:
From #include <libusb.h> to #include "libusb.h"
Cross compile the LIBUSB and examples