Linux下移植pjsip,使用QT开发
1、移植pjsip
env:fedora14
arm-linuc-gcc:gcc version 4.5.1 (ctng-1.8.1-FA)
#./configure \
CC=arm-linux-gcc \
CROSS_COMPILE=arm-none-linux-gnueabi- \
--build=i386-linux \
--prefix=/usr/local/pjsip \
--host=arm-none-linux-gnueabi \
--target=arm-none-linux-gnueabi
#make dep
#make
#make install
2、将pjsip库加载进QT工程中
将以下库添加到pro文件中
unix:!macx:!symbian: LIBS += -L/usr/local/pjsip/lib/ -lpjsua-arm-none-linux-gnueabi \
-lpjsip-ua-arm-none-linux-gnueabi \
-lpjsip-simple-arm-none-linux-gnueabi \
-lpjsip-arm-none-linux-gnueabi \
-lpjmedia-codec-arm-none-linux-gnueabi \
-lpjmedia-videodev-arm-none-linux-gnueabi \
-lpjmedia-arm-none-linux-gnueabi \
-lpjmedia-audiodev-arm-none-linux-gnueabi \
-lpjnath-arm-none-linux-gnueabi \
-lpjlib-util-arm-none-linux-gnueabi \
-lresample-arm-none-linux-gnueabi \
-lmilenage-arm-none-linux-gnueabi \
-lsrtp-arm-none-linux-gnueabi \
-lgsmcodec-arm-none-linux-gnueabi \
-lspeex-arm-none-linux-gnueabi \
-lilbccodec-arm-none-linux-gnueabi \
-lg7221codec-arm-none-linux-gnueabi \
-lportaudio-arm-none-linux-gnueabi \
-lpj-arm-none-linux-gnueabi \
-lm \
-luuid \
-lnsl \
-lrt \
-lpthread \
-lasound
INCLUDEPATH += /usr/local/pjsip/include
DEPENDPATH += /usr/local/pjsip/include
unix:!macx:!symbian: PRE_TARGETDEPS += /usr/local/pjsip/lib/libg7221codec-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libgsmcodec-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libilbccodec-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libmilenage-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpj-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjlib-util-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjmedia-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjmedia-audiodev-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjmedia-codec-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjmedia-videodev-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjnath-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjsip-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjsip-simple-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjsip-ua-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libpjsua-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libportaudio-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libresample-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libspeex-arm-none-linux-gnueabi.a \
/usr/local/pjsip/lib/libsrtp-arm-none-linux-gnueabi.a
3、编译出错
from ../QT_PJSIP_VOIP/qt_sip.h:3,
from ../QT_PJSIP_VOIP/mainwindow.h:6,
from ../QT_PJSIP_VOIP/main.cpp:2:
/usr/local/pjsip/include/pj/config.h:1161:4: error: #error "PJ_IS_LITTLE_ENDIAN is not defined!"
/usr/local/pjsip/include/pj/config.h:1165:4: error: #error "PJ_IS_BIG_ENDIAN is not defined!"
解决:在config.h文件中宏定义
#define PJ_IS_BIG_ENDIAN 0
#define PJ_IS_LITTLE_ENDIAN 1
这样就能编译通过了。