libusb/hidapi

Getting reference errors when trying to install gem on Windows

Closed this issue · 1 comments

I'm using 2.7.x right now, but I've also tried this on the latest 3.x version and getting the same results. After copying the header files to the right spot in the ruby/mingw folder, I'm getting this error during install:

compiling myhidapi.c
linking shared-object myhidapi.so
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0xa7): undefined reference to `hid_set_nonblocking'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x127): undefined reference to `hid_read_timeout'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x1a8): undefined reference to `hid_read'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x219): undefined reference to `hid_write'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x277): undefined reference to `hid_open_path'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x2c5): undefined reference to `hid_open'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x35e): undefined reference to `hid_enumerate'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x474): undefined reference to `hid_free_enumeration'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x508): undefined reference to `hid_get_product_string'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x5a8): undefined reference to `hid_get_manufacturer_string'
C:/Ruby27-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: myhidapi.o:myhidapi.c:(.text+0x1): undefined reference to `hid_close'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:263: myhidapi.so] Error 1

This does not belong to libusb project. You may want to ask in the Ruby binding project.