error: undefined reference to 'gst_app_sink_pull_sample'

Marcelo C marcelocaj at gmail.com
Mon Sep 28 19:46:24 UTC 2020


Hello! My goal is to use functions such as gst_app_sink_pull_sample (I am
trying to run an old android application). But it gives linker errors.

First of all, to check if Gstreamer and NDK are correctly configured, I run
all 5 tutorials given by GStreamer and those compiled and run without any
problem.

GStreamer used: 1.8.0 for android / NDK: 21.0.6113669 / Android Studio:
4.0.1

So, to simplify the problem I just added that function to tutorial-1 to
test if the problem comes with the linker or with the code. All the code is
almost the same as the tutorial-1, with the exception of three lines (in
addition of gst/app/app.h), I just added this code in the JNI_OnLoad function
in tutorial-1.c :

    GstAppSink *sink = NULL;
    GstSample* sample = gst_app_sink_pull_sample(sink);
    GstBuffer* buffer = gst_sample_get_buffer(sample);


Because linker errors can happen when a library is missing, I included all
of them in the Android.mk:

GSTREAMER_PLUGINS := $(GSTREAMER_PLUGINS_CORE)
$(GSTREAMER_PLUGINS_PLAYBACK) $(GSTREAMER_PLUGINS_CODECS)
$(GSTREAMER_PLUGINS_CODECS_RESTRICTED) $(GSTREAMER_PLUGINS_NET)
$(GSTREAMER_PLUGINS_SYS)


However, it still gives a linker error. The full stack is:

Build command failed.
Error while executing process
/home/tech/Android/Sdk/ndk/21.0.6113669/ndk-build with arguments
{NDK_PROJECT_PATH=null
APP_BUILD_SCRIPT=/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/jni/Android.mk
NDK_APPLICATION_MK=/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/jni/Application.mk
APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1
APP_PLATFORM=android-16
NDK_OUT=/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/build/intermediates/ndkBuild/debug/obj
NDK_LIBS_OUT=/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/build/intermediates/ndkBuild/debug/lib
NDK_APPLICATION_MK=jni/Application.mk GSTREAMER_JAVA_SRC_DIR=src
GSTREAMER_ROOT_ANDROID=/home/tech/StudioProjects/ci_host_android/app/src/main/android_libs/gstreamer
GSTREAMER_ASSETS_DIR=src/assets
/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libtutorial-1.so}
[armeabi-v7a] Compile thumb  : tutorial-1 <= tutorial-1.c
GStreamer      : [GEN] => gst-build-armeabi-v7a/gstreamer_android.c
GStreamer      : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.c
GStreamer      : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.so
Done mkdir
Done cp
[armeabi-v7a] Prebuilt       : libgstreamer_android.so <= gst-build-armeabi-v7a/
[armeabi-v7a] SharedLibrary  : libtutorial-1.so
jni/tutorial-1.c:28: error: undefined reference to 'gst_app_sink_pull_sample'
clang++: error: linker command failed with exit code 1 (use -v to see
invocation)
make: *** [/home/tech/Android/Sdk/ndk/21.0.6113669/build/core/build-binary.mk:725:
/home/tech/StudioProjects/gst-docs/examples/tutorials/android/android-tutorial-1/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libtutorial-1.so]
Error 1

Another idea was that probably those functions (gst_app_sink_*) were
not in the library (libgstapp-1.0.a), so I run the command nm to know
the exported functions inside the library. However, the library
contains those functions, so the only possibility is that the library
is not being imported. I also tested other functions (for example:
get_app_stream_type_get_type) inside that library and none of those
work (the functions are recognized by the headers, but not by the
linker). Then, probably this is a bug or I am missing something.

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-android/attachments/20200928/0b6f38be/attachment.htm>


More information about the gstreamer-android mailing list