google / gousb

gousb provides low-level interface for accessing USB devices
Apache License 2.0
838 stars 124 forks source link

libusb.pc not found #40

Closed trayanr closed 6 years ago

trayanr commented 6 years ago

Hi I wanted to experiment with this package, but when the main.go file of lsusb subdirectory outputs

# pkg-config --cflags libusb-1.0 Package libusb-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containing 'libusb-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libusb-1.0' found pkg-config: exit status 1

I extracted the libusb to a folder and added it to PKG_CONFIG_PATH environment variable. But then I looked and saw that there was no libusb.pc file. I couldn't find where to find this file for download. I am on Windows 10.

zagrodzki commented 6 years ago

I'm not well versed in how Windows Go development works, but I think you won't be able to use gousb to build an application under vanilla Windows.

gousb will only compile within a Unix-like environment like MSYS that you must have installed before you begin. Extracting the contents of libusb source archive is definitely not enough.

Our Windows test environment uses MSYS for this (https://www.msys2.org/). With msys you need to install (using pacman package manager):

and only then you can attempt to build gousb.

For reference, for testing on Windows we use AppVeyor's Visual Studio 2015 environment, see here: https://www.appveyor.com/docs/build-environment/#mingw-msys-cygwin with this script: https://github.com/google/gousb/blob/master/.appveyor/install.sh

Hope that helps.