【问题标题】:Error when cross-compiling libosip2 with MinGW32 (Win32)使用 MinGW32 (Win32) 交叉编译 libosip2 时出错
【发布时间】:2012-12-14 01:58:12
【问题描述】:
对不起,我英语说得不好。
我做到了;
- Windows7(64bit) + Qt(C++) + MinGW32
- 在 MSYS 中编译 libosip2-3.6.0
- #LIBS=-lpthread ./configure --enable-mt
- 修改 internal.h:在顶部附加“#define HAVE_PTHREAD_WIN32”
- # make && make install
- 编译 libeXosip2-3.6.0
我让示例代码参考 libeXosip2-3.6.0 的“sip_reg.c”
但是,多线程不起作用..(错误:“osip_thread_create() 未声明。”)有人可以帮忙吗?
【问题讨论】:
标签:
mingw
cross-compiling
【解决方案1】:
我决定使用 libosip2-4.0.0 和 libeXosip2-4.0.0
我做到了;
1.安装pthreads-w32-2-9-1-release.tar.gz
$ 清理 GC
- 并复制到 c:\develop\pthreads-w32
2.在MSYS中用MinGW32编译libosip2-4.0.0
$ ./configure LDFLAGS="-L/c/develop/pthreads-w32" CPPFLAGS="-I/c/develop/pthreads-w32" LIBS="-lpthreadGC2"
- 修改 include/osip2/internal.h:在顶部附加“#define HAVE_PTHREAD_WIN32”
- 修改 src/osip2/osip_time.c : 像这样..
#elif !defined(__PALMOS__) && 定义(WIN32)
……
静态 int _osip_gettimeofday_realtime (struct timeval *tp, void *tz)
{
返回 gettimeofday(tp, tz);
}
$ 制作 && 制作安装
3.在MSYS中用MinGW32编译libeXosip2-4.0.0
$ ./configure LDFLAGS="-L/c/develop/pthreads-w32" CPPFLAGS="-I/c/develop/pthreads-w32" LIBS="-lpthreadGC2"
- 修改 src/eXtl_tcp.c : 参考 http://www.utterspeech.com/article/random-fixes/1
#ifdef WIN32
-#include
+/* MinGW 修复:替换 Mstcpip.h */
+
+struct tcp_keepalive {
+ 超长开关;
+ 超长保活时间;
+ 超长保活间隔;
+};
+
+#define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4)
+
#万一
- 修改 src/eXtl_tcp.c : 参考 http://www.utterspeech.com/article/random-fixes/1
#ifdef WIN32
-#include
+/* MinGW 修复:#include */
#include
#万一
$ 制作 && 制作安装