justinjoy / gst-android-camera

GNU Lesser General Public License v2.1
32 stars 9 forks source link

Undefined Reference to gst_video_overlay functions #6

Closed Maestro157 closed 3 years ago

Maestro157 commented 5 years ago

When I try to compile this project, I get undefined reference errors in android_camera.c file.

I tried to compile with the gstreamer version, that was apparently used in this project, 1.12.1, and also with the currently latest version 1.15.1

android_camera.c:221: error: undefined reference to 'gst_video_overlay_get_type'
android_camera.c:221: error: undefined reference to 'gst_video_overlay_set_window_handle'
android_camera.c:362: error: undefined reference to 'gst_video_overlay_get_type'
android_camera.c:362: error: undefined reference to 'gst_video_overlay_set_window_handle'
android_camera.c:385: error: undefined reference to 'gst_video_overlay_get_type'
android_camera.c:385: error: undefined reference to 'gst_video_overlay_set_window_handle'
android_camera.c:437: error: undefined reference to 'gst_photography_get_type'
android_camera.c:437: error: undefined reference to 'gst_photography_set_autofocus'

Any idea, how to solve these errors?

justinjoy commented 5 years ago

Thank you for reporting.

Isn't related to #7? Still happen when you set gstAndroidRoot correctly for the latest version?

Maestro157 commented 5 years ago

Yes, these errors are unrelated to #7.

justinjoy commented 5 years ago

I didn't find any different point with the previous version. Please, share more details. The latest version of GStreamer, which one are you using? From gstreamer.net [1], or build your own?

[1] https://gstreamer.freedesktop.org/data/pkg/android/1.15.1/

Maestro157 commented 5 years ago

I use version 1.15.1 from your link, the gstreamer website. I also use the latest NDK version, which is 19.2.5345600, besides of that, I changed nothing.

This is the complete error message:

Build command failed.
Error while executing process /Users/stefan/Library/Android/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/stefan/Download/gst-android-camera/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/stefan/Download/gst-android-camera/app/src/main/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-19 NDK_OUT=/Users/stefan/Download/gst-android-camera/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/stefan/Download/gst-android-camera/app/build/intermediates/ndkBuild/debug/lib NDK_APPLICATION_MK=src/main/jni/Application.mk GSTREAMER_JAVA_SRC_DIR=src/main/java GSTREAMER_ROOT_ANDROID=/Users/stefan/Downloads/gstreamer_android_1.15 GSTREAMER_ASSETS_DIR=src/main/assets /Users/stefan/Download/gst-android-camera/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libandroid_camera.so}
[armeabi-v7a] Compile thumb  : android_camera <= android_camera.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  : libandroid_camera.so

/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:221: error: undefined reference to 'gst_video_overlay_get_type'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:221: error: undefined reference to 'gst_video_overlay_set_window_handle'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:362: error: undefined reference to 'gst_video_overlay_get_type'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:362: error: undefined reference to 'gst_video_overlay_set_window_handle'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:385: error: undefined reference to 'gst_video_overlay_get_type'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:385: error: undefined reference to 'gst_video_overlay_set_window_handle'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:437: error: undefined reference to 'gst_photography_get_type'
/Users/stefan/Download/gst-android-camera/app/src/main/jni/android_camera.c:437: error: undefined reference to 'gst_photography_set_autofocus'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/stefan/Download/gst-android-camera/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libandroid_camera.so] Error 1
Maestro157 commented 5 years ago

Apparently, there is a problem with newer ndk versions. When I compile this project with GStreamer 1.12. and ndk version 1.15., it compiles, even though the execution on a device is quite slow. But the compilation with ndk 1.19. or with gstreamer 1.15. produces the previously printed errors.

I am looking into it and try to update this project to work with newer versions.

justinjoy commented 5 years ago

I guess it’s because of re-organazing library names in gstreamer, not ndk. Let’s check the problem deeper.

mattsm commented 4 years ago

Adding:

GSTREAMER_EXTRA_LIBS := -lgstphotography-1.0

To Android.mk seemed to fix the link issues for me with latest NDK and gstreamer.