Help with Android.mk file for plugin

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help with Android.mk file for plugin

yoyosuper8
Hi all, so I'm having a lot of issues registering a plugin in Android. I think it may be my Android.mk file that its missing something. I'm hoping that someone can help me resolve this.
Here is what I have in my jni folder within my android project:
Android.mk
gstplugin.h
gstplugin.c
tutorial-3.c

The code for the Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
plugin_LTLIBRARIES := libgstplugin.la
LOCAL_MODULE := libgstplugin
libgstplugin_la_SOURCES := gstplugin.c
noinst_HEADERS := gstplugin.h
libgstplugin_la_LDLIBS := -llog -landroid
libgstplugin_la_CFLAGS := -DGST_PLUGIN_BUILD_STATIC
libgstplugin_la_LDFLAGS := -module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*

include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := tutorial-3
LOCAL_SRC_FILES := tutorial-3.c
LOCAL_SHARED_LIBRARIES := gstreamer_android
LOCAL_LDLIBS := -llog -landroid -pthread
LOCAL_LDFLAGS := -mode=link
LOCAL_STATIC_LIBRARIES := -llibgstplugin

include $(BUILD_SHARED_LIBRARY)

ifndef GSTREAMER_SDK_ROOT
ifndef GSTREAMER_SDK_ROOT_ANDROID
$(error GSTREAMER_SDK_ROOT_ANDROID is not defined!)
endif
GSTREAMER_SDK_ROOT        := $(GSTREAMER_SDK_ROOT_ANDROID)
endif
GSTREAMER_NDK_BUILD_PATH  := $(GSTREAMER_SDK_ROOT)/share/gst-android/ndk-build/
include $(GSTREAMER_NDK_BUILD_PATH)/plugins.mk
GSTREAMER_PLUGINS         := $(GSTREAMER_PLUGINS_CORE) $(GSTREAMER_PLUGINS_SYS) $(GSTREAMER_PLUGINS_EFFECTS)
GSTREAMER_EXTRA_DEPS      := gstreamer-interfaces-0.10 gstreamer-video-0.10
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer.mk

This generates a libgstplugin.a static library. However, it fails because it says: undefined reference to 'gst_plugin_myplugin_register'

I'm registering the plugin using GST_PLUGIN_STATIC_REGISTER(myplugin) and GST_PLUGIN_STATIC_DECLARE(myplugin) in tutorial-3.c. The tutorial-3.c does not have a main method, but instead it is "main" method is gst_native_init() which is initiated in java. In this method, I call gst_init(NULL, NULL) followed by GST_PLUGIN_STATIC_REGISTER(myplugin). However, I still get the undefined reference error.

I've attached the files to this post if someone cares to look at them.
Any help would be appreciated. There has got to be something missing, but I can't figure out what.

Thank you
Andy

Android.mk
gstplugin.h
gstplugin.c
tutorial-3.c
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with Android.mk file for plugin

vishwanath Patil
HI , i am facing same problem if you have resolved let me know the solution.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with Android.mk file for plugin

Sebastian Dröge-3
In reply to this post by yoyosuper8
On Mo, 2013-09-23 at 11:54 -0700, yoyosuper8 wrote:
> Hi all, so I'm having a lot of issues registering a plugin in Android. I
> think it may be my Android.mk file that its missing something. I'm hoping
> that someone can help me resolve this.
> Here is what I have in my jni folder within my android project:
> [...]
>
> This generates a libgstplugin.a static library. However, it fails because it
> says: undefined reference to 'gst_plugin_myplugin_register'

Make sure that GST_PLUGIN_BUILD_STATIC is actually #defined in your code
where you use GST_PLUGIN_DEFINE2(). The only reason for that symbol to
not be defined would be that, or a problem in your build system.

Are there any other symbols defined by libgstplugin.a? Which?

Also note that usually you don't need to build a static plugin, see
https://stackoverflow.com/questions/27816992/static-plugin-gstreamer-on-android/27839855#27839855

Also don't use GStreamer 0.10 anymore, it's not maintained any longer
since more than 2 years. You can get the latest Android binaries from
here:
http://gstreamer.freedesktop.org/data/pkg/android/1.4.5/

> I'm registering the plugin using GST_PLUGIN_STATIC_REGISTER(myplugin) and
> GST_PLUGIN_STATIC_DECLARE(myplugin) in tutorial-3.c. The tutorial-3.c does
> not have a main method, but instead it is "main" method is gst_native_init()
> which is initiated in java. In this method, I call gst_init(NULL, NULL)
> followed by GST_PLUGIN_STATIC_REGISTER(myplugin). However, I still get the
> undefined reference error.

Are you still using the gstreamer_android.c that is generated by the
GStreamer build system, i.e. via the GStreamer.java API? If not you'll
have to replicate a lot of code from there for things to work as
expected. Take a look at that code to see what it does.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with Android.mk file for plugin

Michal Pikus
Hello Sebastian,

I have the same issue. I'm trying to use gstreamer-remote application with additional self made plugins for dab decoding. For this purpose I compiled it to static libraries .a (using cerbero cross compilation tool), put in lib folder and changed plugins.mk. I saw that gstreamer-android.c is calling:
GST_PLUGIN_STATIC_DECLARE(dab) and GST_PLUGIN_STATIC_REGISTER(dab). But I still have problem with linking.
The error is "Error:error: undefined reference to 'gst_plugin_dab_register'".
Could you tell me what I'm doing wrong ?
 
Michal Pikus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with Android.mk file for plugin

Sebastian Dröge-3
On Sun, 2017-06-11 at 23:17 -0700, Michal Pikus wrote:

> Hello Sebastian,
>
> I have the same issue. I'm trying to use gstreamer-remote application with
> additional self made plugins for dab decoding. For this purpose I compiled
> it to static libraries .a (using cerbero cross compilation tool), put in lib
> folder and changed plugins.mk. I saw that gstreamer-android.c is calling:
> GST_PLUGIN_STATIC_DECLARE(dab) and GST_PLUGIN_STATIC_REGISTER(dab). But I
> still have problem with linking. 
> The error is "Error:error: undefined reference to
> 'gst_plugin_dab_register'".
> Could you tell me what I'm doing wrong ? 
Are your plugins compiled with GST_PLUGIN_BUILD_STATIC #defined? How
does the GST_PLUGIN_DEFINE() invocation look like?

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with Android.mk file for plugin

Michal Pikus
I compiled pulgins with static flag using cerbero-x86 android toolchain.
I need to add this flag to when I'm calling ./configure script in gstreamer folder ?
I'm sending you above my gstreamer-android.c generated file.
I saw that I'm calling only a
GST_PLUGIN_STATIC_DECLARE(dab) &  GST_PLUGIN_STATIC_REGISTER(dab)
I don't see GST_PLUGIN_DEFINE() invocation.
gstreamer_android.c

I assume that something I'm doing wrong.

Best Regards,

Michal Pikus
Loading...