Cmake building error,trying to install gnuradio-me

2019-09-15 18:12发布

问题:

The module can be find Here I think maybe some dependencies errors occured,anyone who has an idea will be great~ What I find important is

lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed The whole list as follow:

imatrix@Zero:~/下载/GNU/ 模块/gr-mediatools-master/build$ make -j4
Scanning dependencies of target mediatools_swig_swig_doc
Scanning dependencies of target pygen_python_aead6
Scanning dependencies of target pygen_apps_9a6dd
Scanning dependencies of target gnuradio-mediatools
[  0%] Built target mediatools_swig_swig_doc
[  5%] Generating __init__.pyc
[  5%] Built target pygen_apps_9a6dd
Scanning dependencies of target _mediatools_swig_swig_tag
[ 11%] Generating __init__.pyo
[ 17%] Building CXX object swig/CMakeFiles/_mediatools_swig_swig_tag.dir/_mediatools_swig_swig_tag.cpp.o
[ 23%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_s.cc.o
[ 29%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o
[ 35%] Linking CXX executable _mediatools_swig_swig_tag
[ 35%] Built target pygen_python_aead6
[ 35%] Built target _mediatools_swig_swig_tag
[ 41%] Generating mediatools_swig.tag
Scanning dependencies of target mediatools_swig_swig_2d0df
[ 47%] Building CXX object swig/CMakeFiles/mediatools_swig_swig_2d0df.dir/mediatools_swig_swig_2d0df.cpp.o
[ 52%] Linking CXX executable mediatools_swig_swig_2d0df
Swig source
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘bool mediatools_audiosource_impl::open(std::__cxx11::string)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
         d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
                                                          ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
         d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
                                                          ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
         d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
                                                          ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
     AVCodecContext *codec;
                     ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘void mediatools_audiosource_impl::readData(std::vector<short int>&)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
         d_frame = avcodec_alloc_frame();
                                       ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);   
              ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);   
              ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:79: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
     int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);   
                                                                               ^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
                 from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
 int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
     ^
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
make[2]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
[ 52%] Built target mediatools_swig_swig_2d0df
Scanning dependencies of target pygen_swig_d4ca7
[ 64%] Generating mediatools_swig.pyc
[ 64%] Generating mediatools_swig.pyo
[ 70%] Built target pygen_swig_d4ca7
CMakeFiles/Makefile2:135: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/all' failed
make[1]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

回答1:

Your error stems from here:

gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
         d_frame = avcodec_alloc_frame();

That's because avcodec_alloc_frame has been deprecated in recent versions of ffmpeg. The gr-mediatools repository is quite old now.

Replacing avcodec_alloc_frame with av_frame_alloc in lib/mediatools_audiosource_impl.cc on line 91 might just do the trick.