1

I'm getting this error when I try to build (using make) my system.

gcc: error: /usr/lib/libusb-1.0.so: No such file or directory

I installed this package using this command

$ sudo apt-get install libusb-1.0-0-dev:amd64

But when I look at this it is pointing to the wrong place???

$ cd /usr/lib

$ ls -l libusb*

lrwxrwxrwx 1 root root 35 Apr 26 13:49 libusb-1.0.so -> /lib/i386-linux-gnu/libusb-1.0.so.0

lrwxrwxrwx 1 root root 35 Apr 26 16:27 libusb-1.0.so.0 -> /lib/i386-linux-gnu/libusb-1.0.so.0

I'm not sure why but shouldn't these be pointing to /lib/x86_64-linux-gnu

Not sure how to proceed or what I have done wrong.

1
  • It really helps to know what you're trying to build. We could solve this problem but another problem will most likely appear if dependencies are missing. We can often install build dependencies with one or two simple commands or we might be able to modify the make file.
    – mchid
    Apr 27 at 10:45
0

First install the dev package:

sudo apt update
sudo apt install libusb-1.0-0-dev

Next, we can locate the file by listing all the files from that package and using grep to filter the results:

dpkg -L libusb-1.0-0-dev | grep \.so

Now, we can create a simlink for this file:

sudo ln -s $(dpkg -L libusb-1.0-0-dev | grep \.so) /usr/lib/libusb-1.0.so

This should have fixed your error. However, it really helps to know what you are trying to build as there may be a better solution to your problem. Also, don't forget that you might need to run make clean before you run make again.


Additionally, here's an extra tip. To locate the package that contains a file, we can use the apt-file command.

First, install the apt-file package:

sudo apt update
sudo apt install apt-file

Next, update the file list:

sudo apt-file update

Now, search for the package that contains the file:

apt-file search /usr/lib/libusb-1.0.so

Because this command did not return a result, we can simplify the search to see if the file exists under a different file path (this might take a while):

apt-file search libusb-1.0.so

Now, you can see in the following output that the we need the libusb-1.0-0-dev package:

libusb-1.0-0: /lib/x86_64-linux-gnu/libusb-1.0.so.0
libusb-1.0-0: /lib/x86_64-linux-gnu/libusb-1.0.so.0.1.0
libusb-1.0-0-dev: /usr/lib/x86_64-linux-gnu/libusb-1.0.so

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.