Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
nut-scanner cannot find libusb
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tkzv
Tux's lil' helper
Tux's lil' helper


Joined: 22 Aug 2014
Posts: 83

PostPosted: Tue Feb 13, 2024 10:04 am    Post subject: nut-scanner cannot find libusb Reply with quote

When I try to run nut-scanner (as root):
Code:
# /usr/bin/nut-scanner
Cannot load USB library (/usr/lib64/libusb-1.0.so) : file not found. USB search disabled.


/usr/lib64/libusb-1.0.so does exist, but it is a dummy text file:
Code:

$ cat /usr/lib64/libusb-1.0.so
/* GNU ld script
   Since Gentoo has critical dynamic libraries in /lib, and the static versions
   in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
   run into linking problems.  This "fake" dynamic lib is a linker script that
   redirects the linker to the real lib.  And yes, this works in the cross-
   compiling scenario as the sysroot-ed linker will prepend the real path.

   See bug https://bugs.gentoo.org/4411 for more info.
 */
OUTPUT_FORMAT ( elf64-x86-64 )
GROUP ( /lib64/libusb-1.0.so.0 )

/usr/lib/libusb-1.0.so.0.3.0 is real, though. But how do I use it?

LD_LIBRARY_PATH did not help:
Code:
# LD_LIBRARY_PATH='/usr/lib' nut-scanner
Cannot load USB library (/usr/lib64/libusb-1.0.so) : file not found. USB search disabled.


dev-libs/libusb-1.0.26, sys-power/nut-2.8.0-r3.


ANSWER: https://bugs.gentoo.org/486640, https://bugs.gentoo.org/836776


https://github.com/networkupstools/nut/blob/master/tools/nut-scanner/nutscan-init.c
https://github.com/networkupstools/nut/blob/master/common/common.c
nut-scanner seems to use its own algorithm to look for libusb-1.0.so. As of 2.8.0 it ignores LD_LIBRARY_PATH and uses the first file it finds. And it starts with /ust/lib64/

The only solution so far is replacing /usr/lib64/libusb-1.0.so with a link to /lib64/libusb-1.0.so.0.3.0 and then back.
Back to top
View user's profile Send private message
metapsyborg
n00b
n00b


Joined: 28 Sep 2011
Posts: 20

PostPosted: Thu Feb 22, 2024 3:17 am    Post subject: Reply with quote

Thanks for posting this info. I just had the same problem
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum