1

When I build the Bento4 library from Android Studio, I get an undefined reference to 'AP4_Ac4SampleDescription::_class_AP4_Ac4SampleDescription' error.

Overall there are like 5 cmake commands for Bento4 for different platforms. Here are the 2 for Linux and Android:

Basic Linux: cmake -DCMAKE_BUILT_TYPE=Release ..

Android NDK: cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$MINSDKVERSION ..

It builds fine with the basic Linux version.

What might be the cause for the Android version not working? Please note: I tried a few different version of the Android NDK. I get the one error for versions 16 and 17, and another error for versions 18 through 21.

enter image description here

Adrian Bartyczak
  • 188
  • 3
  • 14
  • To understand what the problem is, it is not enough to have only screenshots of errors and command line arguments (and it is better to provide them as text), because the problem is definitely in the make files (CMake, Android.mk, gradle). – Mykola Khyliuk Oct 11 '21 at 08:50
  • I tried 4 different Android NDK versions. For both 18 and 21, I got the error above. For 16 and 17, I got a different error. So ya it could be the cmake files. Especially because the regular non-Android cmake command builds Bento4 successfully. But I really need to figure this out. – Adrian Bartyczak Oct 11 '21 at 18:30

1 Answers1

1

It is a bug on Bento4 side. You need to add missed stuff into Bento4/Source/C++/Core/Ap4SampleDescription.cpp:

AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Ac3SampleDescription)
AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Eac3SampleDescription)
AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_Ac4SampleDescription)

Also I've created corresponding pull-request to Bento4 repository: https://github.com/axiomatic-systems/Bento4/pull/654

I hope now you will be able to build it.

UPD: The pull-request was merged, so simply pull and rebuild your project.

Mykola Khyliuk
  • 1,234
  • 1
  • 9
  • 16