使用MinGW32(Win32)交叉编译libosip2时出错

时间:2012-12-14 01:58:12

标签: mingw cross-compiling

抱歉,我说英语不好。

我做了;

  1. Windows7(64位)+ Qt(C ++)+ MinGW32
  2. 在MSYS中编译libosip2-3.6.0
  3. #LIBS = -lpthread ./configure --enable-mt
  4. 修改internal.h:在顶部添加“#define HAVE_PTHREAD_WIN32”
  5. #make&& make install
  6. 编译libeXosip2-3.6.0
  7. 我制作示例代码参考libeXosip2-3.6.0的“sip_reg.c”

    但是,Multi-Thread无法工作..(错误:“osip_thread_create()未声明。”)任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

我决定使用libosip2-4.0.0和libeXosip2-4.0.0

我做了;


1. Install pthreads-w32-2-9-1-release.tar.gz
$ make clean GC
- and copy to c:\develop\pthreads-w32

2. Complie libosip2-4.0.0 in MSYS with MinGW32
$ ./configure LDFLAGS="-L/c/develop/pthreads-w32" CPPFLAGS="-I/c/develop/pthreads-w32" LIBS="-lpthreadGC2"
- modify include/osip2/internal.h : append "#define HAVE_PTHREAD_WIN32" on top
- modify src/osip2/osip_time.c : like this..

    #elif !defined(__PALMOS__) && defined(WIN32)
    ....
    static int _osip_gettimeofday_realtime (struct timeval *tp, void *tz)
    {
        return gettimeofday(tp, tz);
    }

$ make && make install

3. Complie libeXosip2-4.0.0 in MSYS with MinGW32
$ ./configure LDFLAGS="-L/c/develop/pthreads-w32" CPPFLAGS="-I/c/develop/pthreads-w32" LIBS="-lpthreadGC2"
- modify src/eXtl_tcp.c : refer to http://www.utterspeech.com/article/random-fixes/1

     #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

- modify src/eXtl_tcp.c : refer to http://www.utterspeech.com/article/random-fixes/1

     #ifdef WIN32
    -#include <Mstcpip.h>
    +/* MinGW Fix:  #include <Mstcpip.h>*/
     #include <wincrypt.h>
     #endif

$ make && make install