FIX for "undefined reference to 'av_mallocz_array"
FIX for "undefined reference to 'av_mallocz_array"
When compiling makemkv-oss against latest ffmpeg with libfdk-aac, "av_mallocz_array" has been deprecated in ffmpeg https://patchwork.ffmpeg.org/project/ff ... tlook.com/ .
The fix for this is to edit makemkv-oss source file libffabi/src/ffabi.c and replace "av_mallocz_array" with "av_calloc" and recompile.
The fix for this is to edit makemkv-oss source file libffabi/src/ffabi.c and replace "av_mallocz_array" with "av_calloc" and recompile.
Re: FIX for "undefined reference to 'av_mallocz_array"
Same error on Linux Mint 21.1. This fix worked. Thanks.
Re: FIX for "undefined reference to 'av_mallocz_array"
I encountered the same compile error on archlinux today.
Here's the specific patch that I applied (based on nrk666's comment)
Code: Select all
> pacman -Q ffmpeg openssl expat mesa qt5-base zlib gcc
ffmpeg 2:6.0-4
openssl 3.0.8-1
expat 2.5.0-1
mesa 23.0.1-1
qt5-base 5.15.8+kde+r185-1
zlib 1:1.2.13-2
gcc 12.2.1-2
Code: Select all
diff --git a/libffabi/src/ffabi.c b/libffabi/src/ffabi.c
index 5dda9e1..2b29b87 100644
--- a/libffabi/src/ffabi.c
+++ b/libffabi/src/ffabi.c
@@ -478,7 +478,7 @@ FFM_AudioEncodeContext* __cdecl ffm_audio_encode_init(void* logctx,const char* n
#else
ctx->frame = av_frame_alloc();
if (av_sample_fmt_is_planar(ctx->avctx->sample_fmt)) {
- ctx->frame_extended_data = av_mallocz_array(ctx->avctx->channels,
+ ctx->frame_extended_data = av_calloc(ctx->avctx->channels,
sizeof(*ctx->frame_extended_data));
if (!ctx->frame_extended_data) {
ffm_audio_encode_close(ctx);
Re: FIX for "undefined reference to 'av_mallocz_array"
Same on Fedora Linux fresh installation
Thx nrk666 for your trick to solve this issue.
I posted your correction on my post too,
viewtopic.php?f=3&t=30126&p=135117#p135117
Thx nrk666 for your trick to solve this issue.
I posted your correction on my post too,
viewtopic.php?f=3&t=30126&p=135117#p135117
Re: FIX for "undefined reference to 'av_mallocz_array"
I had the same issue today compiling a later download of v1.17.3 for Fedora38 during make, ffabi, undefined variable av_malloc_arrayz, line 481. I just deleted the trailing z and it compiled fine. So it seems both fixes work, at least for now.
Re: FIX for "undefined reference to 'av_mallocz_array"
Ahah, too cool !
But guys, which is the best value in that case: "av_calloc" or "av_malloc_array" ?
But guys, which is the best value in that case: "av_calloc" or "av_malloc_array" ?
Re: FIX for "undefined reference to 'av_mallocz_array"
The function now removed was named "mallocz", the z means "zero out the memory". If the code relies on the memory being initialized to 0, using "av_malloc_array" instead would most likely lead to crashes.
"av_calloc" OTOH seems to be named after the C standard function "calloc" which DOES zero memory. It's certainly the correct replacement.
Re: FIX for "undefined reference to 'av_mallocz_array"
Thank you a lot for this really interesting answer. In that case, I will modify my code with it.
Re: FIX for "undefined reference to 'av_mallocz_array"
Just tried compiling 1.17.4 and came across this error. Thanks for the fix.
If you want a simple one liner to change this:
If you want a simple one liner to change this:
Code: Select all
sed -i "s/av_mallocz_array/av_calloc/g" libffabi/src/ffabi.c
Re: FIX for "undefined reference to 'av_mallocz_array"
I forgot I even submitted this, glad I could help out and return a little love for this app.