Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DllNotFound exception on Android version #34

Open
felchs opened this issue Mar 25, 2022 · 3 comments
Open

DllNotFound exception on Android version #34

felchs opened this issue Mar 25, 2022 · 3 comments

Comments

@felchs
Copy link

felchs commented Mar 25, 2022

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
Copy link

avikde commented Jun 23, 2022

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

image

I have a few questions about how things work:

  • in the head of the branch, if we change the APP_PLATFORM or APP_ABI in Plugin/Android/jni/Application.mk and rebuild, it generates libs/<arch>/libGStreamerUnityPlugin.so. I assume in the OP's question above the repo version was older which is why the output is libgstreamer_android.so?
  • Should we choose android-16 in APP_PLATFORM based on this table on this page https://gstreamer.freedesktop.org/download/ for armv7?

image

  • how is this file moved over to the apk? I have opened the apk and it does not seem to have this so file in it, which would explain the DllNotFound message. Is there something that must be selected in the Unity editor to connect libGStreamerUnityPlugin.so to the project and make sure it is included in the apk? I placed the files manually in the project in Assets/Plugins as the poster above seemed to:

image

  • Lastly, I was trying to confirm that libGStreamerUnityPlugin.so actually contains the missing function mray_gstreamer_initialize(), but the nm command did not seem to help me here...
>C:\NDK\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\arm-linux-androideabi\bin\nm.exe libGStreamerUnityPlugin.so
C:\NDK\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\arm-linux-androideabi\bin\nm.exe: libGStreamerUnityPlugin.so: no symbols

Thanks for any help!

@palwanishan
Copy link

Greetings,

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

Thanks for any help!

@keli95566
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants