您尚未登录。

楼主 #1 2017-11-15 15:44:45

NBIOT001
会员
注册时间: 2017-11-15
已发帖子: 4
积分: 4

V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

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

离线

#2 2017-11-15 15:45:50

沉鱼
管理员
注册时间: 2017-09-06
已发帖子: 161
积分: 161

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

这个是缺库了, Ubuntu你试一试:
sudo apt-get install libusb-dev

fedora:
yum install libusb-dev

其他系统你的手动下载 libusb源码,
依次执行 configure, make, make install

离线

楼主 #3 2017-11-15 15:50:01

NBIOT001
会员
注册时间: 2017-11-15
已发帖子: 4
积分: 4

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

安装了这个,还是不行, 看下面。

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

离线

#4 2017-11-15 15:51:42

沉鱼
管理员
注册时间: 2017-09-06
已发帖子: 161
积分: 161

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

这就尴尬了, 缺的库已经装上
你用了docker?

离线

#5 2017-11-15 15:53:12

沉鱼
管理员
注册时间: 2017-09-06
已发帖子: 161
积分: 161

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

$ find /usr/ |grep libusb.h
/usr/include/libusb-1.0/libusb.h


看下能不能找到这个文件?

离线

#6 2017-11-15 15:54:44

沉鱼
管理员
注册时间: 2017-09-06
已发帖子: 161
积分: 161

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

看起来缺pkg-config, 你再试一试这个:

sudo apt-get install build-essential pkg-config

离线

#7 2018-09-05 10:03:03

无情一刀
会员
注册时间: 2018-09-04
已发帖子: 694
积分: 685

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

我想问下你这个问题是后面是怎么解决了 我也出现和你一样的问题

离线

#8 2018-09-05 10:21:26

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,242
积分: 9197

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

无情一刀 说:

我想问下你这个问题是后面是怎么解决了 我也出现和你一样的问题

什么状况?





离线

#9 2019-07-25 14:35:40

学习
会员
注册时间: 2019-07-08
已发帖子: 26
积分: 26

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

沉鱼 说:

看起来缺pkg-config, 你再试一试这个:

sudo apt-get install build-essential pkg-config


谢谢,我也遇到了这个问题,安装了你说的这几个可以编译安装了!

离线

#10 2020-10-29 23:06:53

afon
会员
注册时间: 2020-10-29
已发帖子: 2
积分: 2

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

记录一下,Ubuntu 18.04 ,装这个可以 sudo apt-get install libusb-1.0-0-dev。

离线

#11 2021-02-02 18:04:11

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 291
积分: 344

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

afon 说:

记录一下,Ubuntu 18.04 ,装这个可以 sudo apt-get install libusb-1.0-0-dev。

感谢 装sudo apt-get install libusb-dev是不行的,ubuntu21.01编译OK,只是有警告而已

离线

#12 2021-03-21 12:35:41

cloudxxcloud
会员
注册时间: 2021-02-20
已发帖子: 39
积分: 31.5

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

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

离线

#13 2021-03-21 12:36:25

cloudxxcloud
会员
注册时间: 2021-02-20
已发帖子: 39
积分: 31.5

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.h,咋办?

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'

离线

#14 2023-04-19 10:57:27

Gentlepig
会员
注册时间: 2018-10-24
已发帖子: 1,204
积分: 1140.5

Re: V3S,安装sunxi-fel烧录工具,提示找不到libusb.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>

再次编译就通过了。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn