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

Source: Internet
Author: User

**************************************** *******************************
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:
Usb_modeswitch
Realize wireless network interface card from USB storage mode to Modem mode, see: http://www.draisberghof.de/usb_modeswitch
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: http://www.libusb.org/
Usbutils
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. Run the./configure -- Host = arm-Linux -- prefix = <your install dir> command on the terminal.
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:
<Your install dir> 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.
...
**************************************** * *************** Because other tools need to be compiled in the next step, they all require the support of the libusb library, so you need to put the library generated by libusb under 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 = <your install dir>
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 pkgconfig file generated by libusb is not stored. copy the PC file (also modify the prefix path parameters), see: http://www.linuxidc.com/Linux/2011-03/33432.htm
If the problem persists after replication, add pkg_config_path.
* ************************* 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
...
**************************************** * **************** After configuration,. Enter make or make intall. the following error message is displayed: * ************************* list 4 ************ **************
...
Make all-recursive
Make [1]: Entering directory '/home/decuhi/project/New/libusb-compat-0.1.3'

Making all in libusb
Make [2]: Entering directory '/home/decuhi/project/New/libusb-compat-0.1.3/libusb'
/Bin/sh
../Libtool -- tag = Cc -- mode = compile arm-Linux-gcc-dhave_config_h-I.
-I ..-fvisibility = hidden-STD = gnu99-wall-wundef-wunused
-Wstrict-prototypes-werror-implicit-function-Declaration
-Wno-pointer-sign-wshadow
-I/opt/crosstool/ARM-Linux/gcc-3.4.4-glibc-2.3.5/ARM-Linux // include/libusb-1.0
-G-O2-MT: libusb_la-core.lo-MD-MP-MF. deps/libusb_la-core.Tpo-c-o
Libusb_la-core.lo 'test-F' core. c' | echo './''core. c
Libtool:
Compile: Arm-Linux-gcc-dhave_config_h-I.-I...-fvisibility = hidden
-STD = gnu99-wall-wundef-wunused-wstrict-prototypes
-Werror-implicit-function-declaration-wno-pointer-sign-wshadow
-I/opt/crosstool/ARM-Linux/gcc-3.4.4-glibc-2.3.5/ARM-Linux // include/libusb-1.0
-G-O2-MT libusb_la-core.lo-MD-MP-MF. deps/libusb_la-core.Tpo-C
Core. C-FPIC-dpic-o. libs/libusb_la-core.o
C0: Error: Unrecognized command line option "-wno-pointer-sign"
C0: Error: Unrecognized command line option "-fvisibility = hidden"
Make [2]: *** [libusb_la-core.lo] Error 1
Make [2]: Leaving directory '/home/decuhi/project/New/libusb-compat-0.1.3/libusb'
Make [1]: *** [All-recursive] Error 1
Make [1]: Leaving directory '/home/decuhi/project/New/libusb-compat-0.1.3'
Make: *** [all] Error 2
...
**************************************** * **************** I remember that I was so confident in Google, I didn't find the answer for half a day, but Baidu only found it later. It was speechless.
This is because the compiler version is too low. In the later version, "-wno-pointer-sign" and "-fvisibility = hidden" are supported ".
After
To use the PC Compiler (GCC version 4.4.1, while arm-Linux-GCC is 3.4.4 ).
Question. Since the earlier version does not have this command, I will delete the "-wno-pointer-in the libusb-compat-0.1.3/libusb/makefile-
Sign "and"-fvisibility = hidden ", and then OK (if other makefiles also exist, delete them ). After compilation, copy the library and header files to the tool chain.
Area. After this part is solved, it will be easy later. /** Usb_modeswitch */When cross-compiling usb_modeswitch, You need to modify makefile to set the values of rows 3rd and 4 3 strip = strip
4 cc = gcc Change3 strip = arm-Linux-strip
4 cc = arm-Linux-gcc Make will generate the usb_modeswitch binary file in the current directory. ============ For usbutils, there was a hateful record that I had to record: At that time, the installation path was not set during cross-compilation and was accidentally installed on the system. At that time, I wanted to completely delete the tool and then install it. Because the system comes with the usbutils tool, enter sudo apt-Get remove usbutils on the terminal, and a lot of information will pop up.

Reading the package list... complete

Analyzing the dependency tree of the software package

Reading status information... complete

The following software packages will be [uninstalled ]:

Checkbox-GTK gnome-mount gnome-power-manager Hal-cups-utils lshw network-Manager Network-Manager-gnome Ubuntu-Desktop
Ubuntu-Standard update-notifier usbutils Xorg xserver-Xorg
Xserver-Xorg-core xserver-Xorg-input-All xserver-Xorg-input-evdev
Xserver-Xorg-input-KBD xserver-Xorg-input-Mouse
Xserver-Xorg-input-synaptics xserver-Xorg-input-vmmouse
Xserver-Xorg-input-wacom xserver-Xorg-video-All xserver-Xorg-video-APM
Xserver-Xorg-video-ark xserver-Xorg-video-ATI xserver-Xorg-video-Chips
Xserver-Xorg-video-cirrus xserver-Xorg-video-fbdev
Xserver-Xorg-video-geode xserver-xorg-video-i128 xserver-xorg-video-i740
Xserver-Xorg-video-Intel xserver-xorg-video-mach64
Xserver-Xorg-video-MGA xserver-Xorg-video-neomagic xserver-Xorg-video-NV
Xserver-xorg-video-r128 for xserver-Xorg-video-openchrome
Xserver-Xorg-video-radeon xserver-Xorg-video-rendition
Xserver-xorg-video-s3 xserver-xorg-video-s3virge
Xserver-Xorg-video-savage xserver-Xorg-video-siliconmotion
Xserver-Xorg-video-sis xserver-Xorg-video-sisusb xserver-Xorg-video-tdfx
Xserver-Xorg-video-Trident xserver-Xorg-video-Tseng
Xserver-xorg-video-v4l xserver-Xorg-video-VESA xserver-Xorg-video-Vmware
Xserver-Xorg-video-voodoo

A total of 0 software packages have been upgraded, 0 software packages have been installed, 55 software packages have to be uninstalled, and 0 software have not been upgraded.

After decompression, 38.7 MB of space will be empty.

Do you want to continue? [Y/n]

After all, I am a newbie and don't understand anything. Then I press y. The cup is generated in this way. Not only does it have no graphical interface, but it cannot be connected to the Internet. After that, I had to make it back for half a day.

============== 2010-02-01

only the dynamic library is required for the database to be placed on the board, and the static library does not need to be added. According to the description of usb_modeswitch, it is generated based on libusb 0.1.12 library compilation. In fact, you only need to compile version 0.1.12 of legacy release, and you do not need to install version 1.0 and compat.

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.