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 115 forks source link

Compile error Attract Mode 2.6.2 on Arch Linux #727

Open shbon opened 2 years ago

shbon commented 2 years ago

Trying to compile Attract Mode 2.6.2 on up to date Arch Linux...

** Edit: I can see there were 3 commits just after v2.6.2 to media.cpp:

Update src/media.cpp to use modern FFmpeg API: https://github.com/mickelson/attract/commit/1b933c39dbd9201b09140e922babe21939d64dad

Fix build issue with recent ffmpeg: https://github.com/mickelson/attract/commit/c27312be47dfb7370456a878fc6284883650b7f2

Only use const AVCodec where AVFORMAT version >= 59.0.100 https://github.com/mickelson/attract/commit/02108245be47fc8adc92b42059ab8f30b340f16e

So as a workaround, I downloaded and compiled the source from this commit point: https://github.com/mickelson/attract/tree/02108245be47fc8adc92b42059ab8f30b340f16e

That worked. **

I get the following error (snippet):

flags: -Wl,--export-dynamic -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -pthread  -DDATA_PATH=\"/usr/local/share/attract/\" -O2 -DNDEBUG -Iextlibs/audio/include -D__STDC_CONSTANT_MACROS -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -pthread -I/usr/include/AL  -Iextlibs/squirrel/include -Iextlibs/sqrat/include -Iextlibs/nowide -Iextlibs/nvapi -Iextlibs/rapidjson/include -Iextlibs/gameswf -DUSE_XLIB -DUSE_XINERAMA -DUSE_FONTCONFIG -DUSE_LIBARCHIVE -DUSE_LIBCURL -DUSE_SWRESAMPLE
Compiling obj/media.o...
src/media.cpp: In member function ‘void FeVideoImp::video_thread()’:
src/media.cpp:660:52: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘refcounted_frames’
  660 |                                         codec_ctx->refcounted_frames = 1;
      |                                                    ^~~~~~~~~~~~~~~~~
src/media.cpp:665:51: error: ‘avcodec_decode_video2’ was not declared in this scope; did you mean ‘avcodec_decode_subtitle2’?
  665 |                                         int len = avcodec_decode_video2( codec_ctx, raw_frame,
      |                                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                                   avcodec_decode_subtitle2
src/media.cpp:672:77: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘pkt_pts’; did you mean ‘pkt_dts’?
  672 |                                                 raw_frame->pts = raw_frame->pkt_pts;
      |                                                                             ^~~~~~~
      |                                                                             pkt_dts
src/media.cpp:732:78: error: ‘AVFormatContext’ {aka ‘struct AVFormatContext’} has no member named ‘filename’
  732 |         FeDebug() << "End Video Thread - " << m_parent->m_imp->m_format_ctx->filename << std::endl
      |                                                                              ^~~~~~~~
src/media.cpp: In static member function ‘static void FeMedia::init_av()’:
src/media.cpp:762:17: error: ‘avcodec_register_all’ was not declared in this scope
  762 |                 avcodec_register_all();
      |                 ^~~~~~~~~~~~~~~~~~~~
src/media.cpp:763:17: error: ‘av_register_all’ was not declared in this scope
  763 |                 av_register_all();
      |                 ^~~~~~~~~~~~~~~

Is this a FFmpeg version issue?

I have ffmpeg 5.0.1 and ffmpeg 4.4.2 installed via the arch repository:

libavcodec for instance: FFmpeg 4.4.2: usr/lib/libavcodec.so.58.134.100 FFmpeg 5.0.1: usr/lib/libavcodec.so.59.18.100

Any thoughts?

Thanks Shaun

OzFalcon commented 2 years ago

No problems compiling the latest master with Debian system. ffmpeg -version ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers

Sure you have the 4.4.2 dev files installed? Can you compile using 4.4.2 only using something like https://wiki.debian.org/DebianAlternatives

kwyxz commented 2 years ago

No problems compiling the latest master with Debian system. ffmpeg -version ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers

There will be an issue since avcodec_decode_audio4 was deprecated with ffmpeg version 5 which will be in the next Debian stable too (already is in Sid).

eclairevoyant commented 1 year ago

https://aur.archlinux.org/packages/attract use this or the -git package. The build issues have already been resolved upstream

By the way, since this is no longer an issue for you, you should close this issue to save maintainers from having to check resolved issues