radiomanV / TL866

Open source software for TL866
GNU General Public License v2.0
334 stars 79 forks source link

Wine fixup #40

Closed mifritscher closed 3 months ago

mifritscher commented 2 years ago

This fixes compilation with Ubuntu 20.04 & Wine 7. It was tested successfully with a TL 8662 plus (detection, logic test of a 7400 IP and reading a I2C EEPROM).

radiomanV commented 2 years ago

Sorry but your wine fixup will throw tons of errors here (Mint 20.3, 64Bit). This is what i have installed:

apt list --installed | grep wine
fonts-wine/focal,focal,now 5.0-3ubuntu1 all [installed]
wine-stable-amd64/focal,now 7.0.0.0~focal-1 amd64 [installed,automatic]
wine-stable-dev/focal,now 7.0.0.0~focal-1 amd64 [installed]
wine-stable-i386/focal,now 7.0.0.0~focal-1 i386 [installed,automatic]
wine-stable/focal,now 7.0.0.0~focal-1 amd64 [installed]

apt list --installed | grep libusb-1.0
libusb-1.0-0-dev/focal,now 2:1.0.23-2build1 amd64 [installed]
libusb-1.0-0-dev/focal,now 2:1.0.23-2build1 i386 [installed]
libusb-1.0-0/focal,now 2:1.0.23-2build1 amd64 [installed]
libusb-1.0-0/focal,now 2:1.0.23-2build1 i386 [installed,automatic]

apt list --installed | grep libudev
libudev-dev/focal-updates,focal-security,now 245.4-4ubuntu3.15 amd64 [installed]
libudev-dev/focal-updates,focal-security,now 245.4-4ubuntu3.15 i386 [installed]
libudev1/focal-updates,focal-security,now 245.4-4ubuntu3.15 amd64 [installed]
libudev1/focal-updates,focal-security,now 245.4-4ubuntu3.15 i386 [installed,automatic]

gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

winegcc --version (the same but a wrapper)
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

make
winegcc -c  -m32 -mincoming-stack-boundary=2 -o setupapi.o setupapi.c
winegcc -shared -m32 setupapi.spec -o setupapi.dll setupapi.o -lusb-1.0 -ludev

and this is the compile output with your fix:

make
winegcc -c  -m32 -mincoming-stack-boundary=2 -o setupapi.o setupapi.c

In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:32:16: error: redefinition of ‘struct sockaddr’
   32 | typedef struct WS(sockaddr)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:388:16: note: originally defined here
  388 | typedef struct WS(sockaddr)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:36:3: error: conflicting types for ‘SOCKADDR’
   36 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |   ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:392:3: note: previous declaration of ‘SOCKADDR’ was here
  392 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |   ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:36:14: error: conflicting types for ‘PSOCKADDR’
   36 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |              ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:392:14: note: previous declaration of ‘PSOCKADDR’ was here
  392 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |              ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:36:26: error: conflicting types for ‘LPSOCKADDR’
   36 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |                          ^~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:392:26: note: previous declaration of ‘LPSOCKADDR’ was here
  392 | } SOCKADDR, *PSOCKADDR, *LPSOCKADDR;
      |                          ^~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:110:8: error: expected identifier before numeric constant
  110 |     WS(IPPROTO_ICMP)    = 1,
      |        ^~~~~~~~~~~~
/opt/wine-stable/include/wine/windows/ws2def.h:184:16: error: redefinition of ‘struct sockaddr_in’
  184 | typedef struct WS(sockaddr_in)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:565:16: note: originally defined here
  565 | typedef struct WS(sockaddr_in)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:190:3: error: conflicting types for ‘SOCKADDR_IN’
  190 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |   ^~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:571:3: note: previous declaration of ‘SOCKADDR_IN’ was here
  571 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |   ^~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:190:17: error: conflicting types for ‘PSOCKADDR_IN’
  190 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |                 ^~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:571:17: note: previous declaration of ‘PSOCKADDR_IN’ was here
  571 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |                 ^~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/ws2def.h:190:32: error: conflicting types for ‘LPSOCKADDR_IN’
  190 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |                                ^~~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:571:32: note: previous declaration of ‘LPSOCKADDR_IN’ was here
  571 | } SOCKADDR_IN, *PSOCKADDR_IN, *LPSOCKADDR_IN;
      |                                ^~~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:618:16: error: redefinition of ‘struct fd_set’
  618 | typedef struct WS(fd_set)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:417:16: note: originally defined here
  417 | typedef struct WS(fd_set)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:622:3: error: conflicting types for ‘fd_set’
  622 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |   ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:425:3: note: previous declaration of ‘fd_set’ was here
  425 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |   ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:622:15: error: conflicting types for ‘FD_SET’
  622 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |               ^~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:425:15: note: previous declaration of ‘FD_SET’ was here
  425 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |               ^~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:622:24: error: conflicting types for ‘PFD_SET’
  622 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |                        ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:425:24: note: previous declaration of ‘PFD_SET’ was here
  425 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |                        ^~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:622:34: error: conflicting types for ‘LPFD_SET’
  622 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |                                  ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:425:34: note: previous declaration of ‘LPFD_SET’ was here
  425 | } WS(fd_set), FD_SET, *PFD_SET, *LPFD_SET;
      |                                  ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:633:16: error: redefinition of ‘struct hostent’
  633 | typedef struct WS(hostent)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:364:16: note: originally defined here
  364 | typedef struct WS(hostent)
      |                ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:641:3: error: conflicting types for ‘HOSTENT’
  641 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |   ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:372:3: note: previous declaration of ‘HOSTENT’ was here
  372 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |   ^~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:641:13: error: conflicting types for ‘PHOSTENT’
  641 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |             ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:372:13: note: previous declaration of ‘PHOSTENT’ was here
  372 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |             ^~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:641:24: error: conflicting types for ‘LPHOSTENT’
  641 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |                        ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:372:24: note: previous declaration of ‘LPHOSTENT’ was here
  372 | } HOSTENT, *PHOSTENT, *LPHOSTENT;
      |                        ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:643:16: error: redefinition of ‘struct servent’
  643 | typedef struct WS(servent)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:345:16: note: originally defined here
  345 | typedef struct WS(servent)
      |                ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:654:3: error: conflicting types for ‘SERVENT’
  654 | } SERVENT, *PSERVENT, *LPSERVENT;
      |   ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:356:3: note: previous declaration of ‘SERVENT’ was here
  356 | } SERVENT, *PSERVENT, *LPSERVENT;
      |   ^~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:654:13: error: conflicting types for ‘PSERVENT’
  654 | } SERVENT, *PSERVENT, *LPSERVENT;
      |             ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:356:13: note: previous declaration of ‘PSERVENT’ was here
  356 | } SERVENT, *PSERVENT, *LPSERVENT;
      |             ^~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:654:24: error: conflicting types for ‘LPSERVENT’
  654 | } SERVENT, *PSERVENT, *LPSERVENT;
      |                        ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:356:24: note: previous declaration of ‘LPSERVENT’ was here
  356 | } SERVENT, *PSERVENT, *LPSERVENT;
      |                        ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:656:16: error: redefinition of ‘struct protoent’
  656 | typedef struct WS(protoent)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:267:16: note: originally defined here
  267 | typedef struct WS(protoent)
      |                ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:661:3: error: conflicting types for ‘PROTOENT’
  661 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |   ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:272:3: note: previous declaration of ‘PROTOENT’ was here
  272 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |   ^~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:661:14: error: conflicting types for ‘PPROTOENT’
  661 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |              ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:272:14: note: previous declaration of ‘PPROTOENT’ was here
  272 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |              ^~~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:661:26: error: conflicting types for ‘LPPROTOENT’
  661 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |                          ^~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:272:26: note: previous declaration of ‘LPPROTOENT’ was here
  272 | } PROTOENT, *PPROTOENT, *LPPROTOENT;
      |                          ^~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:663:16: error: redefinition of ‘struct linger’
  663 | typedef struct WS(linger)
      |                ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:394:16: note: originally defined here
  394 | typedef struct WS(linger)
      |                ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:667:3: error: conflicting types for ‘LINGER’
  667 | } LINGER, *PLINGER, *LPLINGER;
      |   ^~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:398:3: note: previous declaration of ‘LINGER’ was here
  398 | } LINGER, *PLINGER, *LPLINGER;
      |   ^~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:667:12: error: conflicting types for ‘PLINGER’
  667 | } LINGER, *PLINGER, *LPLINGER;
      |            ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:398:12: note: previous declaration of ‘PLINGER’ was here
  398 | } LINGER, *PLINGER, *LPLINGER;
      |            ^~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:667:22: error: conflicting types for ‘LPLINGER’
  667 | } LINGER, *PLINGER, *LPLINGER;
      |                      ^~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:398:22: note: previous declaration of ‘LPLINGER’ was here
  398 | } LINGER, *PLINGER, *LPLINGER;
      |                      ^~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:976:16: error: redefinition of ‘struct WSAData’
  976 | typedef struct WSAData
      |                ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:589:16: note: originally defined here
  589 | typedef struct WS(WSAData)
      |                ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:993:3: error: conflicting types for ‘WSADATA’
  993 | } WSADATA, *LPWSADATA;
      |   ^~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:606:3: note: previous declaration of ‘WSADATA’ was here
  606 | } WSADATA, *LPWSADATA;
      |   ^~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:993:13: error: conflicting types for ‘LPWSADATA’
  993 | } WSADATA, *LPWSADATA;
      |             ^~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:606:13: note: previous declaration of ‘LPWSADATA’ was here
  606 | } WSADATA, *LPWSADATA;
      |             ^~~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1019:23: error: redefinition of ‘__wine_ushort_swap’
 1019 | static inline u_short __wine_ushort_swap(u_short s)
      |                       ^~~~~~~~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:500:23: note: previous definition of ‘__wine_ushort_swap’ was here
  500 | static inline u_short __wine_ushort_swap(u_short s)
      |                       ^~~~~~~~~~~~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1023:21: error: redefinition of ‘__wine_ulong_swap’
 1023 | static inline ULONG __wine_ulong_swap(ULONG l)
      |                     ^~~~~~~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:504:21: note: previous definition of ‘__wine_ulong_swap’ was here
  504 | static inline ULONG __wine_ulong_swap(ULONG l)
      |                     ^~~~~~~~~~~~~~~~~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1109:12: error: conflicting types for ‘__WSAFDIsSet’
 1109 | int WINAPI __WSAFDIsSet(SOCKET, WS(fd_set) *);
      |            ^~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:471:12: note: previous declaration of ‘__WSAFDIsSet’ was here
  471 | int WINAPI __WSAFDIsSet(SOCKET,WS(fd_set)*);
      |            ^~~~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1111:15: error: conflicting types for ‘accept’
 1111 | SOCKET WINAPI WS(accept)(SOCKET, struct WS(sockaddr) *, int *);
      |               ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:945:15: note: previous declaration of ‘accept’ was here
  945 | SOCKET WINAPI WS(accept)(SOCKET,struct WS(sockaddr)*,int*);
      |               ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1112:12: error: conflicting types for ‘bind’
 1112 | int WINAPI WS(bind)(SOCKET, const struct WS(sockaddr) *, int);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:946:12: note: previous declaration of ‘bind’ was here
  946 | int WINAPI WS(bind)(SOCKET,const struct WS(sockaddr)*,int);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1114:12: error: conflicting types for ‘connect’
 1114 | int WINAPI WS(connect)(SOCKET, const struct WS(sockaddr) *, int);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:948:12: note: previous declaration of ‘connect’ was here
  948 | int WINAPI WS(connect)(SOCKET,const struct WS(sockaddr)*,int);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1115:29: error: conflicting types for ‘gethostbyaddr’
 1115 | struct WS(hostent) * WINAPI WS(gethostbyaddr)(const char *, int, int);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:949:28: note: previous declaration of ‘gethostbyaddr’ was here
  949 | struct WS(hostent)* WINAPI WS(gethostbyaddr)(const char*,int,int);
      |                            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1116:29: error: conflicting types for ‘gethostbyname’
 1116 | struct WS(hostent) * WINAPI WS(gethostbyname)(const char *);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:950:28: note: previous declaration of ‘gethostbyname’ was here
  950 | struct WS(hostent)* WINAPI WS(gethostbyname)(const char*);
      |                            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1121:12: error: conflicting types for ‘getpeername’
 1121 | int WINAPI WS(getpeername)(SOCKET, struct WS(sockaddr) *, int *);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:951:12: note: previous declaration of ‘getpeername’ was here
  951 | int WINAPI WS(getpeername)(SOCKET,struct WS(sockaddr)*,int*);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1122:30: error: conflicting types for ‘getprotobyname’
 1122 | struct WS(protoent) * WINAPI WS(getprotobyname)(const char *);
      |                              ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:952:29: note: previous declaration of ‘getprotobyname’ was here
  952 | struct WS(protoent)* WINAPI WS(getprotobyname)(const char*);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1123:30: error: conflicting types for ‘getprotobynumber’
 1123 | struct WS(protoent) * WINAPI WS(getprotobynumber)(int);
      |                              ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:953:29: note: previous declaration of ‘getprotobynumber’ was here
  953 | struct WS(protoent)* WINAPI WS(getprotobynumber)(int);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1124:29: error: conflicting types for ‘getservbyname’
 1124 | struct WS(servent) * WINAPI WS(getservbyname)(const char *, const char *);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:957:28: note: previous declaration of ‘getservbyname’ was here
  957 | struct WS(servent)* WINAPI WS(getservbyname)(const char*,const char*);
      |                            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1125:29: error: conflicting types for ‘getservbyport’
 1125 | struct WS(servent) * WINAPI WS(getservbyport)(int, const char *);
      |                             ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:958:28: note: previous declaration of ‘getservbyport’ was here
  958 | struct WS(servent)* WINAPI WS(getservbyport)(int,const char*);
      |                            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1126:12: error: conflicting types for ‘getsockname’
 1126 | int WINAPI WS(getsockname)(SOCKET, struct WS(sockaddr) *, int *);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:959:12: note: previous declaration of ‘getsockname’ was here
  959 | int WINAPI WS(getsockname)(SOCKET,struct WS(sockaddr)*,int*);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1133:12: error: conflicting types for ‘recvfrom’
 1133 | int WINAPI WS(recvfrom)(SOCKET, char *, int, int, struct WS(sockaddr) *, int *);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:966:12: note: previous declaration of ‘recvfrom’ was here
  966 | int WINAPI WS(recvfrom)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1135:12: error: conflicting types for ‘select’
 1135 | int WINAPI WS(select)(int, WS(fd_set) *, WS(fd_set) *, WS(fd_set) *, const struct WS(timeval) *);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:955:12: note: previous declaration of ‘select’ was here
  955 | int WINAPI WS(select)(int,WS(fd_set)*,WS(fd_set)*,WS(fd_set)*,const struct WS(timeval)*);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/winsock2.h:152,
                 from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1138:12: error: conflicting types for ‘sendto’
 1138 | int WINAPI WS(sendto)(SOCKET, const char *, int, int, const struct WS(sockaddr) *, int);
      |            ^~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:968:12: note: previous declaration of ‘sendto’ was here
  968 | int WINAPI WS(sendto)(SOCKET,const char*,int,int,const struct WS(sockaddr)*,int);
      |            ^~
In file included from setupapi.c:6:
/opt/wine-stable/include/wine/windows/winsock2.h:1218:12: error: conflicting types for ‘WSAStartup’
 1218 | int WINAPI WSAStartup(WORD,WSADATA*);
      |            ^~~~~~~~~~
In file included from /opt/wine-stable/include/wine/windows/windows.h:62,
                 from setupapi.c:4:
/opt/wine-stable/include/wine/windows/winsock.h:942:12: note: previous declaration of ‘WSAStartup’ was here
  942 | int WINAPI WSAStartup(WORD,LPWSADATA);
      |            ^~~~~~~~~~
winegcc: /usr/bin/gcc failed
make: *** [Makefile:31: setupapi.o] Error 2

I think you have missed the devel packages there, and also the :i386 packages or something is not right.

mifritscher commented 2 years ago

Hmmhmm, could be that my compiler is immune to redefinitions^^ It seems that could be a problem of https://cboard.cprogramming.com/cplusplus-programming/73181-errors-including-winsock-2-lib.html . I'll lock into it the next days.

d235j commented 4 months ago

As a rule, winsock2.h must always be included before windows.h, because otherwise windows.h will pull in winsock1 stuff. The winsock2.h on Windows prints out a warning if it's included after windows.h, but this doesn't appear to be the case on winelib.

Fixing the include order allows this to build. I haven't tested yet, but will do so soon.