Bug 450784

Summary: Compile error from Git Master 2022-02-24
Product: [Applications] amarok Reporter: Evert Vorster <evorster>
Component: generalAssignee: Amarok Bugs <amarok-bugs-null>
Status: RESOLVED FIXED    
Severity: critical CC: heiko.becker
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: kf5   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Evert Vorster 2022-02-24 05:00:41 UTC
SUMMARY
***
Compile error from git master, first noticed on 2022-02-24
***


STEPS TO REPRODUCE
1. Use "yay" AUR helper in Arch Linux to compile "amarok-git"
    This pulls a copy of git master of amarok, and compiles it.

OBSERVED RESULT
Compile error:
[ 45%] Building CXX object src/CMakeFiles/amaroklib.dir/musicbrainz/MusicDNSAudioDecoder.cpp.o
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp: In member function ‘virtual void MusicDNSAudioDecoder::run(ThreadWeaver::JobPointer, ThreadWeaver::Thread*)’:
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:136:5: error: ‘avcodec_register_all’ was not declared in this scope
  136 |     avcodec_register_all();
      |     ^~~~~~~~~~~~~~~~~~~~
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:137:5: error: ‘av_register_all’ was not declared in this scope
  137 |     av_register_all();
      |     ^~~~~~~~~~~~~~~
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp: In member function ‘int MusicDNSAudioDecoder::decode(const QString&, DecodedAudioData*, int)’:
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:206:79: error: invalid conversion from ‘AVCodec**’ to ‘const AVCodec**’ [-fpermissive]
  206 |     audioStream = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_AUDIO, -1, -1, &pCodec, 0);
      |                                                                               ^~~~~~~
      |                                                                               |
      |                                                                               AVCodec**
In file included from /ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:28:
/usr/include/libavformat/avformat.h:2165:41: note:   initializing argument 5 of ‘int av_find_best_stream(AVFormatContext*, AVMediaType, int, int, const AVCodec**, int)’
 2165 |                         const AVCodec **decoder_ret,
      |                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:221:51: error: ‘AVStream’ {aka ‘struct AVStream’} has no member named ‘codec’
  221 |     pCodecCtx = pFormatCtx->streams[audioStream]->codec;
      |                                                   ^~~~~
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:235:19: warning: ‘void av_init_packet(AVPacket*)’ is deprecated [-Wdeprecated-declarations]
  235 |     av_init_packet( &avpkt );
      |     ~~~~~~~~~~~~~~^~~~~~~~~~
In file included from /usr/include/libavcodec/avcodec.h:45,
                 from /ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:27:
/usr/include/libavcodec/packet.h:506:6: note: declared here
  506 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:257:30: error: ‘avcodec_decode_audio4’ was not declared in this scope; did you mean ‘avcodec_decode_subtitle2’?
  257 |                 decoderRet = avcodec_decode_audio4( pCodecCtx, decodedFrame, &gotFrame, &avpkt );
      |                              ^~~~~~~~~~~~~~~~~~~~~
      |                              avcodec_decode_subtitle2
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:280:9: error: ‘av_free_packet’ was not declared in this scope; did you mean ‘av_new_packet’?
  280 |         av_free_packet( &packet );
      |         ^~~~~~~~~~~~~~
      |         av_new_packet
/ad/OS/aur/amarok-git/src/amarok/src/musicbrainz/MusicDNSAudioDecoder.cpp:286:5: error: ‘av_free_packet’ was not declared in this scope; did you mean ‘av_new_packet’?
  286 |     av_free_packet( &avpkt );
      |     ^~~~~~~~~~~~~~
      |     av_new_packet
make[2]: *** [src/CMakeFiles/amaroklib.dir/build.make:6678: src/CMakeFiles/amaroklib.dir/musicbrainz/MusicDNSAudioDecoder.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:7306: src/CMakeFiles/amaroklib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: amarok-git



EXPECTED RESULT
A clean compile. 

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: 5.15.2
(available in About System)
KDE Plasma Version: 5.15.2
KDE Frameworks Version: 5
Qt Version: 5.15.2

ADDITIONAL INFORMATION
This compilation used to work fine last year when this package was last built. Suspect that a GCC upgrade is at the root of this compile error.
Comment 1 Heiko Becker 2022-02-24 14:54:09 UTC
That's due to ffmpeg changing API. https://invent.kde.org/multimedia/amarok/-/merge_requests/45/commits is a possible fix.
Comment 2 Evert Vorster 2022-02-24 15:08:14 UTC
What's the time frame for this to get merged into master?

I am testing the fixes on my system now, but would like to avoid making a special package if this is going to be in master in a day or so.

Kind regards,
-Evert-
Comment 3 Evert Vorster 2022-03-24 10:17:54 UTC
Just checked again, and the source from git master still fails to compile.
Comment 4 Evert Vorster 2022-05-03 13:48:45 UTC
It compiles fine now. Closing the ticket