-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to compile ffmpeg extension with NDK 23 + CMake-3.22 #9933
Comments
After some research, I found these useful references:
I added the following to
|
Thanks for the report. We will only be fixing build_ffmpeg.sh, though. I don't think CMake is related to the failure, and we don't need to enforce a specific NDK version at gradle level. A patch will appear below once this is pushed, when we'd appreciate you verify our fix satisfies your usecase. |
The change in CMake version as I made in
|
NDK 23 removes GNU's bin utils. More info in https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils. LLVM bin utils are available in all modern NDK versions. #minor-release Issue: google/ExoPlayer#9933 PiperOrigin-RevId: 429299806
NDK 23 removes GNU's bin utils. More info in https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils. LLVM bin utils are available in all modern NDK versions. #minor-release Issue: #9933 PiperOrigin-RevId: 429299806
NDK 23 removes GNU's bin utils. More info in https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils. LLVM bin utils are available in all modern NDK versions. #minor-release Issue: #9933 PiperOrigin-RevId: 429299806
I see the commit doesn't include the linker flag change. Didn't run into link error when compiling? If not, what NDK version, ffmpeg version and ffmpeg codecs did you test with? (in my case, using NDK 23 and ffmpeg's ac3 + mp3, I get an error at link time) |
For the record, the link error is still present in |
NDK 23 removes GNU's bin utils. More info in https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#binutils. LLVM bin utils are available in all modern NDK versions. #minor-release Issue: google/ExoPlayer#9933 PiperOrigin-RevId: 429299806
I'll take another look. I was on holiday. |
No. I tried it end to end and FFMPEG plays MP3 normally:
I managed to run into a CMake-related error on my linux setup, but this only manifests itself as an Android studio syncing issue. Updating the CMake version fixes the AndroidStudio issue (the error message is rather cryptic so I won't paste it). I want to clarify something: In your original PR you propose:
But that would allow using 3.18 which according to the link you posted we should not use, we should use 3.19 or newer. Additionally you also post a link which states that 3.20 has another issue, so it's unclear why you propose 3.18, and not '3.21.0+', for instance. Can you clarify this bit? |
I used 3.18, because that's the highest version I can see in As described in my initial note, I actually used cmake 3.22, installed at OS-level. Using 3.18 in the gradle file was basically a trade-off between the ability to auto-download cmake if required, and not running into the problem described here: https://gitlab.kitware.com/cmake/cmake/-/issues/22021 Note that in the end, I reverted all the changes related to cmake. I keep What version of cmake are you using? Thinking about it, maybe this can be the cause of the link error I'm seeing. If it's possible for you, and assuming your setup is different then mine, could you try with the same versions I'm using: NDK 23, no cmake at system-level, AGP downloading cmake-3.10.2.4988404? |
Issue: #9933 #minor-release PiperOrigin-RevId: 434449816
I tried again with unmodified
|
Issue: google/ExoPlayer#9933 #minor-release PiperOrigin-RevId: 434449816
CMake 3.22.1 is still not in stable so I had to install it from canary ( However just as the OP, I'm unable to build the ffmpeg extension with Cmake 3.22.1 and NDK 23.2.8568313.
|
This is the recommended NDK version for the current Android Studio release (Dolphin | 20221.3.1). See https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp. Using this NDK version works well without modifications as pointed out above. The issue only reproduces for NDK versions 23.1.7779620 and above (I tested with 25.0.8775105) and can be solved by the additional flags mentioned in #9933 (comment). I'll submit a fix that turns these flags on for the "arm64-v8a" ABI (that's the only one that needs it). Even though the default NDK doesn't have this problem yet, it's likely the default NDK will be updated in an upcoming Android Studio release and it's definitely worth fixing it. |
@tonihei i've noticed that you forgot to update CMake version in the AV1 extension. |
@menscikov Thanks for the hint, we'll fix this as well. |
The fix should appear here soon and will be part of the next release. |
From NDK 23.1.7779620 and above, the arm64-v8a ABI needs additional build flags to correctly link the ffmpeg libraries. Issue: google/ExoPlayer#9933 PiperOrigin-RevId: 467161973
The specified CMake version doesn't work with the latest Android Studio releases. Updating to a more recent version fixes the problem. Issue: google/ExoPlayer#9933 PiperOrigin-RevId: 467634063
From NDK 23.1.7779620 and above, the arm64-v8a ABI needs additional build flags to correctly link the ffmpeg libraries. Issue: #9933 PiperOrigin-RevId: 467161973
The specified CMake version doesn't work with the latest Android Studio releases. Updating to a more recent version fixes the problem. Issue: #9933 PiperOrigin-RevId: 467634063
My setup:
In order to build with this setup, I'm using the following patch:
I compile ffmpeg code according to build instructions:
Finally I try to compile the demo app:
Build fails at task
:extension-ffmpeg:externalNativeBuildDebug
. The output log at the failure is the following (there are actually a bunch of link errors, I just copied the first ones):Previously, I was using Android NDK 21.0.6113669 and CMake 3.10.2.4988404 (installed with
sdkmanager
), which worked fine.The text was updated successfully, but these errors were encountered: