[Bug] UnsatisfiedLinkError: rsdroid1801181558290891185.dll: Can't find dependent libraries
Reproduction Steps
- Running test extending Roboelectric test Reference https://github.com/david-allison-1/Anki-Android-Backend/issues/46
- I have the dll file in my temp folder.
Expected Result
Test must pass
Actual Result
java.lang.Exception: Main looper has queued unexecuted runnables. This might be the cause of the test failure. You might need a shadowOf(getMainLooper()).idle() call.
at org.robolectric.android.internal.AndroidTestEnvironment.checkStateAfterTestFailure(AndroidTestEnvironment.java:502)
at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:581)
at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:278)
at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\Piyush Goel\AppData\Local\Temp\rsdroid1801181558290891185.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1946) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828) at java.lang.Runtime.load0(Runtime.java:810) at java.lang.Runtime.load(Runtime.java:798) at net.ankiweb.rsdroid.testing.RustBackendLoader.loadPath(RustBackendLoader.java:100) at net.ankiweb.rsdroid.testing.RustBackendLoader.load(RustBackendLoader.java:95) at net.ankiweb.rsdroid.testing.RustBackendLoader.init(RustBackendLoader.java:49) at com.ichi2.anki.RobolectricTest.setUp(RobolectricTest.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:575) ... 6 more
Process finished with exit code -1
Debug info
Refer to the support page if you are unsure where to get the "debug info".
Research
Enter an [x] character to confirm the points below:
- [x] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
- [x] I have checked the manual and the FAQ and could not find a solution to my issue
- [x] I have searched for similar existing issues here and on the user forum
This might help http://robolectric.org/blog/2019/06/04/paused-looper/
This is due to a dll failing to load
@Arnold2381 Could you post the full exception log, the cause is the most important part
Somewhere before the crash, could you set: RustBackendLoader.PRINT_DEBUG = true;, this should list your OS in the test output in Android Studio.
: loading rsdroid-testing for: [os]
This will likely need some diagnosis on your side, I'm not sure what's going on here
This comment may be useful in diagnosing which DLLs are missing: https://github.com/david-allison-1/Anki-Android-Backend/issues/46#issuecomment-808697017
- My first suggestion would be for you to install the [Microsoft C++ Build Tools](https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup. I'm doubtful that this will help, but it clears out a possibility.
@Arnold2381
Actually... first stage:
Could you save the following as a file: checkrsdroid.ps1, open up a PowerShell prompt in the folder and run .\checkrsdroid.ps1
(get-command ole32.dll).Path
(get-command SHELL32.dll).Path
(get-command ADVAPI32.dll).Path
(get-command libgcc_s_seh-1.dll).Path
(get-command KERNEL32.dll).Path
(get-command msvcrt.dll).Path
(get-command USERENV.dll).Path
(get-command WS2_32.dll).Path
I expect that this will be because libgcc_s_seh-1.dll is missing, I'll look into fixing this.
I would not advise downloading this dll from a website (dll websites can be dodgy). It would be best to install gcc (probably via MinGW64).
My first suggestion would be for you to install the [Microsoft C++ Build Tools](https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup. I'm doubtful that this will help, but it clears out a possibility. @david-allison-1 I tried this didn't work. Will try next the suggestion
I've had a shot at fixing this and failed. I'll add in a backend update to point to the solution (install GCC).
This is a real shame to me
@mikehardy: https://github.com/david-allison-1/Anki-Android-Backend/issues/46
Mmm I'll give it a shot I have some time tomorrow morning. Installing gcc isn't the worst as it's such an old (that is well understood and distributed) and package management even on windows is so much better with chocolatey etc. But there's usually a workaround or maybe just one dll or something.
Is this all platforms or just windows?
I have gcc already installed but still getting the error. Using windows 10 rn.
I met this error, too. But in the path it mentioned i can find required .dll file. The same project run on another PC pass all test cases.
Does moving this dll to somewhere on the PATH fix it? libgcc_s_seh-1.zip (sorry about this, I hate distributing unknown binaries)
Does moving this dll to somewhere on the PATH fix it? libgcc_s_seh-1.zip (sorry about this, I hate distributing unknown binaries)
Thanks, it works for some unit test file, but some still not works... 😢
Does moving this dll to somewhere on the PATH fix it? libgcc_s_seh-1.zip (sorry about this, I hate distributing unknown binaries)
Thanks, it works for some unit test file, but some still not works... 😢
That's strange, it should be all or nothing, which files fail and what's the error?
Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically
Just to note, libgcc_s_seh-1.dll has a dependency on libwinpthread-1.dll
if both are in your PATH, then the library will load and the tests should run ok, without installing all of gcc
I'm curious (and facing the same problem... currently downloading 6 Go with Visual Studio Installer only to get a .dll...), why do we need some .dll to run Android Tests ?
After putting libgcc_s_seh-1.dll (76Ko) and libwinpthread-1.dll (65Ko) in a folder inside my PATH, rebooting computer, and launching ./gradlew jacocoTestReport, it still doesn't work.
Error is :
java.lang.UnsatisfiedLinkError: C:\Users\Nino\AppData\Local\Temp\rsdroid3735626077991595567.dll: is not a valid win32 application
Some Espresso tests ran correctly. But as usual, Robolectric is having a lot of issues.
C:\Users\Nino\AppData\Local\Temp\rsdroid3735626077991595567.dll: is not a valid win32 application
Haven't seen this one. I have to confirm: are you running on 64 bit Windows?
Yes, 64 bit Win 10
I believe Git Bash is based on Ming64, which when installed includes both libgcc_s_seh-1.dll and libwinpthread-1.dll in it's default path (/mingw64/bin). Note that PATH is when running a git bash shell; it's not added to the windows PATH by default. That might be an easier way to get the libraries, and you could try running gradlew from the git bash.
Also can post the result from java -version from whatever shell you are using?
Agreed, same conclusions here, it works with basic git bash.
I use PowerShell for Git and other CLI, ./gradlew jacocoTestReport doesn't work with PowerShell, even with the "dll in PATH" trick. The command to open PowerShell with a "Git Touch" is %SystemRoot%\System32\rundll32.exe "%SystemRoot%\System32\dfshim.dll",ShOpenVerbShortcut %LOCALAPPDATA%\GitHub\GitHub.appref-ms|--open-shell
Before trying to run with another shell, I tried running on PowerShell with Java 8 and 13 (I installed 13 since Robolectric had a warning that API 29+ need Java 9+), without result.
I have run the following command in Git Bash and the it build successfully. From android studio there were java.lang.UnsatisfiedLinkError.
./gradlew jacocoUnitTestReport
