2012-09-27 25 views
2

我想编译SRTP库,但在配置星号密码的星号,我得到这个错误:错误编制星号与libsrtp

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代码的几个前缀,但我得到了相同的结果。 有什么建议吗?

回答

1

一个简单的调用srtp_init()构建脚本检查以编译,以这种有效,你应该有包含<srtp>在路径上的文件夹包括文件和链接器的路径中创建.a库。因此在创建libsrtp后,将前缀放在链接器路径中

6

警告说它无法与libsrtp链接,因为libsrtp的代码需要可重定位,就像共享库一样,并且您似乎将libsrtp编译为一个静态库,我愿意做,因为它暗示和重新使用建libsrtp

./configure CFLAGS=-fPIC 

我也试过,在这里,它的工作,请注意,我用的默认前缀/在构建libsrtp时使用/ 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 
5

在SRTP文件夹:

make uninstall 
make clean 
./configure CFLAGS=-fPIC --prefix=/usr/local/lib 
make 
make runtest 
make install 
Asterisk的文件夹

cd ../../asterisk/asterisk-11.3.0/ 
./configure --with-srtp=/usr/local/lib 

这为我工作

+0

这为我工作。谢谢。 – Lavixu