我已经通过make命令为Android成功构建了CSipSimple。之后,当我尝试通过调用make VideoLibs命令来构建视频支持库时,出现错误。

[armeabi] SharedLibrary  : libpj_video_android.so
[armeabi-v7a] SharedLibrary  : libpj_video_android.so
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1086: error: undefined reference to 'av_strerror'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1324: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1325: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1328: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1329: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1430: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1455: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1460: error: undefined reference to 'avcodec_encode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:409: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:427: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:434: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:442: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:445: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1116: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1125: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1185: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1200: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1222: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1223: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1228: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1229: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1680: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1683: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1705: error: undefined reference to 'avcodec_decode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:629: error: undefined reference to 'avcodec_register_all'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:172: error: undefined reference to 'sws_freeContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:152: error: undefined reference to 'sws_scale'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:112: error: undefined reference to 'sws_getContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:113: error: undefined reference to 'av_log_get_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:88: error: undefined reference to 'av_log_set_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:89: error: undefined reference to 'av_log_set_callback'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:90: error: undefined reference to 'av_register_all'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi/libpj_video_android.so] Error 1
make[1]: *** Waiting for unfinished jobs....
[armeabi-v7a] Install        : libpjsipjni.so => ./libs/armeabi-v7a/libpjsipjni.so
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1086: error: undefined reference to 'av_strerror'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1324: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1325: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1328: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1329: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1430: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1455: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1460: error: undefined reference to 'avcodec_encode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:409: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:427: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:434: error: undefined reference to 'av_opt_set_int'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:442: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:445: error: undefined reference to 'av_opt_set'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1116: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1125: error: undefined reference to 'avcodec_alloc_context3'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1185: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1200: error: undefined reference to 'avcodec_open2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1222: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1223: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1228: error: undefined reference to 'avcodec_close'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1229: error: undefined reference to 'av_free'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1680: error: undefined reference to 'avcodec_get_frame_defaults'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1683: error: undefined reference to 'av_init_packet'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:1705: error: undefined reference to 'avcodec_decode_video2'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:629: error: undefined reference to 'avcodec_register_all'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia-codec/ffmpeg_vid_codecs.c:632: error: undefined reference to 'av_codec_next'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:172: error: undefined reference to 'sws_freeContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:152: error: undefined reference to 'sws_scale'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/converter_libswscale.c:112: error: undefined reference to 'sws_getContext'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:113: error: undefined reference to 'av_log_get_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:88: error: undefined reference to 'av_log_set_level'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:89: error: undefined reference to 'av_log_set_callback'
jni/pjsip/android_toolchain/pjmedia/../../sources/pjmedia/src/pjmedia/ffmpeg_util.c:90: error: undefined reference to 'av_register_all'
collect2: error: ld returned 1 exit status
make[1]: *** [obj/local/armeabi-v7a/libpj_video_android.so] Error 1
make[1]: Leaving directory `/home/alexchengalan/android/files/CSipSimple-trunk/CSipSimple'
make: *** [VideoLibs] Error 2


如果有人可以帮助我解决这个问题,那就太好了。

最佳答案

修改jni \ pjsip \ android_toolchain \ pjmedia \ Video.mk;那没关系的

# Ffmpeg codec
BASE_FFMPEG_BUILD_DIR :=  $(LOCAL_PATH)/../../../ffmpeg/build/ffmpeg/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_FFMPEG_BUILD_DIR)/libavcodec.a \
        $(BASE_FFMPEG_BUILD_DIR)/libavformat.a \
        $(BASE_FFMPEG_BUILD_DIR)/libswscale.a \
        $(BASE_FFMPEG_BUILD_DIR)/libavutil.a

# Add X264
BASE_X264_BUILD_DIR :=  $(LOCAL_PATH)/../../../ffmpeg/build/x264/$(TARGET_ARCH_ABI)/lib
LOCAL_LDLIBS += $(BASE_X264_BUILD_DIR)/libx264.a


有关详细信息,请参见:(https://groups.google.com/forum/#!topic/csipsimple-dev/bSauDx-hnR0

10-07 19:35