[PD] compiling hidio for Windows

ffdd cchh camarafede at gmail.com
Sun Feb 2 18:01:47 CET 2020


Hi Martin, Christof,

thanks both. Still no luck.

I managed through steps a) b) and d), with the exception that I could not
add "-lhdi", as it appears to not be installed here. Is that pointing to
this: https://cran.r-project.org/web/packages/hdi/index.html ?

The log now points to *many* undefined references on mostly hidio_windows.c
and on hidio.c (which I suspect is my missing step c), for which I did not
have time)

I attach the log here again.

I have hit a brick wall here so I will not pursue this further unless there
are other instructions I can follow.

Thanks for you help,

Best,

fd

On Fri, Jan 31, 2020 at 10:52 PM Christof Ressi <info at christofressi.com>
wrote:

> The order of .o files doesn't matter. It's shared and static libraries
> which sometimes have to be specified in a certain order.
>
> The actual problem was that
>
> a) hidio_windows.c used _WINDOWS instead of _WIN32 as a guard around the
> whole code, so hidio_windows.o was empty.
>
> b) then there was a wrong header (<ddk/hidsdi.h>  instead of <hidsdi.h>)
>
> c) some methods are not implemented, so I copied the dummy implementation
> from hidio_linux.c. It seems like those methods are only relevant for OSX.
>
> d) there were missing linker flags "-lhdi -lSetupAPI".
>
> Also, I couldn't get the autotools makefile to work, so I just compiled
> manually on the command line. Finally I got a binary :-)
>
> To be honest, I don't think that anyone ever compiled this code on
> Windows, so it is probably untested. Anyway, when I have time I can clean
> this up and make a PR (or just fork it). Then we probably need some testing
> before we upload it to Deken...
>
> Christof
> On 01.02.2020 02:50, Martin Peach wrote:
>
> Line 76 of the log:
> gcc  -DPD -g -O2 -I/z/Desktop/pure-data/src   -mms-bitfields
>  -L/z/Desktop/pure-data/src -L/z/Desktop/pure-data/bin
> -L/z/Desktop/pure-data/obj   -s -shared -o hidio.dll hidio.o hidio_types.o
>   hidio_windows.o  -L/src -L/bin -L/obj -lpd
> hidio.o: In function `hidio_tick':
> Z:\Desktop\hidio/hidio.c:513: undefined reference to `hidio_get_events'
>
> hidio_tick is in hidio.o, which has compiled successfully.
> hidio_get_events is in hidio_windows.o, which also exists; but the linker
> is linking three .o files, and hidio_windows.o is the last one.
> Perhaps switching hidio.o and hidio_windows.o in that gcc command will let
> the linker find the symbols before they are needed.
>
> Martin
>
>
>
> On Fri, Jan 31, 2020 at 5:29 PM ffdd cchh <camarafede at gmail.com> wrote:
>
>> Hi Christof,
>>
>> Thanks! Yes, I found these threads on the list:
>>
>> https://lists.puredata.info/pipermail/pd-list/2019-11/126348.html
>> https://lists.puredata.info/pipermail/pd-list/2019-10/126096.html
>>
>> But, there are still no Windows version of this external...
>>
>> Github issue is up: https://github.com/Benitoite/hidio/issues/2
>>
>> Hope something comes out of this thread! I am sure there are enough
>> Windows users out there in need of some hid external.
>>
>> Best,
>>
>> f
>>
>>
>> On Fri, Jan 31, 2020 at 4:57 PM Christof Ressi <info at christofressi.com>
>> wrote:
>>
>>> I remember a similar thread on the list a few months ago. I tried to
>>> compile it and gave up. The build system for Windows seems to be broken and
>>> needs to be fixed (and probably switched from automake to pd-lib-builder).
>>> Unfortunately, I don't have time right now to work on this, but you could
>>> file a bug report on the GitHub repo, so maybe the maintainer will do it.
>>>
>>> Christof
>>> On 31.01.2020 21:05, ffdd cchh wrote:
>>>
>>> Dear list,
>>>
>>> I need to use external controllers via USB with vanilla (say, a PS4
>>> controller), and I have not found a compiled version of [hidio] for
>>> Windows. Please, let me know if there are ready-made options out there
>>> (feel free to change subject line if that thread goes wild).
>>>
>>> In the meantime, I am trying to compile [hidio] for Windows. I'm on
>>> Windows 10.0.18362, x64-based PC. I am using a MSYS terminal with MINGw64.
>>> I took the latest code from Benitoite's repository (
>>> https://github.com/Benitoite/hidio) and I am stuck with "undefined
>>> reference"s all over. I attach here the console log.
>>>
>>> I would very much welcome any idea on how to approach this so I can use
>>> vanilla with my students :)
>>>
>>> Best,
>>>
>>> f
>>>
>>>
>>> _______________________________________________Pd-list at lists.iem.at mailing list
>>> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>>>
>>> _______________________________________________
>>> Pd-list at lists.iem.at mailing list
>>> UNSUBSCRIBE and account-management ->
>>> https://lists.puredata.info/listinfo/pd-list
>>>
>>
>>
>> --
>> fdch.github.io
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> https://lists.puredata.info/listinfo/pd-list
>>
>
> _______________________________________________Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
>
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management ->
> https://lists.puredata.info/listinfo/pd-list
>


-- 
fdch.github.io
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200202/d64017a9/attachment-0001.html>
-------------- next part --------------
$ make
make[1]: Entering directory '/z/Desktop/hidio'
gcc -DPACKAGE_NAME=\"hidio\" -DPACKAGE_TARNAME=\"hidio\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"hidio\ 0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"hidio\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_TIME_H=1 -Dvfork=fork -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DRETSIGTYPE=void -I.     -DPD -g -O2 -I/z/Desktop/pure-data/src   -mms-bitfields -MT hidio.o -MD -MP -MF .deps/hidio.Tpo -c -o hidio.o hidio.c
mv -f .deps/hidio.Tpo .deps/hidio.Po
gcc -DPACKAGE_NAME=\"hidio\" -DPACKAGE_TARNAME=\"hidio\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"hidio\ 0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"hidio\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_TIME_H=1 -Dvfork=fork -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DRETSIGTYPE=void -I.     -DPD -g -O2 -I/z/Desktop/pure-data/src   -mms-bitfields -MT hidio_types.o -MD -MP -MF .deps/hidio_types.Tpo -c -o hidio_types.o hidio_types.c
mv -f .deps/hidio_types.Tpo .deps/hidio_types.Po
gcc -DPACKAGE_NAME=\"hidio\" -DPACKAGE_TARNAME=\"hidio\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"hidio\ 0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"hidio\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_TIME_H=1 -Dvfork=fork -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DRETSIGTYPE=void -I.     -DPD -g -O2 -I/z/Desktop/pure-data/src   -mms-bitfields -MT hidio_windows.o -MD -MP -MF .deps/hidio_windows.Tpo -c -o hidio_windows.o hidio_windows.c
hidio_windows.c: In function 'hidio_print_device_list':
hidio_windows.c:722:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  if ((int)PnPHandle == -1)
      ^
hidio_windows.c: In function 'hidio_get_events':
hidio_windows.c:910:125: warning: passing argument 5 of 'HidP_GetUsageValue' from incompatible pointer type [-Wincompatible-pointer-types]
    if (HIDP_STATUS_SUCCESS == HidP_GetUsageValue(HidP_Input, current_element[i].usage_page, 0, current_element[i].usage_id, &current_element[i].value,
                                                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/camarahalac.1/Desktop/msys2/mingw64/x86_64-w64-mingw32/include/hidsdi.h:34,
                 from hidio_windows.c:35:
C:/Users/camarahalac.1/Desktop/msys2/mingw64/x86_64-w64-mingw32/include/hidpi.h:222:125: note: expected 'PULONG' {aka 'long unsigned int *'} but argument is of type 't_int *' {aka 'long long int *'}
 NTSTATUS NTAPI HidP_GetUsageValue (HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
                                                                                                                      ~~~~~~~^~~~~~~~~~
hidio_windows.c:916:131: warning: passing argument 5 of 'HidP_GetScaledUsageValue' from incompatible pointer type [-Wincompatible-pointer-types]
    if (HIDP_STATUS_SUCCESS == HidP_GetScaledUsageValue(HidP_Input, current_element[i].usage_page, 0, current_element[i].usage_id, &current_element[i].value,
                                                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/Users/camarahalac.1/Desktop/msys2/mingw64/x86_64-w64-mingw32/include/hidsdi.h:34,
                 from hidio_windows.c:35:
C:/Users/camarahalac.1/Desktop/msys2/mingw64/x86_64-w64-mingw32/include/hidpi.h:223:130: note: expected 'PLONG' {aka 'long int *'} but argument is of type 't_int *' {aka 'long long int *'}
 NTSTATUS NTAPI HidP_GetScaledUsageValue (HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
                                                                                                                            ~~~~~~^~~~~~~~~~
mv -f .deps/hidio_windows.Tpo .deps/hidio_windows.Po
gcc  -DPD -g -O2 -I/z/Desktop/pure-data/src   -mms-bitfields  -L/z/Desktop/pure-data/src -L/z/Desktop/pure-data/bin -L/z/Desktop/pure-data/obj   -s -shared -o hidio.dll hidio.o hidio_types.o   hidio_windows.o  -L/src -L/bin -L/obj -lpd -lSetupAPI
hidio.o: In function `hidio_write_event':
Z:\Desktop\hidio/hidio.c:357: undefined reference to `hidio_write_event_symbols'
Z:\Desktop\hidio/hidio.c:336: undefined reference to `hidio_write_event_ints'
Z:\Desktop\hidio/hidio.c:347: undefined reference to `hidio_write_event_symbol_int'
hidio.o: In function `hidio_setup':
Z:\Desktop\hidio/hidio.c:643: undefined reference to `hidio_devices'
Z:\Desktop\hidio/hidio.c:644: undefined reference to `hidio_elements'
hidio.o:hidio.c:(.rdata$.refptr.hidio_elements[.refptr.hidio_elements]+0x0): undefined reference to `hidio_elements'
hidio.o:hidio.c:(.rdata$.refptr.hidio_devices[.refptr.hidio_devices]+0x0): undefined reference to `hidio_devices'
hidio_windows.o: In function `_hid_get_capabilities':
Z:\Desktop\hidio/hidio_windows.c:333: undefined reference to `HidD_GetPreparsedData'
Z:\Desktop\hidio/hidio_windows.c:336: undefined reference to `HidP_GetCaps'
Z:\Desktop\hidio/hidio_windows.c:339: undefined reference to `HidD_FreePreparsedData'
hidio_windows.o: In function `_hid_get_device_path':
Z:\Desktop\hidio/hidio_windows.c:288: undefined reference to `HidD_GetHidGuid'
hidio_windows.o: In function `hidio_print_device_list':
Z:\Desktop\hidio/hidio_windows.c:713: undefined reference to `HidD_GetHidGuid'
Z:\Desktop\hidio/hidio_windows.c:764: undefined reference to `HidD_GetAttributes'
Z:\Desktop\hidio/hidio_windows.c:770: undefined reference to `HidD_GetManufacturerString'
Z:\Desktop\hidio/hidio_windows.c:772: undefined reference to `HidD_GetProductString'
hidio_windows.o: In function `hidio_get_events':
Z:\Desktop\hidio/hidio_windows.c:910: undefined reference to `HidP_GetUsageValue'
Z:\Desktop\hidio/hidio_windows.c:916: undefined reference to `HidP_GetScaledUsageValue'
Z:\Desktop\hidio/hidio_windows.c:923: undefined reference to `HidP_MaxUsageListLength'
Z:\Desktop\hidio/hidio_windows.c:930: undefined reference to `HidP_GetUsages'
hidio_windows.o: In function `connectDeviceNumber':
Z:\Desktop\hidio/hidio_windows.c:107: undefined reference to `HidD_GetHidGuid'
hidio_windows.o: In function `hidio_build_element_list':
Z:\Desktop\hidio/hidio_windows.c:514: undefined reference to `HidD_GetPreparsedData'
Z:\Desktop\hidio/hidio_windows.c:515: undefined reference to `HidP_GetCaps'
Z:\Desktop\hidio/hidio_windows.c:530: undefined reference to `HidP_GetButtonCaps'
Z:\Desktop\hidio/hidio_windows.c:536: undefined reference to `HidP_GetValueCaps'
hidio_windows.o: In function `hidio_close_device':
Z:\Desktop\hidio/hidio_windows.c:1016: undefined reference to `HidD_FreePreparsedData'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:267: hidio.dll] Error 1
make[1]: Leaving directory '/z/Desktop/hidio'
make: *** [Makefile:303: all-recursive] Error 1



More information about the Pd-list mailing list