未定义符号-libusb_get_port_numbers

未定义符号-libusb_get_port_numbers

我正在做什么会产生这个错误:librealsense

从标题可以清楚看出,我无法解决此错误。我查看了其他人的建议,一般是“未引用正确的包”或“您有多个包”等,但他们提供的解决方案对我没有用。

生成此文件的文件扩展名为“.so. ...”,我假设它是编译后的代码。因此,如果问题确实出在这里,我无法强制它引用正确的包。我怀疑它的原因在于我已经完全删除了所有 libusb 包并重新安装了所需的包。这是我收到的错误:

realsense-viewer: symbol lookup error: /usr/lib/x86_64-linux-gnu/librealsense2.so.2.32: undefined symbol: libusb_get_port_numbers

以下是一些可以帮助人们入门的信息:

xx@xx:~$ apt-cache policy libusb-1.0*
N: Unable to locate package libusb-1.0.18
N: Couldn't find any package by glob 'libusb-1.0.18'
N: Couldn't find any package by regex 'libusb-1.0.18'
N: Unable to locate package libusb-1.0.18.tar.bz2
N: Couldn't find any package by glob 'libusb-1.0.18.tar.bz2'
N: Couldn't find any package by regex 'libusb-1.0.18.tar.bz2'

xx@xx:~$ dpkg -l libusb-1.0*
dpkg-query: no packages found matching libusb-1.0.18
dpkg-query: no packages found matching libusb-1.0.18.tar.bz2

我尝试删除 libusb-1.0-0 并重新安装它,但是

xx@xx:~$ sudo apt-get purge libusb-1.0-0 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 upower : Depends: libusb-1.0-0 (>= 2:1.0.8) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

我想,我无法删除 upower,因为 ppa 列表中有一些引用。

xx@xx:~$ sudo dpkg -P upower
dpkg: warning: ignoring request to remove upower which isn't installed

我认为我必须删除所有引用此包的 ppa,但列表太长了。它还可能使其他一些包无法运行。我不知道该怎么做。

我希望传感器(英特尔的 realsense T265)可以在我的电脑上工作,而无需连接到虚拟机。请在回答时考虑到我不是软件工程师或 IT 相关的人员,因此可能需要进一步解释。任何帮助都欢迎。

答案1

我想我最近遇到了类似的问题并解决了它。

librealsense 引用的 libusb 库与 libusb apt 包管理的库不同。这是因为我手动使用 ldconfig 添加了不同的路径,其中包含相同文件名的目录(当我尝试使用另一个名为 DepthSenseSDK 的库时)。

$ ldd /lib/x86_64-linux-gnu/librealsense2.so | grep libusb
    libusb-1.0.so.0 => /opt/softkinetic/DepthSenseSDK/lib/libusb-1.0.so.0 (0x00007f80d3545000)
$ ldconfig -p | grep libusb
    libusbmuxd.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libusbmuxd.so.6
    libusbmuxd.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libusbmuxd.so
    libusb-1.0.so.0 (libc6,x86-64) => /opt/softkinetic/DepthSenseSDK/lib/libusb-1.0.so.0
    libusb-1.0.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libusb-1.0.so.0
    libusb-1.0.so (libc6,x86-64) => /opt/softkinetic/DepthSenseSDK/lib/libusb-1.0.so
    libusb-1.0.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libusb-1.0.so
    libusb-0.1.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libusb-0.1.so.4

删除额外的 ldconfig 路径后,问题得到解决。

$ cat /etc/ld.so.conf.d/softkinetic.conf
/opt/softkinetic/DepthSenseSDK/lib
$ sudo rm /etc/ld.so.conf.d/softkinetic.conf
$ sudo ldconfig
$ ldd /lib/x86_64-linux-gnu/librealsense2.so | grep libusb
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f9f45cb8000)

相关内容