Closed mouse07410 closed 5 years ago
if libusb is installed with homebrew into default locations this just works, for other types of installs cgo probably has to be instructed about where to find include files and libraries for linking. I'm unsure how to do this, but it can probably be found out.
AFAIK, Homebrew is less popular than, e.g., Macports, and has about 4600 ports, as opposed to 20000 ports provided by Macports. So, IMHO the choice of Home-brew as the default is arbitrary.
This is the solution that works for me:
diff --git a/Makefile b/Makefile
index befca5f..e10f9b5 100644
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,8 @@ MAKEFLAGS += --no-builtin-rules
all: build
build:
- @gb generate ${GB_GEN_FLAGS}
- @gb build ${GB_BUILD_FLAGS}
+ gb generate ${GB_GEN_FLAGS}
+ CGO_CFLAGS="-I/opt/local/include" CGO_LDFLAGS="-L/opt/local/lib" gb build ${GB_BUILD_FLAGS}
rebuild: clean build
The current build process is unable to locate
libusb.h
: