Compilation 在CentOS 7上编译Shotdetect

Compilation 在CentOS 7上编译Shotdetect,compilation,ffmpeg,centos7,libavcodec,Compilation,Ffmpeg,Centos7,Libavcodec,我正在将一个服务从Debian服务器迁移到CentOS 7服务器 该服务需要Shotdetect命令(,) 尽管我遵循了所有步骤,但无法在CentOS上运行: 编译ffmpeg 安装所需的软件包 # yum install gd-devel libxml2-devel libxslt-devel clang libvpx libvorbis 在CMakeList文件的目标链接库中添加pthread,因为它在链接器错误中抛出一个lpthread missing 编译Shotdetect # F

我正在将一个服务从Debian服务器迁移到CentOS 7服务器

该服务需要Shotdetect命令(,)

尽管我遵循了所有步骤,但无法在CentOS上运行:

  • 编译ffmpeg

  • 安装所需的软件包

    # yum install gd-devel libxml2-devel libxslt-devel clang libvpx libvorbis
    
  • 在CMakeList文件的目标链接库中添加pthread,因为它在链接器错误中抛出一个lpthread missing

  • 编译Shotdetect

    # FFMPEG_DIR="/root/ffmpeg_build"  ./compile.sh cmd
    
  • 5.陷入沉思

    -- avformat library found: /root/ffmpeg_build/lib/libavformat.a
    -- avcodec library found: /root/ffmpeg_build/lib/libavcodec.a
    -- avutil library found: /root/ffmpeg_build/lib/libavutil.a
    -- swscale library found: /root/ffmpeg_build/lib/libswscale.a
    Found all FFmpeg libraries in /root/ffmpeg_build/lib/libavformat.a;/root/ffmpeg_build/lib/libavdevice.a;/root/ffmpeg_build/lib/libavcodec.a;/root/ffmpeg_build/lib/libavutil.a;/root/ffmpeg_build/lib/libswscale.a.
    -- Found GD: /usr/lib64/libgd.so
    Found libgd: /usr/lib64/libgd.so;/usr/lib64/libpng.so;/usr/lib64/libz.so;/usr/lib64/libjpeg.so in /usr/include
    Found libxml2: /usr/lib64/libxml2.so in /usr/include/libxml2
    Found libxslt: /usr/lib64/libxslt.so in /usr/include
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /root/Shotdetect-master/build
    [ 71%] Built target shotdetect
    Linking CXX executable shotdetect-cmd
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:323: undefined reference to « aacDecoder_Fill »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:329: undefined reference to « aacDecoder_DecodeFrame »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « get_stream_info »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:88: undefined reference to « aacDecoder_GetStreamInfo »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:201: undefined reference to « aacDecoder_Close »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:214: undefined reference to « aacDecoder_Open »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:221: undefined reference to « aacDecoder_ConfigRaw »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:228: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:252: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:270: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:277: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:284: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:291: encore plus de références indéfinies suivent vers « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:261: undefined reference to « aacDecoder_AncDataInit »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacdec.o): in the function « fdk_aac_decode_flush »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacdec.c:367: undefined reference to « aacDecoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:97: undefined reference to « aacEncClose »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:357: undefined reference to « aacEncEncode »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:114: undefined reference to « aacEncOpen »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:123: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:130: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:138: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:172: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:179: undefined reference to « aacEncoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:197: encore plus de références indéfinies suivent vers « aacEncoder_SetParam »
    /root/ffmpeg_build/lib/libavcodec.a(libfdk-aacenc.o): in the function « aac_encode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:276: undefined reference to « aacEncEncode »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libfdk-aacenc.c:282: undefined reference to « aacEncInfo »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:260: undefined reference to « x264_picture_init »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:262: undefined reference to « x264_bit_depth »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:246: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:289: undefined reference to « x264_encoder_delayed_frames »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:283: undefined reference to « x264_encoder_encode »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « reconfig_encoder »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:173: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:178: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:185: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:205: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:211: undefined reference to « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o):/root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:191: encore plus de références indéfinies suivent vers « x264_encoder_reconfig »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init_static »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:806: undefined reference to « x264_bit_depth »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:339: undefined reference to « x264_encoder_close »
    /root/ffmpeg_build/lib/libavcodec.a(libx264.o): in the function « X264_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:413: undefined reference to « x264_param_default »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:418: undefined reference to « x264_param_default_preset »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:440: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:470: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:514: undefined reference to « x264_levels »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:516: undefined reference to « x264_levels »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:540: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:541: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:542: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:543: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:601: undefined reference to « x264_param_apply_fastfirstpass »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:651: undefined reference to « x264_param_apply_profile »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:703: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:705: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:717: undefined reference to « x264_param_parse »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:735: undefined reference to « x264_encoder_open_148 »
    /root/ffmpeg_sources/ffmpeg/libavcodec/libx264.c:744: undefined reference to « x264_encoder_headers »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:379: undefined reference to « swr_is_initialized »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:220: undefined reference to « swr_is_initialized »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_init_resample »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:161: undefined reference to « swr_init »
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:167: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_frame »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:234: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_flush_resample »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:115: undefined reference to « swr_convert »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_subpacket »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:411: undefined reference to « swr_close »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_flush »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:614: undefined reference to « swr_close »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_close »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:638: undefined reference to « swr_free »
    /root/ffmpeg_build/lib/libavcodec.a(opusdec.o): in the function « opus_decode_init »:
    /root/ffmpeg_sources/ffmpeg/libavcodec/opusdec.c:705: undefined reference to « swr_alloc »
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [shotdetect-cmd] Error 1
    make[1]: *** [CMakeFiles/shotdetect-cmd.dir/all] Error 2
    make: *** [all] Error 2
    
    我对上述错误做了很多研究,但没有发现任何线索

    如何在CentOS7上成功编译Shotdetect

    感谢tryp,这里有一个工作的CMakelist文件: 构建的二进制文件将在构建的目录中,您可以移动到那里并执行

    make install
    

    使二进制系统更宽。

    您检查过类似问题吗

    他们建议添加一些库:

    -lswresample -lm -lz
    
    祝你好运:)

    非常感谢。我将目标链接库更改为:目标链接库(${TARGET_NAME}${FFMPEG_LIBRARIES}${LIBXML2_LIBRARIES}${LIBXSLT_LIBRARIES}${GD_LIBRARIES}“pthread”“m”“z”“/root/FFMPEG_build/lib/libswresample.a”)和附加的缺失库太多(FFMPEG_LIBRARIES${FFMPEG_LIBRARIES};/root/ffmpeg_build/lib/libswresample.a;/root/ffmpeg_build/lib/libx264.a;/lib64/libdl.so.2;/root/ffmpeg_build/lib/libfdk aac.a”)
    make install
    
    -lswresample -lm -lz