rockchip-linux / rkdeveloptool

GNU General Public License v2.0
159 stars 91 forks source link

undefined symbol: libusb_get_port_number #30

Open modrobert opened 5 years ago

modrobert commented 5 years ago

On Ubuntu 16.04.5 LTS configuring and compiling works fine but when running 'rkdeveloptool' I get the following error:

rkdeveloptool: symbol lookup error: rkdeveloptool: undefined symbol: libusb_get_port_number

After checking libusb-1.0...

$ nm -D /usr/lib/libusb-1.0.so.0.0.0 | grep get_
0000000000004aa0 T libusb_get_active_config_descriptor
0000000000002a30 T libusb_get_bus_number
0000000000004870 T libusb_get_config_descriptor
0000000000004a40 T libusb_get_config_descriptor_by_value
00000000000034c0 T libusb_get_configuration
0000000000002a50 T libusb_get_device
0000000000002a40 T libusb_get_device_address
0000000000003fb0 T libusb_get_device_descriptor
00000000000031a0 T libusb_get_device_list
0000000000003970 T libusb_get_max_iso_packet_size
0000000000003a90 T libusb_get_max_packet_size
0000000000005090 T libusb_get_next_timeout
0000000000004e30 T libusb_get_pollfds
0000000000003cd0 T libusb_get_string_descriptor_ascii

As you can see libusb_get_port_number() is missing in libusb-1.0.

The following fix using libusb_get_device_address() instead worked for me:

$ diff RKScan.cpp.original RKScan.cpp.fix
262c262,263
<                       desc.uiLocationID += libusb_get_port_number(dev); 
---
>                       // desc.uiLocationID += libusb_get_port_number(dev); 
>                       desc.uiLocationID += libusb_get_device_address(dev);