libosip2 mingw32 빌드 과정 좀 봐주세요~

pogusm의 이미지

libosip2 는 SIP 라이브러리 입니다.
http://ftp.gnu.org/gnu/osip/libosip2-3.6.0.tar.gz
이곳에서 다운로드 받을 수 있습니다. (4.0도 있지만, 사정상 3.6이 필요합니다)

Win7(64bit) + MSYS(mingw32) 에서 작업하였고요
$ ./configure
$ make 하게 되면 아래와 같은 에러가 발생하게 됩니다.

...
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -Wall -Wcast-align -Wchar-subscripts -Wformat -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -g -DOSIP_MT -g -DENABLE_TRACE -g -MT ict_fsm.lo -MD -MP -MF .deps/ict_fsm.Tpo -c ict_fsm.c  -DDLL_EXPORT -DPIC -o .libs/ict_fsm.o
In file included from ict_fsm.c:20:0:
../../include/osip2/internal.h:123:3: error: conflicting types for 'osip_thread_t'
../../include/osip2/internal.h:109:19: note: previous declaration of 'osip_thread_t' was here
In file included from ict_fsm.c:20:0:
../../include/osip2/internal.h:211:3: error: conflicting types for 'osip_mutex_t'
../../include/osip2/internal.h:153:25: note: previous declaration of 'osip_mutex_t' was here
../../include/osip2/internal.h:221:3: error: conflicting types for 'osip_sem_t'
../../include/osip2/internal.h:181:15: note: previous declaration of 'osip_sem_t' was here
../../include/osip2/internal.h:256:16: error: redefinition of 'struct osip_cond'
../../include/osip2/internal.h:250:16: note: originally defined here
../../include/osip2/internal.h:259:3: error: conflicting types for 'osip_cond_t'
../../include/osip2/internal.h:252:3: note: previous declaration of 'osip_cond_t' was here
make[3]: *** [ict_fsm.lo] Error 1
make[3]: Leaving directory `/c/Users/m/Desktop/libosip2-3.6.0/src/osip2'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/c/Users/m/Desktop/libosip2-3.6.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/c/Users/m/Desktop/libosip2-3.6.0'
make: *** [all] Error 2

에러 해결을 위해
internal.h 파일 최상단에
#define HAVE_PTHREAD_WIN32
추가후
$ make 하여 빌드에 성공하였습니다.

질문1. 위와 같이 빌드해도 큰 문제가 없을까요?
질문2. pthreads-w32 를 설치하고 아래와 같이 빌드 옵션을 주면 pthread가 제대로 적용이 되는걸까요?
$ ./configure LDFLAGS="-L/c/develop/pthreads-w32" CPPFLAGS="-I/c/develop/pthreads-w32" LIBS="-lpthreadGC2"
(메시지가 너무 많아서 잘 모르겠습니다 ㅠㅠ)

pogusm의 이미지

4.0 버전도 있지만, 3.6 버전을 선택한 이유.

libosip2 + libeXosip2 두개의 라이브러리를 함께 사용해야 하는데,
다음과 같은 문제가 있습니다. (win7 + MSYS(mingw32) 환경)

libosip2-3.6.0 ----- 소스코드 일부 수정후 빌드 됨
libeXosip2-3.6.0 ----- 소스코드 일부 수정후 빌드 됨

libosip2-4.0.0 ----- 소스코드 일부 수정후 빌드 됨
libeXosip2-4.0.0 ----- 빌드 안됨 ㅠㅠ (도저히 해결책을 찾을 수가 없었습니다 ㅠㅠ)

이래서... 3.6버전을 선택하게 되었습니다.

pogusm의 이미지

internal.h 파일의 일부 내용입니다.

/* Pthreads support: */
/* - Unix: native Pthreads. */
/* - Win32: Pthreads for Win32 (<a href="http://sources.redhat.com/pthreads-win32" rel="nofollow">http://sources.redhat.com/pthreads-win32</a>). */
#if defined(HAVE_PTHREAD) || defined(HAVE_PTHREAD_H) || defined(HAVE_PTH_PTHREAD_H) || \
    defined(HAVE_PTHREAD_WIN32)
#if defined(__arc__)
#include <ucos_ii_api.h>
#endif
 
 
#include <pthread.h>
typedef pthread_t osip_thread_t;
#endif
 
/* Windows without Pthreads for Win32 */
#if (defined(WIN32) || defined(_WIN32_WCE)) && !defined(HAVE_PTHREAD_WIN32)
 
/* Prevent the inclusion of winsock.h */
#define _WINSOCKAPI_
#include <windows.h>
#undef _WINSOCKAPI_
 
typedef struct {
    HANDLE h;
    unsigned id;
} osip_thread_t;
#endif

왜 이부분에서 오류가 나는 걸까요?

익명 사용자의 이미지

1. #include 위나 아래에 #define HAVE_PTHREAD_WIN32를 넣어주는 것이 그나마 쉬운 땜질 방법입니다.

2. MinGW 패키지에 pthread는 기본으로 들어 있으니 pthreads-w32는 필요없습니다.
libosip2 configure 과정에서 -lpthread만 추가해 주면 됩니다.

# LIBS=-lpthread ./configure
# make

익명 사용자의 이미지

1. #include <pthread.h> 위나 아래에 #define HAVE_PTHREAD_WIN32를 넣어주는 것이 그나마 쉬운 땜질 방법입니다.
pogusm의 이미지

저는 QT(c++) 에서 함께 배포되는 mingw를 사용해 왔는데...
pthread 가 없던거 같은데... (특히 DLL 파일이 없던거 같은데...)

MinGW 를 따로 받아서 설치해보고 확인해 봐야겠습니다.

감사합니다.

pogusm의 이미지

아무리 해봐도...
Multi-Thread 가 적용되지 않는거 같습니다. ( osip_thread_create 함수를 사용할 수 없습니다 )

# LIBS=-lpthread ./configure --enable-mt CFLAGS="-UOSIP_MT"
위처럼 해도 마찬가지네요... (windows7(64bit), QT(c++), MingW32 환경입니다)

조금만 도와주시면 감사하겠습니다. 꾸벅~

pogusm의 이미지

1. pthreads-w32-2-9-1 설치
$ make clean GC
c:\develop\pthreads-w32 으로 복사

2. libosip2-4.0.0 컴파일 (MSYS with MinGW32)
$ ./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 파일 중 _osip_gettimeofday_realtime 함수를 아래와 같이 수정

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

$ make && make install

3. libeXosip2-4.0.0 컴파일 (MSYS with MinGW32)
$ ./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 <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

- src/eXtl_tcp.c 파일 수정 (참고: 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

문제 있는 부분 지적 부탁드립니다..

익명 사용자의 이미지

http://www.mingw.org/wiki/Getting_Started 문서에 따라 설치해 보시기 바랍니다.
MinGW 역시 pthread-w32를 사용하며 설치 프로그램에서 설치할 수 있습니다.
정상 설치 상태라면 linux에서와 마찬가지로 pthread 옵션은 -lpthread 만으로 충분합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.