我想用SRTP库编译星号,但是在配置星号代码时,出现此错误:
checking for the ability of -lsrtp to be linked in a shared object... no
configure: WARNING: ***
configure: WARNING: *** libsrtp could not be linked as a shared object.
configure: WARNING: *** Try compiling libsrtp manually. Configure libsrtp
configure: WARNING: *** with ./configure CFLAGS=-fPIC --prefix=/usr
configure: WARNING: *** replacing /usr with the prefix of your choice.
configure: WARNING: *** After re-installing libsrtp
configure: WARNING: *** configure script.
configure: WARNING: ***
configure: WARNING: *** If you do not need SRTP support re-run configure
configure: WARNING: *** with the --without-srtp option.
这也是检查此规则的代码:
if test "$PBX_SRTP" = "1";
then
saved_libs="${LIBS}"
saved_ldflags="${LDFLAGS}"
LIBS="${LIBS} -lsrtp"
LDFLAGS="${LDFLAGS} -shared -fPIC"
AC_MSG_CHECKING(for the ability of -lsrtp to be linked in a shared object)
AC_LINK_IFELSE(
[
AC_LANG_PROGRAM(
[#include <srtp/srtp.h>],
[srtp_init();]
)
],
[ AC_MSG_RESULT(yes) ],
[
AC_MSG_RESULT(no)
AC_MSG_NOTICE(***)
AC_MSG_NOTICE(*** libsrtp could not be linked as a shared object)
AC_MSG_NOTICE(*** try compiling libsrtp manually and configuring with)
AC_MSG_NOTICE(*** ./configure CFLAGS=-fPIC --prefix=/usr)
AC_MSG_NOTICE(*** replacing /usr with the prefix of your choice)
exit 1
]
)
LIBS="${saved_libs}"
LDFLAGS="${saved_ldflags}"
fi
提交详细信息:https://reviewboard.asterisk.org/r/857/diff/
我尝试使用多个前缀来编译libsrtp代码,但得到的结果相同。
有什么建议吗?
最佳答案
警告说它不能与libsrtp链接,因为libsrtp的代码需要可重定位,就像共享库一样,而且看来您正在将libsrtp编译为静态库,我会按照建议执行并重新构建 libsrtp 使用:
./configure CFLAGS=-fPIC
我在这里也尝试过,并且有效,请注意,在构建libsrtp时我使用了默认前缀/use/local/lib
./configure --with-srtp=/usr/local/lib
checking for srtp_init in -lsrtp... yes
checking srtp/srtp.h usability... yes
checking srtp/srtp.h presence... yes
checking for srtp/srtp.h... yes
checking for the ability of -lsrtp to be linked in a shared object... yes
关于c++ - 使用libsrtp编译 Asterisk 时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12615739/