[Spice-devel] [PATCH 4/4] mingw: include <winsock2.h> and link to ws2_32
Fabiano FidĂȘncio
fidencio at redhat.com
Wed Oct 7 07:56:19 PDT 2015
On Wed, Oct 7, 2015 at 3:14 PM, Frediano Ziglio <fziglio at redhat.com> wrote:
>>
>> Otherwise the following errors can be faced:
>> src/vscclient-vscclient.o: In function `send_msg':
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:122: undefined
>> reference to `_imp__htonl at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:124: undefined
>> reference to `_imp__htonl at 4'
>> src/vscclient-vscclient.o: In function `on_host_init':
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:260: undefined
>> reference to `_imp__ntohl at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:273: undefined
>> reference to `_imp__ntohl at 4'
>> src/vscclient-vscclient.o: In function `do_socket_read':
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:332: undefined
>> reference to `_imp__ntohl at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:333: undefined
>> reference to `_imp__ntohl at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:334: undefined
>> reference to `_imp__ntohl at 4'
>> src/vscclient-vscclient.o: In function `connect_to_qemu':
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:615: undefined
>> reference to `_imp__socket at 12'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:628: undefined
>> reference to `_imp__getaddrinfo at 16'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:636: undefined
>> reference to `_imp__connect at 12'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:645: undefined
>> reference to `_imp__freeaddrinfo at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:650: undefined
>> reference to `_imp__freeaddrinfo at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:652: undefined
>> reference to `_imp__closesocket at 4'
>> src/vscclient-vscclient.o: In function `main':
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:676: undefined
>> reference to `_imp__WSAStartup at 8'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:677: undefined
>> reference to `_imp__WSAGetLastError at 0'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:778: undefined
>> reference to `_imp__htonl at 4'
>> /home/ffidenci/src/upstream/libcacard/src/vscclient.c:791: undefined
>> reference to `_imp__closesocket at 4'
>> collect2: error: ld returned 1 exit status
>> Makefile:656: recipe for target 'vscclient.exe' failed
>> make[2]: *** [vscclient.exe] Error 1
>> make[2]: Leaving directory '/home/ffidenci/src/upstream/libcacard'
>> Makefile:774: recipe for target 'all-recursive' failed
>> make[1]: *** [all-recursive] Error 1
>> make[1]: Leaving directory '/home/ffidenci/src/upstream/libcacard'
>> Makefile:495: recipe for target 'all' failed
>> make: *** [all] Error 2
>> ---
>> Makefile.am | 4 ++++
>> src/vscclient.c | 1 +
>> 2 files changed, 5 insertions(+)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index eea8daa..bbe8e2e 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -40,6 +40,10 @@ libcacard_la_LDFLAGS = \
>> $(WARN_LDFLAGS)
>> $(NULL)
>>
>> +#if OS_WIN32
>> +libcacard_la_LIBADD += -lws2_32
>> +#endif
>> +
>> pkgconfigdir = $(libdir)/pkgconfig
>> pkgconfig_DATA = libcacard.pc
>>
>> diff --git a/src/vscclient.c b/src/vscclient.c
>> index 24015ef..fea5aea 100644
>> --- a/src/vscclient.c
>> +++ b/src/vscclient.c
>> @@ -21,6 +21,7 @@
>> #define closesocket(x) close(x)
>> #else
>> #include <ws2tcpip.h>
>> +#include <winsock2.h>
>> #include <getopt.h>
>> #endif
>>
>
> I don't remember why but is better to include ws2tcpip.h after winsock2.h
Okay, locally fixed, thanks!
More information about the Spice-devel
mailing list