mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
393 stars 113 forks source link

Error compiling on ubuntu 22.10 #732

Open p0psicles opened 1 year ago

p0psicles commented 1 year ago

Has anyone been able to compile attractmode in Ubuntu 22.10? I'm getting this error: running make -j $(cat /proc/cpuinfo | grep -c processor)

src/media.cpp:1307:69: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1307 |                                                 m_audio->codec_ctx->channels,
      |                                                                     ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1307:69: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1307 |                                                 m_audio->codec_ctx->channels,
      |                                                                     ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1337:85: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1337 |                                         offset += out_samples * m_audio->codec_ctx->channels;
      |                                                                                     ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1337:85: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1337 |                                         offset += out_samples * m_audio->codec_ctx->channels;
      |                                                                                     ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1337:85: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1337 |                                         offset += out_samples * m_audio->codec_ctx->channels;
      |                                                                                     ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1338:95: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1338 |                                         data.sampleCount += out_samples * m_audio->codec_ctx->channels;
      |                                                                                               ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1338:95: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1338 |                                         data.sampleCount += out_samples * m_audio->codec_ctx->channels;
      |                                                                                               ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
src/media.cpp:1338:95: warning: ‘AVCodecContext::channels’ is deprecated [-Wdeprecated-declarations]
 1338 |                                         data.sampleCount += out_samples * m_audio->codec_ctx->channels;
      |                                                                                               ^~~~~~~~
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:1006:9: note: declared here
 1006 |     int channels;
      |         ^~~~~~~~
make: *** [Makefile:486: obj/media.o] Error 1

i've installed the dependencies with the exception of libavresample-dev. Which isn't available. In stead of that, i've used the package libswresample-dev.

ubuntu:

Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:    22.10
Codename:   kinetic

Attract mode: version: 2.6.2

eclairevoyant commented 1 year ago

There's no actual error in your logs, since you can see warning: everywhere; you'll need to scroll up and find the actual error. If your error mentions something like this:

src/media.cpp:1065:57: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
 1065 |                                 << m_imp->m_format_ctx->filename << std::endl;
      |                                                         ^~~~~~~~
src/media.cpp:1069:94: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
 1069 |                         AVCodecContext *codec_ctx = m_imp->m_format_ctx->streams[stream_id]->codec;
      |                                                                                              ^~~~~
src/media.cpp:1080:65: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
 1080 |                                         << m_imp->m_format_ctx->filename << std::endl;
      |                                                                 ^~~~~~~~
src/media.cpp: In member function ‘virtual bool FeMedia::onGetData(sf::SoundStream::Chunk&)’:
src/media.cpp:1223:37: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘refcounted_frames’
 1223 |                 m_audio->codec_ctx->refcounted_frames = 1;
      |                                     ^~~~~~~~~~~~~~~~~
src/media.cpp:1232:27: error: ‘avcodec_decode_audio4’ was not declared in this scope; did you mean ‘avcodec_decode_subtitle2’?
 1232 |                 int len = avcodec_decode_audio4( m_audio->codec_ctx, frame, &got_frame, packet );
      |                           ^~~~~~~~~~~~~~~~~~~~~
      |                           avcodec_decode_subtitle2

then this is already fixed.

If you're building against a recent FFmpeg I strongly suggest using https://github.com/mickelson/attract/commit/02108245be47fc8adc92b42059ab8f30b340f16e or newer which has many build fixes implemented.