Package libusb was not found in the pkg-config search path
Asked Answered
J

3

6

I have installed pkg-config and libusb through brew

Now if I do

pkg-config --cflags --libs libusb

I get below message

Package libusb was not found in the pkg-config search path. Perhaps you should add the directory containing `libusb.pc' to the PKG_CONFIG_PATH environment variable No package 'libusb' found

So I followed this post and did

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/libusb/1.0.20/lib/pkgconfig"

But I still have the problem. What am I missing?

I am using MAC OSX El Capitan

Jezabel answered 12/4, 2016 at 16:2 Comment(0)
T
5

Just run:

pkg-config --cflags --libs /usr/local/Cellar/libusb/1.0.20/lib/pkgconfig/libusb-1.0.pc
Thais answered 12/4, 2016 at 16:9 Comment(0)
T
3

The problem appears to be that homebrew installs libusb with the -1.0 appended to the package and file names. So:

pkg-config --cflags --libs libusb-1.0

will find it, while:

pkg-config --cflags --libs libusb

won't. Since many ./configure and other scripts are looking for it without the -1.0 appended, they fail. To me, this looks like a bug in the homebrew package. Manually creating a non-1.0 named version worked for me, but it's not a very elegant solution.

Edit

Based on the comment from @silverdr, try running

brew install libusb-compat

and see if that works for older packages that demand the non-1.0 package. And/or update what you're trying to compile to add the -1.0 and run it through the tests/validation to ensure it works with the newer version.

Teletypesetter answered 18/4, 2018 at 21:25 Comment(1)
AFAIK the "non-1.0 named" is still reserved for libusb-compat / libusb-legacy. IOW - if you have libusb-compat installed you'll get the "non-1.0 named" one too.Extenuatory
W
1

I have the the same problem. This work for me (Ubuntu):

sudo apt-get install libmagickwand-dev
Widen answered 18/6, 2017 at 18:48 Comment(1)
An answer specific to Ubuntu's (Debian's) package manager is not applicable to macOS, though...Lamphere

© 2022 - 2024 — McMap. All rights reserved.