undreamai/LLMUnity

Access to archchecker.dll denied

Closed this issue · 13 comments

Describe the bug

"UnauthorizedAccessException: Access to the path 'archchecker.dll' is denied."

is thrown for me when attempting to build a project to Android. The file in question (along with all parent directories) all have R/W perms on the User Account I am on. The file itself is in StreamingAssets, where I assume it should be.

EDIT: The file is apparently 'in use'. By what, I do not know. After running the application in the Editor then compiling to an Android phone, it fails because archchecker.dll is still being used by something. I assume this is because I ran it in the Editor first and it failed to close it when stopping the runtime. Any solutions for this?

Steps to reproduce

No response

LLMUnity version

2.2.3

Operating System

Windows

Strange I haven't seen that before.
Could you restart Unity and try again?

I updated the question, it does work after a restart but fails again once using Editor play then compiling to Android. Something keeps the archchecker.dll file on a handle and prevents build.

Could you try adding:

LibraryLoader.FreeLibrary(archCheckerHandle);

after this line:
https://github.com/undreamai/LLMUnity/blob/main/Runtime/LLMLib.cs#L305
and see if it works for you?

archchecker.dll no longer is in use, but undreamai_windows-avx2.dll is (and all other .dll's that are started we could assume)

Are you running the scene while building?
If yes could you stop it first and then build to Android?

I can't use the scene while I am building, it force stops the engine's play mode. Regardless, I stop it before building.

The fix you gave me worked for the archchecker.dll file, it just also needs to be applied to every other .dll that is used when I run the LLM on PC.

I can replicate the issue.
It should be working for the other DLL as well (due to this line) but apparently not.
I'm on it 👍

Great, thanks for your help. Let me know when a permanent solution is found.

In the meantime, if you try to build it a second time it seems to work.

The .dll's never become freed up for me unless the engine is force-closed. I will just have to only compile to phone without Editor play mode until a solution is found.

Could you copy and send me the entire error from the Debug messages?

I believe I solved it, at least on my machine.
Could you try this?
https://github.com/undreamai/LLMUnity/pull/252/files
I'll create a patch release asap

@MohxGames this is solved in v2.2.4.