**注意:
如果检测不带相机,检查libusb-1.0.0,ubuntu安装
apt-get install libusb-1.0-0-dev
apt-get install libusb-dev
检查configure打印的内容usb部分**
checking for libusb to use... autodetect
checking for LIBUSB... yes
checking usb.h usability... yes
checking usb.h presence... yes
checking for usb.h... yes
checking for function usb_open in libusb... yes
checking libusb library flags... "-lusb"
checking libusb cpp flags... ""
when doing the ./configure --prefix=/usr/local
需要的库
libusb:https://libusb.info/
libtool:https://github.com/topics/libtool
libgphoto2:http://gphoto.org/
libxml2:移植方式https://blog.csdn.net/qq_32605451/article/details/122667971
编译链为MP157: arm-buildroot-linux-gnueabihf
移植xml2,libiconv ,zlib
https://blog.csdn.net/qq_32605451/article/details/122667971
移植libexif:
autoreconf -i
./configure --prefix=/ --host=arm-buildroot-linux-gnueabihf --with-pic
make
make install DESTDIR=/home/han/arm_mp157_libgphoto2
DESTDIR与设置–prefix结果一样,设置安装目录
以上文件打包地址:https://download.csdn.net/download/qq_32605451/76282643
一、编译 libusb
./configure --prefix=/ --host=arm-buildroot-linux-gnueabihf --with-pic --disable-udev
make
make install DESTDIR=/home/han/arm_mp157_libgphoto2
因为libusb无法生成需要的usb.h文件,所以还需要额外编译0.1 compat兼容支持包,它会产生usb.h!!
下载地址:https://sourceforge.net/projects/libusb/files/libusb-compat-0.1/
本文使用的为libusb-compat-0.1.8
编译安装
./configure --prefix=/home/han/arm_mp157_libgphoto2 --host=arm-buildroot-linux-gnueabihf LIBUSB_1_0_CFLAGS=-I/home/han/arm_mp157_libgphoto2/include/libusb-1.0 PKG_CONFIG_PATH=/home/han/arm_mp157_libgphoto2/lib/pkgconfig
make
make install
如果编译报错没有libusb.h文件,将libusb生成的此文件拷贝到libusb-compat-0.1.8/libusb文件夹下,重新编译即可
PKG_CONFIG_PATH为libusb安装目录下的lib/pkgconfig
安装完成后即可生成需要的usb.h
二、编译libtool
./configure --prefix=/ --host=arm-buildroot-linux-gnueabihf --with-pic
make
make install DESTDIR=/home/han/arm_mp157_libgphoto2
三、编译libgphoto
./configure \
--prefix=/home/han/arm_mp157_libgphoto2 \
--host=arm-buildroot-linux-gnueabihf \
LDFLAGS='-ldl' \
LIBLTDL=/home/han/arm_mp157_libgphoto2/lib/libltdl.a \
LTDLINCL=-I/home/han/arm_mp157_libgphoto2/include/ \
LIBUSB_LIBS=/home/han/arm_mp157_libgphoto2/lib/libusb1.0.a \
LIBUSB_CFLAGS=-I/home/han/arm_mp157_libgphoto2/include \
LIBEXIF_CFLAGS=-I/home/han/arm_mp157_libgphoto2/include \
LIBEXIF_LIBS=/home/han/arm_mp157_libgphoto2/lib/libexif.a \
LIBXML2_CFLAGS=-I/home/han/arm_mp157_libgphoto2/include/ \
LIBXML2_LIBS=/home/han/arm_mp157_libgphoto2/lib/libxml2.a
make
make install