-------------------------------------------------------------------------------------------
#更新历史:
#1. 使用libusb 源码安装libusb.
#2. 使用apt-get install libusb* 安装libusb。
--------------------------------------------------------------------------------------------
今天突然发现原来之前写的博文是用源码安装libusb的方法。
一般,软件包比较大的话可以下载源代码进行安装,这样比较方便。
在这个问题上,其实可以直接使用apt-get install libusb* 来安装usb相关的库文件。
最初以为apt-get install 只能安装软件,后来自己的ubuntu提示更新软件,看了以下可以更新的列表发现也有lib库。
在ubuntu软件中心搜索libusb 也能搜到相关的库,而且apt-get install 支持 * 通配符。之前直接apt-get install libusb 失败了就误以为没法更新库文件了。
现在发现linux 命令行工具以及通配符太好用了。 ls *usb* 也可以。
apt-get install 百度百科:
http://baike.baidu.com/view/1580236.htm
-------------------------------------------------------------------------------------------------------------------------------------------------
最近遇到新装的ubuntu 没有libusb,而编译android 源码的时候需要gcc选项中有lusb,也就是需要链接libusb.a。
在网上只找到了libusb的源码。
http://www.libusb.org/
下载源码libusb-1.0.9.tar.bz2(2012-04-20),在源码中INSTALL 文件,有详细的介绍如何把这些源码编译并安装到ubuntu系统中。
建议使用老版本,libusb-0.1.12.tar.gz http://sourceforge.net/projects/libusb/files/libusb-0.1%20%28LEGACY%29/ 可以生成usb.h,新版本貌似改名为libusb.h了。
1. ./configure
2. make
3. make install(需要root 权限)
configure的详细介绍:
administrator@ubuntu:~/下载/libusb-1.0.9$ ./configure --help
`configure' configures libusb 1.0.9 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking ...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR info documentation [DATAROOTDIR/info]
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/libusb]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
--psdir=DIR ps documentation [DOCDIR]
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM run sed PROGRAM on installed program names
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
--enable-silent-rules less verbose build output (undo: `make V=1')
--disable-silent-rules verbose build output (undo: `make V=0')
--disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-timerfd use timerfd for timing (default auto)
--disable-log disable all logging
--enable-debug-log enable debug logging (default n)
--enable-examples-build build example applications (default n)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L
nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I
you have headers in a nonstandard directory
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to
libusb home page:
administrator@ubuntu:~/下载/libusb-1.0.9$