Skip to content
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

android.sh fails with NDK r26 or above #1076

Open
srcejon opened this issue Dec 3, 2024 · 4 comments
Open

android.sh fails with NDK r26 or above #1076

srcejon opened this issue Dec 3, 2024 · 4 comments

Comments

@srcejon
Copy link

srcejon commented Dec 3, 2024

android.sh fails with NDK r26 or above.

Error in build.log is:

/home/me/Android/Sdk/ndk/28.0.12674087/build/core/build-binary.mk:591: Android NDK: Module ffmpegkit depends on undefined modules: c++_shared    
/home/me/Android/Sdk/ndk/28.0.12674087/build/core/build-binary.mk:604: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.

It seems to be caused by the following lines in android/jni/Android.mk:

ifeq ($(APP_STL), c++_shared)
    LOCAL_SHARED_LIBRARIES += c++_shared # otherwise NDK will not add the library for packaging
endif

If I comment that out, then it builds OK. (That may break builds with older NDKs - r25 seems ok without it)

Next problem is:

jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_mux_init.c:294:55: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
    { ENC_STATS_FRAME_NUM_IN,   "ni",       0, 0, 1         },

Presumably this can be fixed with:

+++ b/android/ffmpeg-kit-android-lib/src/main/cpp/fftools_ffmpeg_mux_init.c
@@ -284,9 +284,9 @@ static int enc_stats_init(OutputStream *ost, EncStats *es, int pre,
static const struct {
enum EncStatsType type;
const char *str;
- int pre_only:1;
- int post_only:1;
- int need_input_data:1;
+ unsigned int pre_only:1;
+ unsigned int post_only:1;
+ unsigned int need_input_data:1;

Environment

  • Platform: Android
  • Architecture: arm64-v8a,
  • Source branch: main,
  • Android NDK version: r26d or 28.0.12674087
@juha-h
Copy link

juha-h commented Dec 3, 2024

My ffmpeg build works fine with latest NDK r27 and ffmpeg-kit development branch:

$ make ffmpeg
rm -rf /usr/src/libbaresip-android/ffmpeg-kit/prebuilt/android-arm64-28 && \
cd ffmpeg-kit && \
ANDROID_SDK_ROOT=/foo/bar \
ANDROID_NDK_ROOT=/opt/Android/ndk/27.2.12479018 \
./android.sh --api-level=28 --enable-gpl --no-archive \
	--disable-arm-v7a --disable-x86-64 --disable-arm-v7a-neon --disable-x86 \
	--enable-android-media-codec \
	--enable-x264 --enable-libaom --enable-libvpx \
	--enable-libpng --skip-ffmpeg-kit

Building ffmpeg-kit library for Android

Architectures: arm64-v8a
Libraries: android-zlib, android-media-codec, libvpx, x264, libaom

Downloading sources: ok

Building arm64-v8a platform on API level 28

x264: ok
libaom: ok
libpng: ok
cpu-features: ok
libvpx: ok

ffmpeg: ok

ffmpeg-kit: skipped

Makefile is available here: https://github.com/juha-h/libbaresip-android (video branch).

@srcejon
Copy link
Author

srcejon commented Dec 3, 2024

You probably don't see the second problem as you are using --skip-ffmpeg-kit

@juha-h
Copy link

juha-h commented Dec 3, 2024 via email

@juha-h
Copy link

juha-h commented Dec 3, 2024

I enabled ffmpeg-kit and then the build failed:

[arm64-v8a] Compile        : ffmpegkit <= fftools_ffprobe.c
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:2868:31: error: unknown type name 'AVHDRVivid3SplineParams'
 2868 |                         const AVHDRVivid3SplineParams *three_spline =
      |                               ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:2869:41: error: no member named 'three_spline' in 'struct AVHDRVividColorToneMappingParams'
 2869 |                             &tm_params->three_spline[j];
      |                              ~~~~~~~~~  ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3314:46: error: use of undeclared identifier 'AV_FRAME_FLAG_KEY'
 3314 |     print_int("key_frame", !!(frame->flags & AV_FRAME_FLAG_KEY));
      |                                              ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3368:37: error: use of undeclared identifier 'AV_FRAME_FLAG_INTERLACED'
 3368 |                   !!(frame->flags & AV_FRAME_FLAG_INTERLACED));
      |                                     ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3370:37: error: use of undeclared identifier 'AV_FRAME_FLAG_TOP_FIELD_FIRST'
 3370 |                   !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
      |                                     ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3691:29: error: use of undeclared identifier 'AV_PROFILE_UNKNOWN'; did you mean 'AV_FIELD_UNKNOWN'?
 3691 |         if (par->profile != AV_PROFILE_UNKNOWN) {
      |                             ^~~~~~~~~~~~~~~~~~
      |                             AV_FIELD_UNKNOWN
jni/ffmpeg/../../../prebuilt/android-arm64-28/ffmpeg/lib/../include/libavcodec/codec_par.h:39:5: note: 'AV_FIELD_UNKNOWN' declared here
   39 |     AV_FIELD_UNKNOWN,
      |     ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3886:27: error: no member named 'nb_coded_side_data' in 'struct AVCodecParameters'
 3886 |     if (stream->codecpar->nb_coded_side_data) {
      |         ~~~~~~~~~~~~~~~~  ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3888:47: error: no member named 'nb_coded_side_data' in 'struct AVCodecParameters'
 3888 |         for (int i = 0; i < stream->codecpar->nb_coded_side_data; i++) {
      |                             ~~~~~~~~~~~~~~~~  ^
jni/../ffmpeg-kit-android-lib/src/main/cpp/fftools_ffprobe.c:3890:52: error: no member named 'coded_side_data' in 'struct AVCodecParameters'
 3890 |                                 &stream->codecpar->coded_side_data[i],
      |                                  ~~~~~~~~~~~~~~~~  ^
9 errors generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants