[英]fatal error: libusb/libusb.h: No such file or directory librtlsdr install for GNU radio
Trying to install rtl-sdr
(through git clone git://git.osmocom.org/rtl-sdr.git
) thanks to the instructions here but can't go further than make
in the first sequence of instructions: Trying to install
rtl-sdr
(through git clone git://git.osmocom.org/rtl-sdr.git
) thanks to the instructions here but can't go further than make
in the first sequence of instructions:
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
At my first try I got the following error:在我第一次尝试时,我收到以下错误:
/rtl-sdr/src/librtlsdr.c:30:10: fatal error: libusb.h: No such file or directory
After locating this file:找到此文件后:
/usr/include$ sudo locate libusb.h
/usr/include/libusb-1.0/libusb.h
I tried to replace the original #include <libusb.h>
with #include <libusb-1.0/libusb.h>
(as suggested here and here ), which led to a different failure:我试图用
#include <libusb-1.0/libusb.h>
替换原来的#include <libusb.h>
> (如此处和此处所建议的),这导致了不同的失败:
/rtl-sdr/build$ make
[ 6%] Built target convenience_static
Scanning dependencies of target rtlsdr
[ 9%] Building C object src/CMakeFiles/rtlsdr.dir/librtlsdr.c.o
[ 12%] Linking C shared library librtlsdr.so
[ 28%] Built target rtlsdr
[ 31%] Linking C executable rtl_test
librtlsdr.so.0.6git: undefined reference to `libusb_open'
librtlsdr.so.0.6git: undefined reference to `libusb_release_interface'
librtlsdr.so.0.6git: undefined reference to `libusb_close'
librtlsdr.so.0.6git: undefined reference to `libusb_get_string_descriptor_ascii'
librtlsdr.so.0.6git: undefined reference to `libusb_get_device_list'
librtlsdr.so.0.6git: undefined reference to `libusb_kernel_driver_active'
librtlsdr.so.0.6git: undefined reference to `libusb_alloc_transfer'
librtlsdr.so.0.6git: undefined reference to `libusb_bulk_transfer'
librtlsdr.so.0.6git: undefined reference to `libusb_reset_device'
librtlsdr.so.0.6git: undefined reference to `libusb_handle_events_timeout'
librtlsdr.so.0.6git: undefined reference to `libusb_get_device'
librtlsdr.so.0.6git: undefined reference to `libusb_exit'
librtlsdr.so.0.6git: undefined reference to `libusb_free_transfer'
librtlsdr.so.0.6git: undefined reference to `libusb_init'
librtlsdr.so.0.6git: undefined reference to `libusb_get_device_descriptor'
librtlsdr.so.0.6git: undefined reference to `libusb_free_device_list'
librtlsdr.so.0.6git: undefined reference to `libusb_claim_interface'
librtlsdr.so.0.6git: undefined reference to `libusb_control_transfer'
librtlsdr.so.0.6git: undefined reference to `libusb_submit_transfer'
librtlsdr.so.0.6git: undefined reference to `libusb_dev_mem_free'
librtlsdr.so.0.6git: undefined reference to `libusb_cancel_transfer'
collect2: error: ld returned 1 exit status
src/CMakeFiles/rtl_test.dir/build.make:96: recipe for target 'src/rtl_test' failed
make[2]: *** [src/rtl_test] Error 1
CMakeFiles/Makefile2:138: recipe for target 'src/CMakeFiles/rtl_test.dir/all' failed
make[1]: *** [src/CMakeFiles/rtl_test.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Note that this suggestion seems to be associated with a gcc compile option / link --cflags libusb-1.0
or -lusb-1.0
(cf. here and here ) that I don't know where to find (since I'm using make
, without being used to it).请注意,此建议似乎与我不知道在哪里找到的 gcc 编译选项/链接
--cflags libusb-1.0
或-lusb-1.0
(参见此处和此处)相关(因为我正在使用make
,不习惯)。
I also tried to replace the original #include <libusb.h>
with #include <usb.h>
(as seen here ) which led to:我还尝试用
#include <libusb.h>
替换原来的 #include < #include <usb.h>
(如此处所示),这导致:
/rtl-sdr/src/librtlsdr.c:97:2: error: unknown type name ‘libusb_context’
FYI libusb-1.0-0-dev
and libusb-dev
are already installed (as suggested here , I tried, eventhough I guess I already had it installed...):仅供参考
libusb-1.0-0-dev
和libusb-dev
已经安装(正如这里所建议的,我试过了,尽管我想我已经安装了它......):
/usr/include$ sudo apt install libusb-1.0-0-dev
libusb-1.0-0-dev is already the newest version (2:1.0.21-2).
~$ sudo apt install libusb-dev
libusb-dev is already the newest version (2:0.1.12-31).
And already installed rtl-sdr
using apt
:并且已经使用
apt
安装了rtl-sdr
:
sudo apt-get install rtl-sdr
rtl-sdr is already the newest version (0.5.3-13).
About my system: Linux version 5.4.0-58-generic gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) .关于我的系统: Linux 版本 5.4.0-58-generic gcc 版本 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 。 This install aims at being able to use a DVB-T dongle with GNU Radio, which requires this
rtl-sdr
install.此安装旨在能够将 DVB-T 加密狗与 GNU Radio 一起使用,这需要此
rtl-sdr
安装。
EDIT: after @Tsyvarev answer编辑: @Tsyvarev 回答后
pkg-config
with sudo apt install pkg-config
sudo apt install pkg-config
pkg-config
git clone
, new clean git clone
, new /build
etc and then make
, which worked !git clone
、新的干净git clone
、新的/build
等产生的第一个存储库,然后make
,它工作! Removing the old repository clone & re-creating a clean /build
was necessary, since trying to launch make
in the old /build
even after the install of pkg-config
didn't work.删除旧的存储库克隆并重新创建一个干净的
/build
是必要的,因为即使在安装pkg-config
后尝试在旧的/build
中启动make
也不起作用。 Note that this implies that no change was needed on the #include <libusb.h>
code line in src/librtlsdr.c
.请注意,这意味着不需要更改
src/librtlsdr.c
中的#include <libusb.h>
代码行。
As a side note, for those of you who end up here because they're trying to install the "RTL-SDR Source" block for GNU Radio, I suspect my problem was actually that I hadn't installed gr-osmosdr
with sudo apt install gr-osmosdr
after installing rtl-sdr
with a simple sudo apt-get install rtl-sdr
.作为旁注,对于那些因为试图为 GNU Radio 安装“RTL-SDR Source”块而最终来到这里的人,我怀疑我的问题实际上是我没有使用
sudo apt install gr-osmosdr
安装gr-osmosdr
在使用简单的sudo apt-get install rtl-sdr
rtl-sdr
后sudo apt install gr-osmosdr
。
whole way:全程:
sudo apt install pkg-config
sudo apt install libusb-1.0-0
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr
mkdir build
cd build
cmake ..
sudo make install
@Tsyvarev answer (see comment), which I put in the EDIT: at the end of my question. @Tsyvarev 答案(见评论),我把它放在编辑中:在我的问题结束时。 I re-post his solution here in order to close the question and mark it as solved.
我在这里重新发布他的解决方案以关闭问题并将其标记为已解决。
pkg-config
with sudo apt install pkg-config
sudo apt install pkg-config
pkg-config
git clone
, new clean git clone
, new /build
etc and then make
, which worked !git clone
、新的干净git clone
、新的/build
等产生的第一个存储库,然后make
,它工作! Removing the old repository clone & re-creating a clean /build
was necessary, since trying to launch make
in the old /build
even after the install of pkg-config
didn't work.删除旧的存储库克隆并重新创建一个干净的
/build
是必要的,因为即使在安装pkg-config
后尝试在旧的/build
中启动make
也不起作用。 Note that this implies that no change was needed on the #include <libusb.h>
code line in src/librtlsdr.c
.请注意,这意味着不需要更改
src/librtlsdr.c
中的#include <libusb.h>
代码行。
As a side note, for those of you who end up here because they're trying to install the "RTL-SDR Source" block for GNU Radio, I suspect my problem was actually that I hadn't installed gr-osmosdr
with sudo apt install gr-osmosdr
after installing rtl-sdr
with a simple sudo apt-get install rtl-sdr
.作为旁注,对于那些因为试图为 GNU Radio 安装“RTL-SDR Source”块而最终来到这里的人,我怀疑我的问题实际上是我没有使用
sudo apt install gr-osmosdr
安装gr-osmosdr
在使用简单的sudo apt-get install rtl-sdr
rtl-sdr
后sudo apt install gr-osmosdr
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.