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

DllNotFoundException when building for Android 64-bit #25

Open
weblings opened this issue Feb 5, 2021 · 4 comments
Open

DllNotFoundException when building for Android 64-bit #25

weblings opened this issue Feb 5, 2021 · 4 comments

Comments

@weblings
Copy link

weblings commented Feb 5, 2021

I'm attempting to get an app approved on Oculus App Lab which requires a 64-bit application. After upgrading the build settings and the plugin settings from 32-bit I was getting these errors when PocketSphinx tried to initialize.

2021/02/04 23:44:29.257 15895 15921 Error Unity Unable to find libpocketsphinxwrap
2021/02/04 23:44:29.259 15895 15921 Error Unity Unable to find pocketsphinxwrap
2021/02/04 23:44:29.271 15895 15921 Error Unity DllNotFoundException: Unable to load DLL 'libpocketsphinxwrap': The specified module could not be found.
2021/02/04 23:44:29.271 15895 15921 Error Unity at Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_pocketsphinx (Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate nullReferenceDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate outOfM

Making sure the .so is inside of the Plugins folder gets rid of the first few errors but the DllNotFoundException sticks around

2021/02/04 23:52:16.151 17296 17323 Error Unity DllNotFoundException: Unable to load DLL 'libpocketsphinxwrap': The specified module could not be found.
2021/02/04 23:52:16.151 17296 17323 Error Unity at Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_pocketsphinx (Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate nullReferenceDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate outOfM

'Load on Startup' does not affect this behavior at all. This is how I have the plugin setup.
image

Here's my project's target architecture settings.
image

Hopefully the error is on my end and there is a simple solution, but thought I'd submit an issue just in case.

@HokanPL
Copy link

HokanPL commented Mar 10, 2021

I've encountered the same problem, especially because of Google Play Store changes that require separate support for ARM64.

The problem is because the library you are talking about is compiled for ARMv7, with Scripting Backend set to Mono, not to IL2CPP. However, Mono provides support only for 32 bits, and even if 64-bits-based phones have no problem to install, open and use it - Google doesn't accept that.

Question from my site to the author: would you like to provide .so library for 64-bit / ARM64 Android?

@Funnyguy77
Copy link
Owner

You're correct, this package doesn't include an ARM64 library. However, I have been able to resolve this issue in the past.

This Link provides a working ARM64 library. However, I wasn't able to add it in Unity directly but I was able to export the project to android studio and add the missing library there before generating a build.

That should work for you. 👍

@HokanPL
Copy link

HokanPL commented Mar 12, 2021

Ok, thanks. I've tried to just replace that file in my Unity project. It's loaded in runtime properly (I don't get any error with loading library using IL2CPP/ARM64 stuff), but probably it's written different and there're other methods. I will try to handle it with this what I have, maybe example implementation is enough to modify c# scripts.

@weblings
Copy link
Author

Thanks for the lead and response @Funnyguy77 !

I did what you suggested and exported from Unity to Android Studio. I renamed that .so file to match the name of the .so from this repo and added it in the "arm64-v8a" folder. Running the build, it is able to find the file now (yay!), but now gets stuck looking for "SWIGRegisterExceptionCallbacks_pocketsphinx" Here's what I'm getting out of adb:

<color=red>Initializing decoder...
03-14 18:43:29.353 28526 28542 I Unity : NoDetection_PocketSphinx:SetupDecoderKWS()
03-14 18:43:29.353 28526 28542 I Unity : d__11:MoveNext()
03-14 18:43:29.353 28526 28542 I Unity : UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
03-14 18:43:29.353 28526 28542 I Unity :
03-14 18:43:29.353 28526 28542 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
03-14 18:43:29.353 28526 28542 I Unity :
03-14 18:43:29.359 28526 28542 E Unity : EntryPointNotFoundException: Unable to find an entry point named 'SWIGRegisterExceptionCallbacks_pocketsphinx' in 'libpocketsphinxwrap'.
03-14 18:43:29.359 28526 28542 E Unity : at Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_pocketsphinx (Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate applicationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate arithmeticDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate divideByZeroDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate indexOutOfRangeDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidCastDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate invalidOperationDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate ioDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptionHelper+ExceptionDelegate nullReferenceDelegate, Pocketsphinx.pocketsphinxPINVOKE+SWIGExceptio

I don't think there's much that can be done since neither of us compiled this .so file, but maybe you have an idea?

The script that is running is SphinxExample.cs

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

3 participants