Potato Potato - 3 months ago 55
Android Question

Android Gstreamer SDK tutorial error

I'm trying to test Android Gstreamer.
So I installed and configured path SDK, got tutorial source, modify path in tutorial's Android.mk, and do ndk-build at android-tutorial-1/jni.
But I got

$ ndk-build
GStreamer : [GEN] => gst-build-arm64-v8a/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-arm64-v8a/gstreamer_android.c
GStreamer : [LINK] => gst-build-arm64-v8a/libgstreamer_android.so
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/gstreamer-1.0/static/libgstcoreelements.a(libgstcoreelements_la-gstelements.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gst.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstobject.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstallocator.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstbin.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstbuffer.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstbufferlist.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstbufferpool.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstbus.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstcaps.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstcapsfeatures.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstchildproxy.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstclock.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstclock-linreg.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstcontext.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstcontrolbinding.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstcontrolsource.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstdatetime.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstdebugutils.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstdevice.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstdevicemonitor.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libgstreamer-1.0.a(libgstreamer_1.0_la-gstdeviceprovider.o): incompatible target
...
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libglib-2.0.a(libglib_2_0_la-gstring.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libglib-2.0.a(libglib_2_0_la-gthread.o): incompatible target
/home/potato/Android/NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld.gold: error: /home/potato/Android/GST/lib/libglib-2.0.a(libglib_2_0_la-gutf8.o): incompatible target
gst-build-arm64-v8a/gstreamer_android.c:27: error: undefined reference to 'gst_plugin_coreelements_register'
gst-build-arm64-v8a/gstreamer_android.c:70: error: undefined reference to 'g_utf8_get_char_validated'
gst-build-arm64-v8a/gstreamer_android.c:79: error: undefined reference to 'g_strdup_printf'
gst-build-arm64-v8a/gstreamer_android.c:80: error: undefined reference to 'g_string_erase'
gst-build-arm64-v8a/gstreamer_android.c:81: error: undefined reference to 'g_string_insert'
gst-build-arm64-v8a/gstreamer_android.c:85: error: undefined reference to 'g_free'
gst-build-arm64-v8a/gstreamer_android.c:103: error: undefined reference to 'g_strdup_printf'
...
gst-build-arm64-v8a/gstreamer_android.c:540: error: undefined reference to 'g_module_open'
gst-build-arm64-v8a/gstreamer_android.c:544: error: undefined reference to 'g_module_symbol'
gst-build-arm64-v8a/gstreamer_android.c:548: error: undefined reference to 'g_module_close'
collect2: error: ld returned 1 exit status
/home/potato/Android/GST/share/gst-android/ndk-build/gstreamer-1.0.mk:229: recipe for target 'buildsharedlibrary_arm64-v8a' failed
make: *** [buildsharedlibrary_arm64-v8a] Error 1


PLUS
When I use arm-1.9.1 then I get

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
:app:ndkClean
src/main/jni/Android.mk:23: *** Target arch ABI not supported. Stop.
Error:Execution failed for task ':app:ndkClean'.
> Process 'command 'C:\Users\Jinwoo\AppData\Local\Android\NDK/ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 4 mins 46.216 secs
Information:1 error
Information:0 warnings
Information:See complete output in console


arm64-1.9.1

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:ndkClean
src/main/jni/Android.mk:23: *** Target arch ABI not supported. Stop.
Error:Execution failed for task ':app:ndkClean'.
> Process 'command 'C:\Users\Jinwoo\AppData\Local\Android\NDK/ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 4 mins 30.959 secs
Information:1 error
Information:0 warnings
Information:See complete output in console


x86-1.9.1

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:ndkClean
src/main/jni/Android.mk:23: *** Target arch ABI not supported. Stop.
Error:Execution failed for task ':app:ndkClean'.
> Process 'command 'C:\Users\Jinwoo\AppData\Local\Android\NDK/ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 7 mins 18.68 secs
Information:1 error
Information:0 warnings
Information:See complete output in console


x86_64-1.9.1

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:ndkClean
src/main/jni/Android.mk:35: C:\Users\Jinwoo/AppData/Local/Android/gstreamer-1.0-android-x86_64-1.9.1/share/gst-android/ndk-build//plugins.mk: No such file or directory
src/main/jni/Android.mk:39: C:\Users\Jinwoo/AppData/Local/Android/gstreamer-1.0-android-x86_64-1.9.1/share/gst-android/ndk-build//gstreamer-1.0.mk: No such file or directory
src/main/jni/Android.mk:35: C:\Users\Jinwoo/AppData/Local/Android/gstreamer-1.0-android-x86_64-1.9.1/share/gst-android/ndk-build//plugins.mk: No such file or directory
src/main/jni/Android.mk:39: C:\Users\Jinwoo/AppData/Local/Android/gstreamer-1.0-android-x86_64-1.9.1/share/gst-android/ndk-build//gstreamer-1.0.mk: No such file or directory
src/main/jni/Android.mk:23: *** Target arch ABI not supported. Stop.
Error:Execution failed for task ':app:ndkClean'.
> Process 'command 'C:\Users\Jinwoo\AppData\Local\Android\NDK/ndk-build.cmd'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 3.126 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

Answer

That tutorial you're using isn't actually from GStreamer, it's from a third-party, and is quite old now. I haven't been able to get it working with Android Studio, only Eclipse. If you want to use the latest Android GStreamer I'd recommend looking at this Github project.

It should work right out of the box with GStreamer SDK 1.8.0 or higher. The only change you will need is in the build.gradle file, in the getNdkCommandLine(ndkRoot, target) method set the gstRoot variable to the path to the GStreamer SDK.