todbot / blink1-tool

Command-line tools and C library for blink(1) USB RGB LED
https://blink1.thingm.com/
Other
84 stars 15 forks source link

Build fails on FreeBSD 11.2 #13

Closed duncan-bayne closed 5 years ago

duncan-bayne commented 5 years ago

I'm running FreeBSD 11.2 amd64. When I try building blink1-tool with GNU Make via gmake (not BSD Make because of #12), I get the following errors:

Building blink1-tool for OS=freebsd BLINK1_VERSION=v2.0.1-freebsd-amd64 USBLIB_TYPE=HIDAPI
Type 'make help' for other build products
gcc -DUSE_HIDAPI -I./hidapi/hidapi -I/usr/local/include -fPIC -std=gnu99 -g -DBLINK1_VERSION=\"""v2.0.1"-freebsd-"amd64""\" -c hidapi/libusb/hid.c -o hidapi/libusb/hid.o
hidapi/libusb/hid.c:261:19: error: static declaration of 'libusb_get_string_descriptor' follows non-static declaration
 static inline int libusb_get_string_descriptor(libusb_device_handle *dev,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from hidapi/libusb/hid.c:47:0:
/usr/include/libusb.h:495:5: note: previous declaration of 'libusb_get_string_descriptor' was here
 int libusb_get_string_descriptor(libusb_device_handle * devh, uint8_t desc_index, uint16_t langid, unsigned char *data, int length);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
hidapi/libusb/hid.c: In function 'get_usb_string':
hidapi/libusb/hid.c:374:18: warning: passing argument 2 of 'libiconv' from incompatible pointer type [-Wincompatible-pointer-types]
  res = iconv(ic, &inptr, &inbytes, &outptr, &outbytes);
                  ^
In file included from hidapi/libusb/hid.c:48:0:
/usr/local/include/iconv.h:85:15: note: expected 'char **' but argument is of type 'const char **'
 extern size_t iconv (iconv_t cd,  char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
               ^
gmake: *** [Makefile:506: hidapi/libusb/hid.o] Error 1
duncan-bayne commented 5 years ago

This seems to be caused by a workaround to a missing function in FreeBSD libusb. The function has since been added, and is now conflicting with the workaround in blink1-tool.

I'll submit a PR shortly.

todbot commented 5 years ago

Hi, I believe I fixed this is the most recent commit. I added a small patch to hidapi for now. You should really submit this issue to hidapi though.