udev库是Qt 5.9.5 所需的基础库,用于热插拨处理,这里是给详细方法,我需要RK3288 的arm32 CPU的版本,
编译器下载
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
这里下载是 arm-linux-gnueabihf-gcc /arm-linux-gnueabihf-g++ 两套编译器
安装成功后,应该在/usr/bin 找得到两个编译工具
这个库在好几个QT 库所需,所以我们编译这个库方便编译。 否则编译Qt库时没有这个库提示
/usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: 找不到 -ludev
下载源码 ,kernel.org的官网已经挂了,因为这个库很老了,停止维护,转向evdev了,所以能下载源在此在
https://launchpad.net/udev/+download?
我编译成功的是
https://launchpad.net/udev/main/172/+download/udev-172.tar.bz2?
编译方法
编译指令
tar xvf udev-172.tar.bz2?
cd udev-172
#生成Makefile
./configure --prefix=$PWD/../output --host=arm-linux-gnueabihf --disable-udev_acl --disable-introspection --disable-keymap --disable-gudev --with-pci-ids-path=/usr/share/misc/pci.ids?
make
make install
注意 configure --prefix 表示编译安装目录,在源码目录上一级output下
安装成功后从上一级output目录下拷贝相应库和头文件到系统目录中
sudo cp -rf ../output/include /usr/arm-linux-gnueabihf/include/
sudo cp -rf ../output/lib/* /usr/arm-linux-gnueabihf/lib/
注意是拷入在arm-linux-gnueabih目录下,不会破坏主机上x64的库
生成和编译错误处理
.1 找不到gpref
configure: error: gperf is needed?
解决办法:安装即可
sudo apt install gperf?
2.找不到pci.ids 定义
configure: error: pci.ids not found, try --with-pci-ids-path=?
解决办法,使用x86的pci.ids
--with-pci-ids-path=/usr/share/misc/pci.ids?
3.生成keymap 文件失败
GEN extras/keymap/keys.txt
GEN extras/keymap/keys-from-name.gperf
GEN extras/keymap/keys-from-name.h
(standard input): No keywords in input file!
Makefile:3070: recipe for target 'extras/keymap/keys-from-name.h' failed?
解决办法 取消对keymap支持,在configure 加入参数
--disable-keymap?
4.找不到 unit32_t定义
error: unknown type name ‘uint32_t’ uint32_t reserved;
解决办法
:extras/mtd_probe/mtd_probe.h 前面
#include