ChannelFinder / recsync

EPICS Record Synchronizor
Other
15 stars 25 forks source link

building on windows #62

Closed kingspride closed 2 years ago

kingspride commented 2 years ago

Hello, when building on windows with MSVC and under EPICS 7, I end up with a bunch of errors ...

is this a known phenomenon or is reccaster client incompatible with windows somehow?

[...]
cl               -nologo -FC -D__STDC__=0 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE    -Ox -GL -Oy-   -W3        -MD -DEPICS_BUILD_DLL -DEPICS_CALL_DLL    -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/msvc -I../../../include/os/WIN32 -I../../../include      -IC:/EPICS/epics-support/ipac/include   -IC:/EPICS/epics-support/sscan/include   -IC:/EPICS/epics-support/seq-2.2.8/include   -IC:/EPICS/epics-support/calc/include  -IC:/EPICS/epics-support/autosave/include/os/WIN32 -IC:/EPICS/epics-support/autosave/include   -IC:/EPICS/epics-support/busy/include      -IC:/EPICS/epics-support/asyn/include   -IC:/EPICS/epics-support/motor/include   -IC:/EPICS/epics-support/modbus/include   -IC:/EPICS/epics-support/devlib2/include   -IC:/EPICS/epics-support/StreamDevice/include       -IC:/EPICS/epics-base/include/compiler/msvc -IC:/EPICS/epics-base/include/os/WIN32 -IC:/EPICS/epics-base/include        -c ../sockhelpers.c
sockhelpers.c
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(63): error C2061: syntax error: identifier 'shRecvExact'C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(63): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(63): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(67): error C2061: syntax error: identifier 'shRecvIgnore'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(67): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(67): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(70): error C2061: syntax error: identifier 'shRecvFrom'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(70): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.h(70): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(100): warning C4244: 'function': conversion from 'SOCKET' to 'int', possible loss of data
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(173): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(161): warning C4244: 'initializing': conversion from 'SOCKET' to 'int', possible loss of data
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(225): error C2061: syntax error: identifier 'shRecvExact'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(225): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(225): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(246): error C2061: syntax error: identifier 'shRecvIgnore'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(246): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(246): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(267): error C2061: syntax error: identifier 'shRecvFrom'C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(267): error C2059: syntax error: ';'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(267): error C2059: syntax error: '<parameter-list>'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(297): error C2065: 'ssize_t': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(297): error C2146: syntax error: missing ';' before identifier 'ret'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(297): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(303): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(303): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(304): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(306): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(311): error C2065: 'ssize_t': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(311): error C2146: syntax error: missing ';' before identifier 'ret'
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(311): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(320): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(320): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(321): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(323): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(324): error C2065: 'ret': undeclared identifier
C:\EPICS\epics-support\recsync\client\castApp\src\sockhelpers.c(326): error C2065: 'ret': undeclared identifier
make[3]: *** [C:/EPICS/epics-base/configure/RULES_BUILD:259: sockhelpers.obj] Error 2
make[3]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp/src/O.windows-x64'
make[2]: *** [C:/EPICS/epics-base/configure/RULES_ARCHS:58: install.windows-x64] Error 2
make[2]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp/src'
make[1]: *** [C:/EPICS/epics-base/configure/RULES_DIRS:85: src.install] Error 2
make[1]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp'
make: *** [C:/EPICS/epics-base/configure/RULES_DIRS:85: castApp.install] Error 2

C:\EPICS\epics-support\recsync\client>

thanks, W.

mdavidsaver commented 2 years ago

Looks like a missing #include <shareLib.h>

kingspride commented 2 years ago

I narrowed it down to an incompatibility between POSIX / Windows. reccaster client uses a lot of ssize_t which is not directly available on Windows (there its SSIZE_T), but can be added via

#if defined(_MSC_VER)
    #include <BaseTsd.h>
    typedef SSIZE_T ssize_t;
#endif

adding it to sockhelpers.h and caster.h brought me here....

[...]
link -nologo -subsystem:windows -dll -LTCG -incremental:no -opt:ref -release  -MACHINE:X64      -out:reccaster.dll -implib:reccaster.lib    sockhelpers.obj caster.obj castudp.obj casttcp.obj castinit.obj dbcb.obj        C:/EPICS/epics-base/lib/windows-x64/dbRecStd.lib  C:/EPICS/epics-base/lib/windows-x64/dbCore.lib  C:/EPICS/epics-base/lib/windows-x64/ca.lib  C:/EPICS/epics-base/lib/windows-x64/Com.lib
   Creating library reccaster.lib and object reccaster.exp
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_WSAGetLastError
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_ioctlsocket
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_sendto
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_htonl
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_getsockopt
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_recv
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_recvfrom
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_connect
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_send
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_getsockname
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_WSASetLastError
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_listen
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_select
sockhelpers.obj : error LNK2001: unresolved external symbol __imp_bind
sockhelpers.obj : error LNK2001: unresolved external symbol __WSAFDIsSet
caster.obj : error LNK2001: unresolved external symbol __imp_htons
caster.obj : error LNK2001: unresolved external symbol __imp_ntohs
caster.obj : error LNK2001: unresolved external symbol __imp_ntohl
dbcb.obj : error LNK2001: unresolved external symbol __imp_gethostname
reccaster.dll : fatal error LNK1120: 19 unresolved externals
make[3]: *** [C:/EPICS/epics-base/configure/RULES_BUILD:316: reccaster.dll] Error 1120
make[3]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp/src/O.windows-x64'
make[2]: *** [C:/EPICS/epics-base/configure/RULES_ARCHS:58: install.windows-x64] Error 2
make[2]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp/src'
make[1]: *** [C:/EPICS/epics-base/configure/RULES_DIRS:85: src.install] Error 2
make[1]: Leaving directory 'C:/EPICS/epics-support/recsync/client/castApp'
make: *** [C:/EPICS/epics-base/configure/RULES_DIRS:85: castApp.install] Error 2

C:\EPICS\epics-support\recsync\client>
kingspride commented 2 years ago

ok it compiles now. I had to add reccaster_SYS_LIBS_WIN32 += ws2_32 to the src Makefile aswell to have it load windows' winsock2 library...

can we create a PR with these changes?

shroffk commented 2 years ago

Please go ahead and make a PR

kingspride commented 2 years ago

its already there: #63

kingspride commented 2 years ago

got merged.