![sigrok-cli 和 PulseView AppImage 无法启动,因为未定义符号:libusb_get_version](https://linux22.com/image/1167022/sigrok-cli%20%E5%92%8C%20PulseView%20AppImage%20%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8%EF%BC%8C%E5%9B%A0%E4%B8%BA%E6%9C%AA%E5%AE%9A%E4%B9%89%E7%AC%A6%E5%8F%B7%EF%BC%9Alibusb_get_version.png)
我正在尝试开始脉搏视图和西格洛克AppImages。不幸的是,我收到一条错误消息,我不知道如何修复它:
./sigrok-cli-0.7.1-x86_64.AppImage
sigrok-cli: symbol lookup error: /tmp/.mount_sigrokLM29y6/usr/lib/libsigrok.so.4: undefined symbol: libusb_get_version
./PulseView-0.4.1-x86_64.AppImage
pulseview: symbol lookup error: /tmp/.mount_PulseVunpXcp/usr/lib/libsigrok.so.4: undefined symbol: libusb_get_version
然后,我尝试按照以下说明从源代码进行构建https://sigrok.org/wiki/Linux。我已成功构建所有库,但得到了相同的未定义引用利布在建造时sigrok-cli:
~/temp/sigrok-cli$ make
make all-am
CCLD sigrok-cli
/usr/local/lib/libsigrok.so: undefined reference to `libusb_free_pollfds'
/usr/local/lib/libsigrok.so: undefined reference to `libusb_get_version'
/usr/local/lib/libsigrok.so: undefined reference to `libusb_handle_events_timeout_completed'
/usr/local/lib/libsigrok.so: undefined reference to `libusb_has_capability'
/usr/local/lib/libsigrok.so: undefined reference to `libusb_error_name'
/usr/local/lib/libsigrok.so: undefined reference to `libusb_get_port_numbers'
collect2: error: ld returned 1 exit status
Makefile:476: recipe for target 'sigrok-cli' failed
make[1]: *** [sigrok-cli] Error 1
Makefile:362: recipe for target 'all' failed
make: *** [all] Error 2
以下是一些转储:
$ lsb_release -a
LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
$ apt-cache policy libusb-1.0*
libusb-1.0-0:
Installed: 2:1.0.20-1
Candidate: 2:1.0.20-1
Version table:
*** 2:1.0.20-1 500
500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
libusb-1.0-0-dbg:
Installed: (none)
Candidate: 2:1.0.20-1
Version table:
2:1.0.20-1 500
500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
libusb-1.0-0-dev:
Installed: 2:1.0.20-1
Candidate: 2:1.0.20-1
Version table:
*** 2:1.0.20-1 500
500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
libusb-1.0-doc:
Installed: 2:1.0.20-1
Candidate: 2:1.0.20-1
Version table:
*** 2:1.0.20-1 500
500 http://de.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
500 http://de.archive.ubuntu.com/ubuntu xenial/main i386 Packages
100 /var/lib/dpkg/status
您知道问题是什么吗?
答案1
在 sigrok 邮件列表中的一位开发人员的帮助下,我解决了这个问题。我安装的 libusb 版本已过时/usr/local/lib/libusb-1.0.so.0
LDD显示我之前构建的 libsigrok.so 引用的是 libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0
$ ldd /usr/local/lib/libsigrok.so linux-vdso.so.1 => (0x00007fffd00c9000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9e60cb4000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0
(0x00007f9e609a3000) libserialport.so.0 =>
/usr/local/lib/libserialport.so.0 (0x00007f9e60792000) libftdi1.so.2 =>
/usr/lib/x86_64-linux-gnu/libftdi1.so.2 (0x00007f9e60584000)
libusb-1.0.so.0 => /usr/local/lib/libusb-1.0.so.0 (0x00007f9e60376000)
libzip.so.4 => /usr/lib/x86_64-linux-gnu/libzip.so.4 (0x00007f9e60163000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f9e5ff46000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
(0x00007f9e5fb7c000) /lib64/ld-linux-x86-64.so.2 (0x00007f9e612d2000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f9e5f90c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9e5f704000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9e5f4ea000)
纳米显示缺少所需符号
$nm -gD /usr/local/lib/libusb-1.0.so.0 | grep version
然后我搜索了其他包含符号的 libusb
$ locate libusb-1.0.so.0
/lib/x86_64-linux-gnu/libusb-1.0.so.0
/lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
/opt/calibre/lib/libusb-1.0.so.0
/usr/lib/libusb-1.0.so.0
/usr/lib/libusb-1.0.so.0.0.0
/usr/local/lib/libusb-1.0.so.0
/usr/local/lib/libusb-1.0.so.0_toberemoved
$ nm -gD /lib/x86_64-linux-gnu/libusb-1.0.so.0 | grep version
0000000000006190 T libusb_get_version
最后,我把过时的/usr/local/lib/libusb-1.0.so.0. 依赖库修正为/lib/x86_64-linux-gnu经 ldd 确认。之后我成功构建了 sigrok-cli 并启动了 AppImagesPulseView-0.4.1-x86_64.AppImage和sigrok-cli-0.7.1-x86_64.AppImage没有任何问题。
$ sudo mv /usr/local/lib/libusb-1.0.so.0 /usr/local/lib/libusb-1.0.so.0-temp
$ ldd /usr/local/lib/libsigrok.so
linux-vdso.so.1 => (0x00007ffe453e1000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f10f103e000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0
(0x00007f10f0d2d000)
libserialport.so.0 => /usr/local/lib/libserialport.so.0 (0x00007f10f0b1c000)
libftdi1.so.2 => /usr/lib/x86_64-linux-gnu/libftdi1.so.2
(0x00007f10f090e000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0
(0x00007f10f06f6000)
libzip.so.4 => /usr/lib/x86_64-linux-gnu/libzip.so.4 (0x00007f10f04e3000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f10f02c6000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f10efefc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f10f165c000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f10efc8c000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f10f1834000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f10efa72000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f10ef86a000)