Cross compile the LIBUSB and examples

Source: Internet
Author: User

[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.