Search code examples
makefilepjsipmingw32msys2

Build pjsip 2.10 using msys2


I'm compiling pjsip 2.10 using msys2:
1) open msys2 console: C:\msys64\msys2_shell.cmd
2) Run those to update:

pacman -Sy
pacman --needed -S bash pacman pacman-mirrors msys2-runtime
pacman -Su
pacman -S perl
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
pacman -S base-devel

3) Restart msys2 console
4) export PATH="/c/msys64/mingw32/bin/:$PATH"
5) Config:

./configure --prefix=$PWD/dist_mingw --disable-ffmpeg --enable-shared --disable-video --disable-speex-aec --disable-speex-aec --disable-g711-codec --disable-l16-codec --disable-gsm-codec --disable-g722-codec --disable-g7221-codec --disable-speex-codec --disable-ilbc-codec --disable-vpx --disable-opus --disable-libyuv --disable-libwebrtc

6) make CFLAGS+="-DPJ_WIN32=1 -DPJ_M_I386=1 -D_LIB -DWIN32 -DPJ_M_I386=1"
7) But error:

output/pjlib-x86_64-pc-msys/log.o:log.c:(.text+0xcb): undefined reference to `pj_time_decode'
output/pjlib-x86_64-pc-msys/ssl_sock_ossl.o:ssl_sock_ossl.c:(.text+0x205): undefined reference to `pj_time_encode'
output/pjlib-x86_64-pc-msys/ssl_sock_dump.o:ssl_sock_dump.c:(.text+0x9c): undefined reference to `pj_time_decode'
output/pjlib-x86_64-pc-msys/ssl_sock_dump.o:ssl_sock_dump.c:(.text+0xb2): undefined reference to `pj_time_decode'

8) As I see pj_time_encode is in pjproject-2.10\pjlib\src\pj\os_time_win32.cbut this file is not compiled. Instead, file os_time_unix.c was compiled. I think this is the cause. So how to make the file os_time_win32.c be compiled instead of os_time_unix.c.
I'm not good in makefile so this is hard to me to custom the build. Thank you very much!


Solution

  • In my MSYS environment PJSIP 2.10 compiles fine with (replace x86_64-w64-mingw32 with i686-w64-mingw32 for 32-bit):

    ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-shared --enable-libsamplerate --with-external-speex --with-external-gsm --with-external-srtp --with-external-pa &&
    make dep &&
    make &&
    echo SUCCESS
    

    I did compile the dependancies first myself, hence the with-external- flags.