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

Compilation error with gcc in pjsip ld returned 1 exit status

我正在尝试使用 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

中做了一些愚蠢的事情

要编译这个:gcc -o ../bin/pjsua-x86_64-unknown-linux-gnu (...) 你忘了这两行:

-lzsrtp-x86_64-unknown-linux-gnu
-lstdc++

让我知道它是否有效,给我反馈。