Cross-compile libusb, libusb-compat, usbutils, and usb_mode on Ubuntu

Source: Internet
Author: User
**************************************** * ****************************** Cross-compile libusb on Ubuntu, libusb-compat, usbutils and usb_modeswitch ************************************* ****************************

**************************************** *******************************
Cross-compile libusb, libusb-compat, usbutils, and usb_modeswitch on Ubuntu ***
**************************************** *******************************

Compiling environment: Ubuntu 9.04, arm-linux-gcc-3.4.4.
Compile object: libusb-1.0.2, libusb-compat-0.1.3, usbutils-0.11 and usb_modeswitch-1.0.5
Tool description:
Realize wireless network interface card from USB Storage mode to Modem mode, see:
Libusb, libusb-compat
Usb_modeswitch requires libusb support.
Libusb is divided into version 1.0 and version 0.1. Version 1.0 is not backward compatible with version 0.1 and requires support from libusb-compat. Therefore, you can install both version 1.0 and version 0.1, but it cannot be the same as the fashion version 0.1 and libusb-compat. See:
Tool for viewing usb device information in Linux/** the libusb and libusb-compat parts are mainly recorded below. After all, after some time, some problems encountered at that time cannot be remembered */
Before Cross-compilation, configure. Enter the configuration command on the terminal:./configure -- host = arm-linux -- prefix =
After the configuration is complete, enter make install and press enter to display a bunch of information. The last part of the information is: * ********************* List 1 *************** **************
Libraries have been installed in:
If you ever happen to want to link against installed libraries
In a given directory, LIBDIR, you must either use libtool, and
Specify the full pathname of the library, or use the '-llibdir'
Flag during linking and do at least one of the following:
-Add LIBDIR to the 'LD _ LIBRARY_PATH 'environment variable
During execution
-Add LIBDIR to the 'LD _ RUN_PATH 'environment variable
During linking
-Use the '-Wl,-rpath-Wl, libdir' linker flag
-Have your system administrator add LIBDIR to '/etc/ld. so. conf' See any operating system documentation about shared libraries
More information, such as the ld (1) and ld. so (8) manual pages.
**************************************** ****************
This is because other tools need to be cross-compiled. They all need support from the libusb library, therefore, you need to put the library generated by libusb to the folder corresponding to the tool chain (/opt/crosstool/arm-linux/gcc-3.4.4-glibc-2.3.5/arm-linux lib and include ). If you only copy the header file and Library to the corresponding directory and continue compiling libusb-compat, a problem will occur.
When you enter the configuration command./configure -- host = arm-linux -- prefix =
A prompt is displayed, indicating that the LIBUSB package is not found. (This problem is actually prompted in Listing 1)
* *********************** List 2 ************* *************
Checking for libusb_defaults 0... configure: error: Package requirements (libusb-1.0> = 0.9.1) were not met: No package 'libusb-1.0 'foundConsider adjusting the PKG_CONFIG_PATH environment variable if you
Installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBUSB_1_0_CFLAGS
And libusb_00000_libs to avoid the need to call pkg-config.
See the pkg-config man page for more details.
**************************************** *****************
This occurs because the. pc file under pkgconfig generated by libusb is not copied over (you also need to modify the prefix path parameters inside), see:
If the problem persists after replication, add PKG_CONFIG_PATH.
The printed information on the terminal is
* ************************* List 3 ************ **************
Checking for libusb_defaults 0... yes
Configure: creating./config. status
Config. status: creating libusb. pc
Config. status: creating libusb-config
Config. status: creating Makefile
Config. status: creating libusb/Makefile
Config. status: creating examples/Makefile
Config. status: creating config. h
Config. status: executing depfiles commands
Config. status: executing libtool commands
Config. status: executing default commands
**************************************** *****************
Related Article

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: 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.