mrayy / mrayGStreamerUnity

GStreamer Integration with Unity using a Native plugin
MIT License
108 stars 38 forks source link

DllNotFound exception on Android version #34

Open felchs opened 2 years ago

felchs commented 2 years ago

Hi @mrayy ,

I'm trying to build the .so (the static also tried the shared lib) for android but I'm getting DLLNotFound exception on static build and the shared lib is not working for ARMv7 I'm getting Unable to find an entry point named 'mray_gstreamer_initialize' in 'GStreamerUnityPlugin'. PS1: I tried Mono and IL2CPP many NDK versions possible (I haven't tried ARM64). PS2: I could make it to work on windows, streaming the test video and also from one c++ windows gstream app to unity.

Here some build info:

GSTREAMER_ROOT_ANDROID=C:\gstreamer-1.0-android-universal-1.16.2\armv7
I think these are not used for android but:
GST_SDK_PATH=C:\gstreamer\1.0\x86_64\
GSTREAMER_1_0_ROOT_X86_64=
GSTREAMER_DIR=

These are on path (becuase old project that used windows opencv):
C:\gstreamer\1.0\x86_64\bin;
C:\gstreamer\1.0\x86_64\lib;
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0;
C:\Users\felipe.chaves\Downloads\opencv4.5.3\build\install\x64\vc16\bin;

This is the NDKand SDK used on my Unity 2020.3.8f1

 Android NDK:                   C:/NDK (ver 19.0.5232133)
    Android ABI:                 arm64-v8a
    NDK toolchain:               aarch64-linux-android-clang
    STL type:                    c++_static
    Native API level:            28
  Android SDK:                   C:/SDK (tools: 26.1.1 build tools: 28.0.3)

Unity 2020.3.8f1

I'm confused about the NDK version I should use and it's compatibility with my Unity2020.3.8f1 If I put an older NDK as it is by default NDK_TARGET_LEVEL -> "android-16", if I put this older ndk it will be compatible with my newer ndk? I'm asking this because I'm getting dllnotfoundexception so I don't have a clue about whats going on, some dll reference is missing.

APP_STL := c++_static APP_PLATFORM := $(NDK_TARGET_LEVEL) APP_ABI := armeabi-v7a NDK_TARGET_LEVEL := android-23 APP_OPTIM := release APP_BUILD_SCRIPT := Android.mk

The output of the build: C:\mrayGStreamerUnity-master\Plugin\Android\GStreamer>C:\android-ndk-r17c-windows-x86_64\android-ndk-r17c/ndk-build NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-14. 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/ Done rm [armeabi-v7a] Install : libgstreamer_android.so => libs/armeabi-v7a/libgstreamer_android.so


PS: I also tried NDK 18.1.5063045 and as it is on the "echo use ndk r17c to compile on windows" also tried with the version: 17.2.4988734

When compiling static lib I get: I got the same result: Autoconnected Player DllNotFoundException: GStreamerUnityPlugin

When compiling with shared lib I get:

Autoconnected Player EntryPointNotFoundException: Unable to find an entry point named 'mray_gstreamer_initialize' in 'GStreamerUnityPlugin'.

I also included it on unity just to mention: image_2022-03-25_141142

image

I also tried Mono and IL2CPP on ARMv7, what am I missing?

avikde commented 2 years ago

I have a related issue in that I also get DllNotFound.

image

I have a few questions about how things work:

image

image

Thanks for any help!

palwanishan commented 1 year ago

Greetings,

I have similar problems here. Any updates or guide for newbie?

Thanks for any help!

keli95566 commented 1 year ago

I have previously tried to recompile this plugin. I think the reason that you are getting the EntryPointNotFoundException is because there are in total 3 plugins (.so files) that need to be manually rebuilt for all the plugins to work together.

  1. Build the 1.14.5 libgstreamer_android.so gstreamer plugin using Android.mk configuration under \GstreamerUnityAndroidBranch\Plugin\Android\GStreamer (This is the original gstreamer android plugin.)

  2. Build the [libGStreamerUnityPlugin.so] (https://github.com/keli95566/MRTunnelingPico/blob/main/MRTunnelingPico/Assets/Plugins/Android/libGStreamerUnityPlugin.so) plugin by creating a custom Android.mk configuration under \GstreamerUnityAndroidBranch_ARM64\Plugin\Android. (libGStreamerUnityPlugin.so contains all the core c++ scripts that create and write to shared OpenGL Unity texture pointers, etc. )

  3. Build the libRenderUnityPlugin.so Unity renderer plugin using the Android.mk configuration under \GstreamerUnityAndroidBranch_ARM64\Plugin\Android\Renderer. (libRenderUnityPlugin.so is the plugin that implements the Unity native rendering interfaces provided by Unity.

I uploaded the updated version of the repository to this repository: https://github.com/keli95566/gstreamerUnityPluginAndroid It has been a year ago when I got it to work. I hope that I remember everything correctly and hope that the steps mentioned above help!

For the uploaded repository, I used the following NDK/gstreamer versions:

  1. Use NDK r16b
  2. Compile Gstreamer 1.14.5, higher versions do not work for some reason.
  3. I only tried to build targeting arm64 architecture.

Noticed that I tried a lot of Gstreamer version, and only 1.14.5 seems to work correctly.