Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with "error: ‘av_register_all’ was not declared in this scope" #1411

Open
TylerTheHumanCompiler opened this issue Apr 30, 2024 · 3 comments

Comments

@TylerTheHumanCompiler
Copy link

Build fails with the following error:

[100/308] Compiling src/essentia/utils/audiocontext.cpp
../src/essentia/utils/audiocontext.cpp: In constructor ‘essentia::AudioContext::AudioContext()’:
../src/essentia/utils/audiocontext.cpp:33:3: error: ‘av_register_all’ was not declared in this scope
   33 |   av_register_all(); // this should be done once only..
      |   ^~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp: In member function ‘int essentia::AudioContext::create(const std::string&, const std::string&, int, int, int)’:
../src/essentia/utils/audiocontext.cpp:48:53: error: invalid conversion from ‘const AVOutputFormat*’ to ‘AVOutputFormat*’ [-fpermissive]
   48 |   AVOutputFormat* av_output_format = av_guess_format(format.c_str(), 0, 0);
      |                                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     const AVOutputFormat*
../src/essentia/utils/audiocontext.cpp:67:42: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
   67 |   _codecCtx                 = _avStream->codec;
      |                                          ^~~~~
@DarshReddy
Copy link

I am getting same errors when trying to compile for android

../src/essentia/utils/audiocontext.cpp:33:3: error: use of undeclared identifier 'av_register_all'
   33 |   av_register_all(); // this should be done once only..
      |   ^
../src/essentia/utils/audiocontext.cpp:48:19: error: cannot initialize a variable of type 'AVOutputFormat *' with an rvalue of type 'const AVOutputFormat *'
   48 |   AVOutputFormat* av_output_format = av_guess_format(format.c_str(), 0, 0);
      |                   ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp:67:42: error: no member named 'codec' in 'AVStream'
   67 |   _codecCtx                 = _avStream->codec;
      |                               ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:72:14: error: no member named 'channels' in 'AVCodecContext'
   72 |   _codecCtx->channels       = nChannels;
      |   ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:73:14: error: no member named 'channel_layout' in 'AVCodecContext'
   73 |   _codecCtx->channel_layout = av_get_default_channel_layout(nChannels);
      |   ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:73:31: error: use of undeclared identifier 'av_get_default_channel_layout'
   73 |   _codecCtx->channel_layout = av_get_default_channel_layout(nChannels);
      |                               ^
../src/essentia/utils/audiocontext.cpp:77:12: error: cannot initialize a variable of type 'AVCodec *' with an rvalue of type 'const AVCodec *'
   77 |   AVCodec* audioCodec = avcodec_find_encoder(_codecCtx->codec_id);
      |            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/essentia/utils/audiocontext.cpp:125:49: error: no member named 'channels' in 'AVCodecContext'
  125 |       _codecCtx->frame_size = 4096 / _codecCtx->channels / av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);
      |                                      ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:140:57: error: no member named 'channels' in 'AVCodecContext'
  140 |                                              _codecCtx->channels, 
      |                                              ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:145:20: error: no member named 'filename' in 'AVFormatContext'
  145 |   strncpy(_muxCtx->filename, _filename.c_str(), sizeof(_muxCtx->filename));
      |           ~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:145:65: error: no member named 'filename' in 'AVFormatContext'
  145 |   strncpy(_muxCtx->filename, _filename.c_str(), sizeof(_muxCtx->filename));
      |                                                        ~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:151:65: error: no member named 'channel_layout' in 'AVCodecContext'
  151 |   av_opt_set_int(_convertCtxAv, "in_channel_layout", _codecCtx->channel_layout, 0);
      |                                                      ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:152:66: error: no member named 'channel_layout' in 'AVCodecContext'
  152 |   av_opt_set_int(_convertCtxAv, "out_channel_layout", _codecCtx->channel_layout, 0);
      |                                                       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:194:28: error: no member named 'codec' in 'AVStream'
  194 |   avcodec_close(_avStream->codec);
      |                 ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:198:24: error: no member named 'codec' in 'AVStream'
  198 |   av_freep(&_avStream->codec);
      |             ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:218:18: error: no member named 'channels' in 'AVCodecContext'
  218 |   if (_codecCtx->channels != 2) {
      |       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:219:100: error: no member named 'channels' in 'AVCodecContext'
  219 |     throw EssentiaException("Trying to write stereo audio data to an audio file with ", _codecCtx->channels, " channels");
      |                                                                                         ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:243:18: error: no member named 'channels' in 'AVCodecContext'
  243 |   if (_codecCtx->channels != 1) {
      |       ~~~~~~~~~  ^
../src/essentia/utils/audiocontext.cpp:244:98: error: no member named 'channels' in 'AVCodecContext'
  244 |     throw EssentiaException("Trying to write mono audio data to an audio file with ", _codecCtx->channels, " channels");
      |                                                                                       ~~~~~~~~~  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Waf: Leaving directory `/Users/darshreddy/Artium/essentia/build'
Build failed
 -> task in 'essentia' failed with exit status 1: 
	{task 4391454768: cxx audiocontext.cpp -> audiocontext.cpp.1.o}
['/usr/bin/clang++', '-std=c++11', '-pipe', '-Wall', '-O2', '-fPIC', '-std=c++11', '-I/usr/local/include', '-w', '-fPIC', '-Isrc', '-I../src', '-Isrc/essentia', '-I../src/essentia', '-Isrc/essentia/scheduler', '-I../src/essentia/scheduler', '-Isrc/essentia/streaming', '-I../src/essentia/streaming', '-Isrc/essentia/streaming/algorithms', '-I../src/essentia/streaming/algorithms', '-Isrc/essentia/utils', '-I../src/essentia/utils', '-Isrc/3rdparty', '-I../src/3rdparty', '-Isrc/3rdparty/spline', '-I../src/3rdparty/spline', '-Isrc/3rdparty/nnls', '-I../src/3rdparty/nnls', '-Isrc/3rdparty/cephes/bessel', '-I../src/3rdparty/cephes/bessel', '-I/opt/homebrew/Cellar/eigen/3.4.0_1/include/eigen3', '-I/opt/homebrew/Cellar/ffmpeg/7.0.2/include', '-I/opt/homebrew/Cellar/libsamplerate/0.2.2/include', '-DGTEST_HAS_TR1_TUPLE=0', '-DHAVE_EIGEN3=1', '-DEIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS', '-DHAVE_AVCODEC=1', '-DHAVE_AVFORMAT=1', '-DHAVE_AVUTIL=1', '-DHAVE_SWRESAMPLE=1', '-DHAVE_SAMPLERATE=1', '-D__STDC_CONSTANT_MACROS', '-DEIGEN_MPL2_ONLY', '../src/essentia/utils/audiocontext.cpp', '-c', '-o/Users/darshreddy/Artium/essentia/build/src/essentia/utils/audiocontext.cpp.1.o', '-fPIC', '-I/opt/homebrew/opt/[email protected]/include']

@luckysmg
Copy link

Get same error when build ios

@DarshReddy
Copy link

Hi @dbogdanov can you please help here? this is happening even on normal build from master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants