GCC 找不到软件包 libusb-dev

GCC 找不到软件包 libusb-dev

尝试编译 pymini,埃克勒软件在 RPI3、Ubuntu Mate 16.04 上,我收到以下 ./configure 输出,但出现错误:configure:错误:找不到 libusb-devel 1.0 支持

tim@tim-desktop:~/pymini-1.16$ ./configure

    checking build system type... armv7l-unknown-linux-gnueabi
    checking host system type... armv7l-unknown-linux-gnueabi
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking for g++... g++
    checking whether we are using the GNU C++ compiler... yes
    checking whether g++ accepts -g... yes
    checking for a BSD-compatible install... /usr/bin/install -c
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking minix/config.h usability... no
    checking minix/config.h presence... no
    checking for minix/config.h... no
    checking whether it is safe to define __EXTENSIONS__... yes
    checking "for canonical host"... "Linux/Unix"
    checking for mini build... yes
    checking for pow in -lm... yes
    checking pthread.h usability... yes
    checking pthread.h presence... yes
    checking for pthread.h... yes
    checking libusb.h usability... no
    checking libusb.h presence... no
    checking for libusb.h... no
    configure: error: cannot find libusb-devel 1.0

我安装了 libusb-dev 并再次运行配置,配置再次失败并出现相同的错误 我安装了 libusb-1.0-0-dev 并再次运行配置,配置再次失败并出现相同的错误 然后我进行了一些谷歌搜索,并尝试使用以下命令对 libusb 的安装进行一些调查

sudo dpkg -L libusb-1.0-0-dev

     /.
     /usr
     /usr/lib
     /usr/lib/arm-linux-gnueabihf
     /usr/lib/arm-linux-gnueabihf/pkgconfig
     /usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc
     /usr/lib/arm-linux-gnueabihf/libusb-1.0.a
     /usr/include
     /usr/include/libusb-1.0
     /usr/include/libusb-1.0/libusb.h
     /usr/share
     /usr/share/doc
     /usr/share/doc/libusb-1.0-0-dev
     /usr/share/doc/libusb-1.0-0-dev/copyright
     /usr/lib/arm-linux-gnueabihf/libusb-1.0.so
     /usr/share/doc/libusb-1.0-0-dev/README
     /usr/share/doc/libusb-1.0-0-dev/changelog.Debian.gz

并且:

sudo dpkg -L libusb-dev

    /.
    /usr
    /usr/include
    /usr/include/usb.h
    /usr/bin
    /usr/bin/libusb-config
    /usr/share
    /usr/share/doc-base
    /usr/share/doc-base/libusb-dev
    /usr/share/man
    /usr/share/man/man1
    /usr/share/man/man1/libusb-config.1.gz
    /usr/share/doc
    /usr/share/doc/libusb-dev
    /usr/share/doc/libusb-dev/copyright
    /usr/share/doc/libusb-dev/html
    /usr/share/doc/libusb-dev/html/api-return-values.html
    /usr/share/doc/libusb-dev/html/ref.core.html
    /usr/share/doc/libusb-dev/html/api-synchronous.html
    /usr/share/doc/libusb-dev/html/intro-overview.html
    /usr/share/doc/libusb-dev/html/api-timeouts.html
    /usr/share/doc/libusb-dev/html/preface.html
    /usr/share/doc/libusb-dev/html/function.usbsetaltinterface.html
    /usr/share/doc/libusb-dev/html/ref.deviceops.html
    /usr/share/doc/libusb-dev/html/function.usbcontrolmsg.html
    /usr/share/doc/libusb-dev/html/api.html
    /usr/share/doc/libusb-dev/html/ref.control.html
    /usr/share/doc/libusb-dev/html/function.usbbulkwrite.html
    /usr/share/doc/libusb-dev/html/api-device-interfaces.html
    /usr/share/doc/libusb-dev/html/intro.html
    /usr/share/doc/libusb-dev/html/ref.bulk.html
    /usr/share/doc/libusb-dev/html/ref.interrupt.html
    /usr/share/doc/libusb-dev/html/examples.html
    /usr/share/doc/libusb-dev/html/function.usbclaiminterface.html
    /usr/share/doc/libusb-dev/html/function.usbclose.html
    /usr/share/doc/libusb-dev/html/examples-other.html
    /usr/share/doc/libusb-dev/html/function.usbresetep.html
    /usr/share/doc/libusb-dev/html/api-types.html
    /usr/share/doc/libusb-dev/html/function.usbfinddevices.html
    /usr/share/doc/libusb-dev/html/function.usbdetachkerneldrivernp.html
    /usr/share/doc/libusb-dev/html/function.usbgetdescriptor.html       
    /usr/share/doc/libusb-dev/html/intro-support.html
    /usr/share/doc/libusb-dev/htm/function.usbgetdescriptorbyendpoint.html
    /usr/share/doc/libusb-dev/html/function.usbclearhalt.html
    /usr/share/doc/libusb-dev/html/function.usbgetdrivernp.html
    /usr/share/doc/libusb-dev/html/index.html
    /usr/share/doc/libusb-dev/html/function.usbopen.html
    /usr/share/doc/libusb-dev/html/function.usbinterruptread.html
    /usr/share/doc/libusb-dev/html/ref.nonportable.html
    /usr/share/doc/libusb-dev/html/functions.html
    /usr/share/doc/libusb-dev/html/function.usbfindbusses.html
    /usr/share/doc/libusb-dev/html/function.usbinterruptwrite.html
    /usr/share/doc/libusb-dev/html/examples-tests.html
    /usr/share/doc/libusb-dev/html/function.usbgetstring.html
    /usr/share/doc/libusb-dev/html/function.usbbulkread.html
    /usr/share/doc/libusb-dev/html/function.usbgetstringsimple.html
    /usr/share/doc/libusb-dev/html/examples-code.html
    /usr/share/doc/libusb-dev/html/function.usbreleaseinterface.html
    /usr/share/doc/libusb-dev/html/function.usbgetbusses.html
    /usr/share/doc/libusb-dev/html/function.usbsetconfiguration.html
    /usr/share/doc/libusb-dev/html/function.usbreset.html
    /usr/share/doc/libusb-dev/html/function.usbinit.html
    /usr/lib
    /usr/lib/arm-linux-gnueabihf
    /usr/lib/arm-linux-gnueabihf/pkgconfig
    /usr/lib/arm-linux-gnueabihf/pkgconfig/libusb.pc
    /usr/lib/arm-linux-gnueabihf/libusb.so
    /usr/lib/arm-linux-gnueabihf/libusb.a
    /usr/share/doc/libusb-dev/changelog.Debian.gz

然后我尝试:

pkg-config --cflags --libs /usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc

然后重新运行配置,但出现同样的错误,因此我也尝试了:

pkg-config --cflags --libs /usr/lib/arm-linux-gnueabihf/pkgconfig/libusb.pc

然后重新运行配置,但失败了,出现同样的错误,我还运行了:

`pkg-config --modversion libusb-1.0
    1.0.20
 pkg-config --modversion libusb
    0.1.12 

然后我卸载了 libusb-dev,只安装了 libusb-1.0-0-dev。然后尝试再次运行 configure,出现同样的错误。

    configure: error: cannot find libusb-devel 1.0

然后我尝试添加到~.bashrc

PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/arm-linux-gnueabihf/pkgconfig/libusb-1.0.pc

这是怎么回事,想不通,希望能得到一些帮助

tjmarch

答案1

尝试: pkg-config --modversion libusb-dev

我不认为 pkg-config-path 是一个命令。有一个 PKG_CONFIG_PATH 环境变量。

答案2

由于某些奇怪的原因,这个“pymini”包没有尝试正确发现 libusb 本身的路径或其他标志。您需要为此给它一些额外的标志,您可以在 configure.ac 的注释中看到引用

# Notes on compiling on Ubuntu.
#
#     ./configure --prefix=/usr CFLAGS="-g -Wall -I/usr/include/libusb-1.0" CXXFLAGS="-g -Wall -I/usr/include/libusb-1.0" (Ubuntu 12.04)
#
#     make
#     make install

你走在正确的轨道上。libusb-1.0-0-dev 是你需要的包(而不是 libusb-dev,它们是不同的),此时上面 configure.ac 中的命令应该可以按原样工作。

您尝试使用 pkg-config 的“更好”版本将是这样的。

pkg-config libusb-1.0 --cflags
./configure --prefix=/usr CFLAGS="$(pkg-config libusb-1.0 --cflags)" CXXFLAGS="$(pkg-config libusb-1.0 --cflags)" 

通常您还会设置 LIBS=$(pkg-config libusb-1.0 --libs),但是这已经硬编码到该项目中,因此在这种特定情况下不需要它。

相关内容