1) make menuconfig 配置
在Libraries->telephony子菜单中选中: libpjsua
2)因为要支持ALSA声卡, 所以修改了package/feeds/telephony/pjproject/Makefile文件如下:
#增加对声卡和PCM重采样库的支持
DEPENDS:=+libopenssl +libuuid +libstdcpp +libpthread +libasound.so.2 +libsamplerate
#configure参数修改如下:
CONFIGURE_ARGS += \
$(if $(CONFIG_SOFT_FLOAT),--disable-floating-point) \
--enable-epoll \
--disable-bcg729 \
--disable-ext-sound \
--disable-ffmpeg \
--enable-g711-codec \
--disable-g722-codec \
--disable-g7221-codec \
--disable-gsm-codec \
--disable-ilbc-codec \
--disable-ipp \
--disable-l16-codec \
--disable-libwebrtc \
--disable-libyuv \
--disable-opencore-amr \
--disable-openh264 \
--disable-opus \
--disable-oss \
--enable-libsamplerate \ ##使用libsamplerate
--enable-resample \ ##支持resample
--disable-sdl \
--disable-silk \
--enable-sound \ #######支持alsa声卡
--disable-speex-aec \
--disable-speex-codec \
--disable-v4l2 \
--disable-video \
--disable-ssl \
--enable-shared \
--with-external-srtp="$(STAGING_DIR)/usr" \
--with-ssl="$(STAGING_DIR)/usr" \
--without-external-gsm \
--without-external-pa \
--without-external-webrtc
最终编译openwrt固件时提示如下的错误:
Package libpj is missing dependencies for the following libraries:
libasound.so.2
网上搜索了以下, 找到了这篇: https://blog.csdn.net/fickyou/article/details/52794300
《Openwrt Package xxx is missing dependencies for the following libraries 问题分析》
提供了思路, 但是不解决问题,provides文件根本就每产生, 偶然手痒, 打开文件: include/package-ipkg.mk
按文章的提示, 找到CheckDependencies函数, 修改如下:
ifneq ($(PKG_NAME),toolchain)
define CheckDependencies
@( \
rm -f $(PKG_INFO_DIR)/$(1).missing; \
( \
export \
READELF=$(TARGET_CROSS)readelf \
OBJCOPY=$(TARGET_CROSS)objcopy \
XARGS="$(XARGS)"; \
$(SCRIPT_DIR)/gen-dependencies.sh "$$(IDIR_$(1))"; \
) | while read FILE; do \
grep -qxF "$$$$FILE" $(PKG_INFO_DIR)/$(1).provides || \
echo "$$$$FILE" >> $(PKG_INFO_DIR)/$(1).missing; \
done; \
if [ -f "$(PKG_INFO_DIR)/$(1).missing" ]; then \
echo "Package $(1) is missing dependencies for the following libraries:" >&2; \
cat "$(PKG_INFO_DIR)/$(1).missing" >&2; \
false; \
fi; \
echo "*********************************************************" \ ##在这里加了一行
)
endef
endif
然后编译固件, 通过了,神奇啊! 哪位大侠能告诉我为什么?