Android NDK and Bento4 - Undefined reference to 'AP4_Ac4SampleDescription::_class_AP4_Ac4SampleDescription'

302 Views Asked by At

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

1

There are 1 best solutions below

1
Mykola Khyliuk On BEST ANSWER

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.