mingw 环境编译eXosip2-3.6.0 故障解决

来源:互联网 发布:java软件系统技术合同 编辑:程序博客网 时间:2024/04/30 21:00

环境:mingw gcc 4.5.2

exosip2-3.6.0

osip2的编译过程就不说了,下面直接进正题,解决以下错误:

eXtl_udp.c:181:3: error: 'retval' undeclared (first use in this function)
eXtl_udp.c:181:3: note: each undeclared identifier is reported only once
for each function it appears in

In file included from
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/include/fcntl.h:20:0,
                 from eXtl_tcp.c:29:
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/include/io.h:443:37:
error: conflicting types for 'closesocket'
In file included from eXosip2.h:43:0,
                 from eXtl_tcp.c:25:
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.0/../../../../i686-pc-mingw32/include/winsock2.h:538:32:
note: previous declaration of 'closesocket' was here

eXtl_tcp.c:33:21: fatal error: Mstcpip.h: No such file or directory

compilation terminated.


好了,遇到这些问题,大家应该和我刚开始遇到一样,有点发晕了吧,直接上patch

retval未定义,这个简单吧:

eXtl_udp.c

--- ../../src/libeXosip2-3.6.0/src//eXtl_udp.c  2011-10-04 09:56:59 +0200+++ .patches/libeXosip2-3.6.0/src//eXtl_udp.c   2012-07-11 17:07:16 +0200@@ -178,7 +178,7 @@        res = setsockopt(udp_socket, IPPROTO_IPV6, IPV6_TCLASS,            (SOCKET_OPTION_VALUE)&tos, sizeof(tos)); #else-       retval = setsockopt(udp_socket, IPPROTO_IPV6, IP_TOS,+       res = setsockopt(udp_socket, IPPROTO_IPV6, IP_TOS,            (SOCKET_OPTION_VALUE)&tos, sizeof(tos)); #endif    }

第二个定义冲突的问题:

eXtl_tcp.c

--- ../../src/libeXosip2-3.6.0/src//eXtl_tcp.c  2011-10-05 18:43:21 +0200+++ .patches/libeXosip2-3.6.0/src//eXtl_tcp.c   2012-07-11 18:44:11 +0200@@ -22,15 +22,25 @@ #include <mpatrol.h> #endif-#include "eXosip2.h"-#include "eXtransport.h" #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif+#include "eXosip2.h"+#include "eXtransport.h"+ #ifdef WIN32-#include <Mstcpip.h>+/* MinGW Fix: Replacement for Mstcpip.h */++struct tcp_keepalive {+    ULONG onoff;+    ULONG keepalivetime;+    ULONG keepaliveinterval;+};++#define SIO_KEEPALIVE_VALS    _WSAIOW(IOC_VENDOR,4)+ #endif

eXtl_tls.c

--- ../../src/libeXosip2-3.6.0/src//eXtl_tls.c  2011-10-05 16:36:48 +0200+++ .patches/libeXosip2-3.6.0/src//eXtl_tls.c   2012-07-11 18:14:37 +0200@@ -22,8 +22,6 @@ #include <mpatrol.h> #endif-#include "eXosip2.h"-#include "eXtransport.h" #include <sys/stat.h>@@ -31,8 +29,11 @@ #include <fcntl.h> #endif+#include "eXosip2.h"+#include "eXtransport.h"+ #ifdef WIN32-#include <Mstcpip.h>
+/* MinGW Fix: Replacement for Mstcpip.h */++struct tcp_keepalive {+    ULONG onoff;+    ULONG keepalivetime;+    ULONG keepaliveinterval;+};++#define SIO_KEEPALIVE_VALS    _WSAIOW(IOC_VENDOR,4)
#include <wincrypt.h> #endif


接下来下面的编译过程就很顺利了:

编译 exosip2-3.6.0

#export LIBS='-lws2_32-lwsock32 -liphlpapi -ldnsapi -lssl32 -lcrypto -lpthread'

# ./configure --enable-openssl --enable-pthread --prefix=/usr/local/exosip2/

#make

#make install



原创粉丝点击