supercollider / hidapi

A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac, and Windows.
http://www.signal11.us/oss/hidapi/
Other
13 stars 14 forks source link

Build hidapi against latest mingw-w64 headers #5

Closed awson closed 7 years ago

awson commented 8 years ago

Not guarded, perhaps breaks old headers build.

This is a complement to another PR, which together allow to build supercollider with the latest stock MSys2/mingw-w64 tools.

bagong commented 8 years ago

Thank you very much for your continued contributions! Unfortunately I won't be able to test this before January myself. Hopefully somebody else can test this. If not please don't feel ignored. It's just that I won't be able to access my build-system for 2 months. Thanks again!

llloret commented 8 years ago

Hi, I will try to have a look, but not much bandwidth lately.

bagong commented 7 years ago

Hi @awson , thanks again for this! In fact this does create a linker problem for the old MinGW build, which is based on Qt-provided MinGW 4.8.2. Not sure if your changes could be introduced without this side effect?

 ../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x3a8): undefined reference to `HidD_GetPreparsedData'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x456): undefined reference to `HidD_GetSerialNumberString'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x578): undefined reference to `HidD_FreePreparsedData'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x767): undefined reference to `HidD_GetPreparsedData'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x7a6): undefined reference to `HidD_FreePreparsedData'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x848): undefined reference to `HidD_FreePreparsedData'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x1590): undefined reference to `HidD_GetSerialNumberString'
../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj):hid.c:(.text+0x1657): undefined reference to `HidD_GetIndexedString'
C:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: ../external_libraries/hidapi/windows/libhidapi.a(hid.c.obj): bad reloc address 0x20 in section `.eh_frame'
collect2.exe: error: ld returned 1 exit status
lang\CMakeFiles\sclang.dir\build.make:140: recipe for target 'lang/Release/sclang.exe' failed
mingw32-make.exe[2]: *** [lang/Release/sclang.exe] Error 1
CMakeFiles\Makefile2:2739: recipe for target 'lang/CMakeFiles/sclang.dir/all' failed
mingw32-make.exe[1]: *** [lang/CMakeFiles/sclang.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
mingw32-make.exe: *** [all] Error 2
bagong commented 7 years ago

Hi @awson , I added a comment to your PR informing about the potential build problem. I did not find a way to switch header inclusion depending on MinGW version (__MINGW_VERSION_MAJOR didn't work for me). I think this should be merged as is. I will disable hidapi-build for MinGW builds with gcc < 5.3 by default in SuperCollider and explain what to do about it in the Readme. The old state was a hack anyways... Thanks!

mossheim commented 7 years ago

I think this is fine as-is with the readme note, although I'd just like to add that we may want to test the #ifdef method again with the macros __MINGW{32,64}_VERSION_MAJOR (https://sourceforge.net/p/predef/wiki/Compilers/)