libosip2 mingw32 빌드 과정 좀 봐주세요~
글쓴이: pogusm / 작성시간: 목, 2012/12/13 - 12:14오후
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"
(메시지가 너무 많아서 잘 모르겠습니다 ㅠㅠ)
Forums:
추가
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버전을 선택하게 되었습니다.
추가
internal.h 파일의 일부 내용입니다.
왜 이부분에서 오류가 나는 걸까요?
HAVE_PTHREAD_WIN32 문제는 프로그램 버그입니다.
1. #include 위나 아래에 #define HAVE_PTHREAD_WIN32를 넣어주는 것이 그나마 쉬운 땜질 방법입니다.
2. MinGW 패키지에 pthread는 기본으로 들어 있으니 pthreads-w32는 필요없습니다.
libosip2 configure 과정에서 -lpthread만 추가해 주면 됩니다.
# LIBS=-lpthread ./configure
# make
.
답변 감사합니다.
저는 QT(c++) 에서 함께 배포되는 mingw를 사용해 왔는데...
pthread 가 없던거 같은데... (특히 DLL 파일이 없던거 같은데...)
MinGW 를 따로 받아서 설치해보고 확인해 봐야겠습니다.
감사합니다.
조금만 더 도움을 바랍니다...
아무리 해봐도...
Multi-Thread 가 적용되지 않는거 같습니다. ( osip_thread_create 함수를 사용할 수 없습니다 )
# LIBS=-lpthread ./configure --enable-mt CFLAGS="-UOSIP_MT"
위처럼 해도 마찬가지네요... (windows7(64bit), QT(c++), MingW32 환경입니다)
조금만 도와주시면 감사하겠습니다. 꾸벅~
어설프지만 자답입니다..
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 함수를 아래와 같이 수정
$ 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 )
- src/eXtl_tcp.c 파일 수정 (참고: http://www.utterspeech.com/article/random-fixes/1 )
$ make && make install
문제 있는 부분 지적 부탁드립니다..
MinGW 설치를 잘못한 듯 합니다.
http://www.mingw.org/wiki/Getting_Started 문서에 따라 설치해 보시기 바랍니다.
MinGW 역시 pthread-w32를 사용하며 설치 프로그램에서 설치할 수 있습니다.
정상 설치 상태라면 linux에서와 마찬가지로 pthread 옵션은 -lpthread 만으로 충분합니다.
댓글 달기