V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?
1.git clone -b spi-rebase https://github.com/Icenowy/sunxi-tools.git
2.sudo apt-get install libusb-1.0-0-dev
3.进入sunxi-tool目录后执行make && sudo make install,提示找不到libusb.h,编译失败。
4.在电脑上可以找到libusb.h,且路径已包含在export中。
如何解决?
root@51970f1e16d6:~/sunxi/sunxi-tools# make && sudo make install
Setting version information: v1.4.1-87-g78a7566
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-fexc fexc.c script.c script_uboot.c script_bin.c script_fex.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-bootinfo bootinfo.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` -o sunxi-fel fel.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0`
/bin/sh: 1: pkg-config: not found
/bin/sh: 1: pkg-config: not found
fel_lib.c:26:20: fatal error: libusb.h: No such file or directory
compilation terminated.
Makefile:136: recipe for target 'sunxi-fel' failed
make: *** [sunxi-fel] Error 1
root@51970f1e16d6:~/sunxi/sunxi-tools# find / -name libusb.h
/usr/include/libusb-1.0/libusb.h
离线
这个是缺库了, Ubuntu你试一试:
sudo apt-get install libusb-dev
fedora:
yum install libusb-dev
其他系统你的手动下载 libusb源码,
依次执行 configure, make, make install
离线
安装了这个,还是不行, 看下面。
root@51970f1e16d6:~/sunxi/sunxi-tools# sudo apt-get install libusb-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libusb-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.9 kB of archives.
After this operation, 231 kB of additional disk space will be used.
Get:1 [url]http://mirrors.aliyun.com/ubuntu[/url] xenial/main amd64 libusb-dev amd64 2:0.1.12-28 [29.9 kB]
Fetched 29.9 kB in 1s (17.8 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libusb-dev.
(Reading database ... 55875 files and directories currently installed.)
Preparing to unpack .../libusb-dev_2%3a0.1.12-28_amd64.deb ...
Unpacking libusb-dev (2:0.1.12-28) ...
Setting up libusb-dev (2:0.1.12-28) ...
root@51970f1e16d6:~/sunxi/sunxi-tools# make clean
make -C tests/ clean
make[1]: Entering directory '/root/sunxi/sunxi-tools/tests'
rm -rf sunxi-boards.zip sunxi-boards unify-fex
make[1]: Leaving directory '/root/sunxi/sunxi-tools/tests'
removed 'sunxi-fexc'
removed 'sunxi-bootinfo'
removed 'version.h'
root@51970f1e16d6:~/sunxi/sunxi-tools# make && sudo make install
Setting version information: v1.4.1-87-g78a7566
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-fexc fexc.c script.c script_uboot.c script_bin.c script_fex.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-bootinfo bootinfo.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` -o sunxi-fel fel.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0`
/bin/sh: 1: pkg-config: not found
/bin/sh: 1: pkg-config: not found
fel_lib.c:26:20: fatal error: libusb.h: No such file or directory
compilation terminated.
Makefile:136: recipe for target 'sunxi-fel' failed
make: *** [sunxi-fel] Error 1
离线
这就尴尬了, 缺的库已经装上
你用了docker?
离线
$ find /usr/ |grep libusb.h
/usr/include/libusb-1.0/libusb.h
看下能不能找到这个文件?
离线
看起来缺pkg-config, 你再试一试这个:
sudo apt-get install build-essential pkg-config
离线
我想问下你这个问题是后面是怎么解决了 我也出现和你一样的问题
离线
看起来缺pkg-config, 你再试一试这个:
sudo apt-get install build-essential pkg-config
谢谢,我也遇到了这个问题,安装了你说的这几个可以编译安装了!
离线
记录一下,Ubuntu 18.04 ,装这个可以 sudo apt-get install libusb-1.0-0-dev。
离线
记录一下,Ubuntu 18.04 ,装这个可以 sudo apt-get install libusb-1.0-0-dev。
感谢 装sudo apt-get install libusb-dev是不行的,ubuntu21.01编译OK,只是有警告而已
离线
kang@kang-virtual-machine:~/work/kang/a33/sunxi-tools$ make
Setting version information: v1.4.2-116-g6c02224
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-fexc fexc.c script.c script_uboot.c script_bin.c script_fex.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-bootinfo bootinfo.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` `pkg-config --cflags zlib` -o sunxi-fel \
fel.c fit_image.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0` `pkg-config --libs zlib` -lfdt
fit_image.c: In function 鈥[01mfdt_getprop_u32鈥
fit_image.c:86:9: warning: implicit declaration of function 鈥[01mbe32toh鈥[-Wimplicit-function-declaration]
return be32toh(*(uint32_t *)prop->data);
^
/tmp/ccXcAzjK.o: In function `fdt_getprop_u32':
fit_image.c:(.text+0x19d): undefined reference to `be32toh'
/tmp/ccXcAzjK.o: In function `load_fit_images':
fit_image.c:(.text+0x59e): undefined reference to `fdt_first_subnode'
fit_image.c:(.text+0x5f3): undefined reference to `fdt_next_subnode'
fit_image.c:(.text+0x665): undefined reference to `fdt_first_subnode'
collect2: error: ld returned 1 exit status
Makefile:141: recipe for target 'sunxi-fel' failed
make: *** [sunxi-fel] Error 1
离线
kang@kang-virtual-machine:~/work/kang/a33/sunxi-tools$ make
Setting version information: v1.4.2-116-g6c02224
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-fexc fexc.c script.c script_uboot.c script_bin.c script_fex.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ -o sunxi-bootinfo bootinfo.c
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` `pkg-config --cflags zlib` -o sunxi-fel \
fel.c fit_image.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0` `pkg-config --libs zlib` -lfdt
fit_image.c:19:20: fatal error: libfdt.h: No such file or directory
compilation terminated.
Makefile:141: recipe for target 'sunxi-fel' failed
make: *** [sunxi-fel] Error 1
kang@kang-virtual-machine:~/work/kang/a33/sunxi-tools$ apt-cache search libfdt.h | grep dev
kang@kang-virtual-machine:~/work/kang/a33/sunxi-tools$
kang@kang-virtual-machine:~/work/kang/a33/sunxi-tools$ make clean
make -C tests/ clean
make[1]: Entering directory '/home/kang/work/kang/a33/sunxi-tools/tests'
rm -rf sunxi-boards.zip sunxi-boards unify-fex
make[1]: Leaving directory '/home/kang/work/kang/a33/sunxi-tools/tests'
removed 'sunxi-fexc'
removed 'sunxi-bootinfo'
removed 'version.h'
离线
今天在ubunt22.04编译最新的sunxi-tools也遇到了这个问题。
已经通过apt安装libusb-1.0-dev了,但还是报这个错误,fel_lib.c文件里报错找不到libusb.h。
向上翻,找到这些提示:
cc -std=c99 -Wall -Wextra -Wno-unused-result -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iinclude/ `pkg-config --cflags libusb-1.0` `pkg-config --cflags zlib` -o sunxi-fel \
fel.c fit_image.c progress.c soc_info.c fel_lib.c fel-spiflash.c `pkg-config --libs libusb-1.0` `pkg-config --libs zlib` -lfdt
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libusb-1.0', required by 'world', not found
Package libusb-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libusb-1.0', required by 'world', not found
手动执行pkg-config --libs libusb-1.0也是报错,按提示找PKG_CONFIG_PATH。
echo $PKG_CONFIG_PATH
发现是空的,搜pkgconfig,搜到多个目录,有一个目录下有上边提示的libusb-1.0.pc,将PKG_CONFIG_PATH设为该目录。
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/
再make,发现没上边那个提示了,但是仍报错找不到libusb.h。编辑fel_lib.c文件,找到报错那行,修改为:
#include <libusb-1.0/libusb.h>
再次编译就通过了。
在线