2

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

4

3 回答 3

6

警告说它无法与 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
于 2012-10-08T15:51:05.153 回答
6

在 SRTP 文件夹中:

make uninstall
make clean
./configure CFLAGS=-fPIC --prefix=/usr/local/lib
make
make runtest
make install

在星号文件夹中:

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

这对我有用

于 2013-04-18T01:56:28.893 回答
1

构建脚本检查一个简单的调用是否srtp_init()可编译,为了使其有效,您应该有一个文件夹,该文件夹包含<srtp>在包含文件的路径中,并在链接器的路径中创建了.a库。所以在创建后libsrtp把你的前缀放在链接器路径中

于 2012-10-03T18:54:04.250 回答