ffmpeg-apple-arm64-build icon indicating copy to clipboard operation
ffmpeg-apple-arm64-build copied to clipboard

check failed: build of ffmpeg failed

Open mikeswanson opened this issue 11 months ago • 24 comments

Everything seemed to work until the ffmpeg build. The end of my build-ffmpeg.log file:

duplicate symbol '_av1_sgr_params' in:
    /Users/michael/Dev/ffmpeg-compile/tool/lib/libSvtAv1Enc.a[48](selfguided_neon.c.o)
    /tmp/lto.o
ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffprobe_g] Error 1
make: *** Waiting for unfinished jobs....
duplicate symbol '_av1_sgr_params' in:
    /Users/michael/Dev/ffmpeg-compile/tool/lib/libSvtAv1Enc.a[48](selfguided_neon.c.o)
    /tmp/lto.o
ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffplay_g] Error 1
duplicate symbol '_dec_init' in:
    /Users/michael/Dev/ffmpeg-compile/ffmpeg/ffmpeg/fftools/ffmpeg_dec.o
    /Users/michael/Dev/ffmpeg-compile/tool/lib/libbluray.a[28](libbluray_la-dec.o)
duplicate symbol '_av1_sgr_params' in:
    /Users/michael/Dev/ffmpeg-compile/tool/lib/libSvtAv1Enc.a[48](selfguided_neon.c.o)
    /tmp/lto.o
ld: 2 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffmpeg_g] Error 1
rm libavfilter/metal/vf_yadif_videotoolbox.metal.air libavfilter/metal/vf_yadif_videotoolbox.metallib libavfilter/metal/vf_yadif_videotoolbox.metallib.c
+ checkStatus 2 'build of ffmpeg failed'
+ '[' 2 -ne 0 ']'
+ echo 'check failed: build of ffmpeg failed'
check failed: build of ffmpeg failed
+ exit 1

mikeswanson avatar Mar 16 '24 22:03 mikeswanson

Xcode 15 strikes again, it looks like Apple have decided that duplicate symbols should fail their linker, and I can't see a flag to work around it, and reverting to classic behaviour is doing the same.

No real fixes, so the only what I can see to fix this ATM is remove the --enable-libsvtav1 and --enable-libbluray options from build-ffmpeg.sh

I can try raising errors with the STV-AV1 team as they also work with the libaom and I've already had work with them to get rid of duplicate symbols before. The one has in libbluray and ffmpeg may be trickier as the vlc team seem to ignore administrator emails for their mailing list so don't allow new people so it may be the ffmpeg team that need to sort it and they are quite slow to respond to issues sometimes.

Vargol avatar Mar 17 '24 02:03 Vargol

Thanks. That's actually what I ended up doing. The tests fail, but oh well.

Thank you for your work!

mikeswanson avatar Mar 17 '24 04:03 mikeswanson

The svt-av1 issue raised as https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2162

Someone else has raised the libbluray issue, which is a good job as is seems joining the VLC gitlab is as gated as there mailing lists. The ffmpeg team threw it over the fence to libbluray.

Vargol avatar Mar 17 '24 10:03 Vargol

SVT-AV1 should be back working again (as in it works for me :-) )

Vargol avatar Mar 18 '24 20:03 Vargol

No action from the vlc team with regard to libbluray, so I hacked itv tp compile and created a patch. No idea if libbluray still works as I've got no idea if I've got any non-encrypted blu-ray discs, but its does at least recognises the encrypted ones.

Vargol avatar Mar 23 '24 13:03 Vargol

Hi @Vargol, thanks for all your work.

I receive the same (or a similar?) error, i.e. duplicate symbol '_dec_init':

MAN	doc/ffmpeg-all.1
LD	ffmpeg_g
LD	ffprobe_g
ld: warning: ignoring duplicate libraries: '-lbrotlicommon', '-lbrotlidec', '-lbz2', '-lc++', '-ldl', '-lfreetype', '-liconv', '-lm', '-logg', '-lpng16', '-lpthread', '-lsharpyuv', '-lvorbis', '-lvpx', '-lwebp', '-lz'
ld: warning: ignoring duplicate libraries: '-lbrotlicommon', '-lbrotlidec', '-lbz2', '-lc++', '-ldl', '-lfreetype', '-liconv', '-lm', '-logg', '-lpng16', '-lpthread', '-lsharpyuv', '-lvorbis', '-lvpx', '-lwebp', '-lz'
duplicate symbol '_dec_init' in:
    /Users/thijmen/repositories/ffmpeg-apple-arm64-build/ffmpeg-compile/ffmpeg/ffmpeg/fftools/ffmpeg_dec.o
    /Users/thijmen/repositories/ffmpeg-apple-arm64-build/ffmpeg-compile/tool/lib/libbluray.a[28](libbluray_la-dec.o)
ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffmpeg_g] Error 1
make: *** Waiting for unfinished jobs....
+ checkStatus 2 'build of ffmpeg failed'
+ '[' 2 -ne 0 ']'
+ echo 'check failed: build of ffmpeg failed'
check failed: build of ffmpeg failed
+ exit 1

Is there anything I can do about this right now? If this requires a separate issue, please let me know!

M1 Mac Mini on Sonoma 14.4.1.

ThijmenDam avatar Mar 31 '24 16:03 ThijmenDam

Did you download the release ? Download the repository zip instead, big green "Code" button, download zip option at the bottom of the pop up menu. That should work.

Vargol avatar Mar 31 '24 16:03 Vargol

@Vargol I cloned the most recent version of this repository using the Git CLI. That should give me the most recent version, right?

ThijmenDam avatar Mar 31 '24 16:03 ThijmenDam

Yes that should work, assuming you didn't clone a branch.

Check build/build-libbluray.sh has the following line

git apply $1/libblu_dec_init.patch

I'm running a fresh build from a clone to check.

Vargol avatar Mar 31 '24 16:03 Vargol

@Vargol yes, build/build-libbluray.sh contains

git apply $1/libblu_dec_init.patch

on line 46.

ThijmenDam avatar Mar 31 '24 16:03 ThijmenDam

and thats the version thats not working for you, as that is the latest version that has just successfully built for me.

compile ffmpeg
took 182s
compilation finished successfully
took 918s

bundle result
  adding: ffmpeg (deflated 58%)
  adding: ffprobe (deflated 58%)

run tests
tests executed successfully

Vargol avatar Mar 31 '24 16:03 Vargol

Yes, the latest version has not been working for me. I double checked that I indeed had the latest version, and tried to build twice as well. Could I help by providing additional information?

ThijmenDam avatar Mar 31 '24 17:03 ThijmenDam

Sure, first I need your build-libbluray.log from for build directory. I can only think the patch needed to modify libbluray to fix the error has failed on your system for some reason.

Vargol avatar Mar 31 '24 17:03 Vargol

Also can you check in the build directory go to tool/lib

and try running the following command

nm libbluray.a | grep dec_init

which should return somethin like

000000000000025c T _lbr_dec_init
                 U _lbr_dec_init

if the 'lbr_' on the front of dec_init is missing thats more proof the patch is not applying.

Vargol avatar Mar 31 '24 17:03 Vargol

@Vargol indeed, the patch doesn't apply:

❯ nm libbluray.a | grep dec_init
000000000000025c T _dec_init
                 U _dec_init

I'm certain I have the latest version of your repository; I even deleted the repo folder and cloned it again. Do you have any clue on what might be going wrong? Perhaps caching-related issues?

ThijmenDam avatar Mar 31 '24 21:03 ThijmenDam

Can you send me the build log build-libbluray.log

It strange as there been no changes to the libbluray source for a year, there's only been one version of the patch, so its got to be something strange, like you'e got an old version of git that doesn't support the apply function or maybe a non standard ascii character in your path and git isn't coping (or maybe a space maybe although I would have though a lot more would failed with a space in the path). Maybe try changing the apply command to add quotes around the path

git apply "$1/libblu_dec_init.patch"

alternatively you can try applying the patch using the patch command. To do that change the command

git apply $1/libblu_dec_init.patch

to

patch -p1 -i  "$1/libblu_dec_init.patch"

in build/build-libbluray.sh

Vargol avatar Mar 31 '24 22:03 Vargol

Older / incompatible Git version sounds plausible. I had not installed Git myself, I used the version that Apple includes in macOS. I have just installed Git (version 2.44.0) using Homebrew, and I'll try again. Will report back ASAP.

build-libbluray.log

EDIT (1): no luck using a different Git version. There are no spaces or unusual characters in my paths, thus I will try again after adapting build/libbluray.sh (i.e. patch -p1 -i "$1/libblu_dec_init.patch").

EDIT (2): adapting build/libbluray.sh worked! All tests ran successfully.

Thanks @Vargol for the extensive support.

ThijmenDam avatar Apr 01 '24 12:04 ThijmenDam

alternatively you can try applying the patch using the patch command. To do that change the command

git apply $1/libblu_dec_init.patch

to

patch -p1 -i  "$1/libblu_dec_init.patch"

in build/build-libbluray.sh

BTW, latest checkout (30-May-24) and it was failing the same way for me (Apple M1-Max) — I did this change, and it's built ok 👌

phips avatar May 30 '24 14:05 phips

It looks like Xcode had an update two weeks ago- did it break everything again? Getting a seemingly different check failed: build of ffmpeg failed error

Snippet from build-ffmpeg.log

CC      libavcodec/vc2enc.o
CC      libavcodec/vc2enc_dwt.o
CC      libavcodec/vcr1.o
CC      libavcodec/version.o
CC      libavcodec/videodsp.o
2 warnings generated.
CC      libavcodec/videotoolbox.o
CC      libavcodec/videotoolbox_vp9.o
CC      libavcodec/videotoolboxenc.o
CC      libavcodec/vima.o
CC      libavcodec/vlc.o
CC      libavcodec/vmdaudio.o
CC      libavcodec/vmdvideo.o
CC      libavcodec/vmixdec.o
CC      libavcodec/vmnc.o
CC      libavcodec/vorbis.o
CC      libavcodec/vorbis_data.o
CC      libavcodec/vorbis_parser.o
CC      libavcodec/vorbisdec.o
libavcodec/videotoolbox.c:352:24: error: no member named 'temporal_id_nesting_flag' in 'struct HEVCSPS'; did you mean 'temporal_id_nesting'?
                  sps->temporal_id_nesting_flag << 2 |
                       ^~~~~~~~~~~~~~~~~~~~~~~~
                       temporal_id_nesting
libavcodec/videotoolbox.c:156:29: note: expanded from macro 'AV_W8'
#define AV_W8(p, v) *(p) = (v)
                            ^
libavcodec/hevc_ps.h:249:13: note: 'temporal_id_nesting' declared here
    uint8_t temporal_id_nesting;
            ^
1 error generated.
make: *** [libavcodec/videotoolbox.o] Error 1
make: *** Waiting for unfinished jobs....
CC      libavcodec/vorbisdsp.o
CC      libavcodec/vorbisenc.o
rm libavfilter/metal/vf_yadif_videotoolbox.metal.air
+ checkStatus 2 'build of ffmpeg failed'
+ '[' 2 -ne 0 ']'
+ echo 'check failed: build of ffmpeg failed'
check failed: build of ffmpeg failed
+ exit 1

build-ffmpeg.log

ethanrjones97 avatar Jun 01 '24 04:06 ethanrjones97

Not sure, this one is looking like a ffmpeg issue, as the error says

error: no member named 'temporal_id_nesting_flag' in 'struct HEVCSPS'

but that flag is or was part of HEVCSPS see the ffmpeg docs. https://ffmpeg.org/doxygen/7.0/structHEVCSPS.html

I'm guessing the flag has been changed in the git repo, but no one has changed the video toolbox interface.

Just got to do some digging to verify that, like find the HEVCSPS definition in the repo

Vargol avatar Jun 01 '24 10:06 Vargol

Yep, this commit broke it. https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/6fed1841a1f5dd3cdcf343f77925af0781ebe83a

Vargol avatar Jun 01 '24 10:06 Vargol

Issue raised on the ffmpeg tracker. https://trac.ffmpeg.org/ticket/11042

Vargol avatar Jun 01 '24 10:06 Vargol

And it appears to be fixed now.

Vargol avatar Jun 01 '24 22:06 Vargol

Thank you for your quick response! I didn't have "bug in ffmpeg" as my first guess 😆

ethanrjones97 avatar Jun 03 '24 00:06 ethanrjones97