pjsip ld中gcc的编译错误返回1退出状态

时间:2016-02-11 18:24:38

标签: c gcc compilation pjsip

我正在尝试用ZRTP4PJ编译pjsip,我发现了一个问题

> gcc -c -DPJ_AUTOCONF=1 -O2 -DPJ_IS_BIG_ENDIAN=0
> -DPJ_IS_LITTLE_ENDIAN=1  -DPJMEDIA_HAS_LIBAVCODEC=1 -DPJMEDIA_HAS_LIBSWSCALE=1 -DPJMEDIA_HAS_LIBAVUTIL=1    -enter code hereDPJMEDIA_VIDEO_DEV_HAS_V4L2=1      -DPJMEDIA_HAS_LIBAVCODEC=1
> -DPJMEDIA_HAS_LIBSWSCALE=1 -DPJMEDIA_HAS_LIBAVUTIL=1    -DPJMEDIA_VIDEO_DEV_HAS_V4L2=1     -I/home/aa/ma/pjproject-2.4.5/pjlib/include -I/home/aa/ma/pjproject-2.4.5/pjlib-util/include -I/home/aa/ma/pjproject-2.4.5/pjnath/include -I/home/aa/ma/pjproject-2.4.5/pjmedia/include -I/home/aa/ma/pjproject-2.4.5/pjsip/include   -o output/pjsua-x86_64-unknown-linux-gnu/pjsua_app.o
> ../src/pjsua/pjsua_app.c
../src/pjsua/pjsua_app.c:21:28: fatal error: transport_zrtp.h: Ficheiro ou directoria inexistente
 #include <transport_zrtp.h>
                            ^
compilation terminated.

要解决这个问题,我添加

-I/home/aa/ma/pjproject-2.4.5/third_party/ZRTP4PJ/build/zsrtp/../../zsrtp/include 
-I/home/aa/ma/pjproject-2.4.5/third_party/ZRTP4PJ/build/zsrtp/../../zsrtp/zrtp/zrtp

在我需要将完成上面编译的pjsua_app.o添加到下一个命令之后:

gcc -o ../bin/pjsua-x86_64-unknown-linux-gnu      output/pjsua-x86_64-unknown-linux-gnu/main.o  output/pjsua-x86_64-unknown-linux-gnu/pjsua_app.o  output/pjsua-x86_64-unknown-linux-gnu/pjsua_app_cli.o  output/pjsua-x86_64-unknown-linux-gnu/pjsua_app_common.o  output/pjsua-x86_64-unknown-linux-gnu/pjsua_app_config.o  output/pjsua-x86_64-unknown-linux-gnu/pjsua_app_legacy.o -L/home/aa/ma/pjproject-2.4.5/pjlib/lib -L/home/aa/ma/pjproject-2.4.5/pjlib-util/lib -L/home/aa/ma/pjproject-2.4.5/pjnath/lib -L/home/aa/ma/pjproject-2.4.5/pjmedia/lib -L/home/aa/ma/pjproject-2.4.5/pjsip/lib -L/home/aa/ma/pjproject-2.4.5/third_party/lib  -lavcodec -lswscale -lavutil   -lv4l2    -lavcodec -lswscale -lavutil   -lv4l2    -lpjsua-x86_64-unknown-linux-gnu -lpjsip-ua-x86_64-unknown-linux-gnu -lpjsip-simple-x86_64-unknown-linux-gnu -lpjsip-x86_64-unknown-linux-gnu -lpjmedia-codec-x86_64-unknown-linux-gnu -lpjmedia-x86_64-unknown-linux-gnu -lpjmedia-videodev-x86_64-unknown-linux-gnu -lpjmedia-audiodev-x86_64-unknown-linux-gnu -lpjmedia-x86_64-unknown-linux-gnu -lpjnath-x86_64-unknown-linux-gnu -lpjlib-util-x86_64-unknown-linux-gnu  -lsrtp-x86_64-unknown-linux-gnu -lresample-x86_64-unknown-linux-gnu -lgsmcodec-x86_64-unknown-linux-gnu -lspeex-x86_64-unknown-linux-gnu -lilbccodec-x86_64-unknown-linux-gnu -lg7221codec-x86_64-unknown-linux-gnu -lportaudio-x86_64-unknown-linux-gnu  -lpj-x86_64-unknown-linux-gnu -lssl -lcrypto -lm -lrt -lpthread  -lasound  -lavcodec -lswscale -lavutil   -lv4l2

我收到以下错误:

output/pjsua-x86_64-unknown-linux-gnu/pjsua_app.o: na função `on_create_media_transport':
pjsua_app.c:(.text+0x2ca): referência indefinida a `pjmedia_transport_zrtp_create'
pjsua_app.c:(.text+0x2e0): referência indefinida a `pjmedia_transport_zrtp_setUserCallback'
pjsua_app.c:(.text+0x2f4): referência indefinida a `pjmedia_transport_zrtp_initialize'
collect2: error: ld returned 1 exit status

任何想法如何解决问题? 显然我在第一个gcc中做了一些愚蠢的事情

1 个答案:

答案 0 :(得分:2)

要编译:{{1​​}} 你忘记了这两行:

gcc -o ../bin/pjsua-x86_64-unknown-linux-gnu (...)

如果有效,请告诉我,给我反馈。