miwarnec / DOTSNET

Public DOTSNET issue tracker
20 stars 0 forks source link

DllNotFoundException: libuv #31

Closed Radivarig closed 3 years ago

Radivarig commented 3 years ago

On fresh project and import of DOTSNET 1.18 and Unity 2020.1.2, 2020.1.4, 2020.1.6 versions this error is thrown when trying to run the benchmark scene:

DllNotFoundException: libuv
libuv2k.Native.NativeMethods..cctor () (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/libuv2k/Native/NativeHandles.cs:181)
Rethrow as TypeInitializationException: The type initializer for 'libuv2k.Native.NativeMethods' threw an exception.
libuv2k.Loop..ctor () (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/libuv2k/Handles/Loop.cs:16)
DOTSNET.Libuv.LibuvTransportServerSystem.Start () (at Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/DOTSNET/LibuvTransportServerSystem.cs:61)
DOTSNET.NetworkServerSystem.StartServer () (at Assets/DOTSNET/Scripts/ECS/NetworkServer/NetworkServerSystem.cs:113)
DOTSNET.NetworkServerAuthoring.StartServer () (at Assets/DOTSNET/Scripts/Authoring/NetworkServerAuthoring.cs:42)
DOTSNET.NetworkServerHUD.OnGUI () (at Assets/DOTSNET/Scripts/Authoring/NetworkServerHUD.cs:21)

When I select the dll and press Plugin load settings > Load on startup > Apply this is thrown:

Plugins: Failed to load 'Assets/DOTSNET/Scripts/ECS/Transport/Transports/libuv/libuv_binaries/windows/libuv.dll' because one or more of its dependencies could not be loaded.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I tried deleting the dll and reimporting it as one user on the discord suggested but the problem persists.

Radivarig commented 3 years ago

Happens for both architectures x86 and x86_64

shredder2500 commented 3 years ago

Also having this issue

Radivarig commented 3 years ago

I've installed Dependencies. When I run dependenciesgui and select the libuv.dll it says these are missing:

I've installed vc_redist.x64.exe from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and restarted but still the same.

Radivarig commented 3 years ago

So.. I've installed Visual Studio Community edition and about 10gb of stuff through the Visual Studio Installer:

(Not sure if all three were necessary but that is what I ticked)

And after the restart it solved these dll errors...

miwarnec commented 3 years ago

hey guys. having to install dependencies sucks. this is supposed to work out of the box, will take a look.

miwarnec commented 3 years ago

@Radivarig which windows version exactly?

shredder2500 commented 3 years ago

I had the same issue, got it working on my machine with installing the below options. not sure what ones did the trick but the three listed above did not do it alone for me. Also below is my OS info. Same issue on Playfab server. mcr.microsoft.com/playfab/multiplayer:wsc-10.0.17134.950

Edition: Windows 10 Pro Insider Preview Version: 2004 OS Build: 20221.1000

Radivarig commented 3 years ago

@vis2k Windows Home 10.0.19041

Aeonwalker commented 3 years ago

@vis2k I installed the dependencies that Radivarig suggested. However, I don't think those are necessary, but I could be wrong as I haven't tested it. I did get the issue to go away though after completely uninstalling Visual Studio that unity provided and then using the visual studio community installer to setup Visual Studio fixed the issue. I selected the 3 (.NET desktop development, Desktop development with C++, Game development with Unity) that Radivarig suggested.

I believe the main issue for why this issue pops up is because "ucrtbased.dll" was not found in my windows directory. Installing the dependencies did not fix it. Doing what I mentioned above properly installed the missing "ucrtbased.dll" into my windows directory as it didn't exist before doing what I did above.

EDIT I don't have DOTSNET. This was for the 2.21 version of UMMORPG CE which I would imagine both are using the same libuv files.

miwarnec commented 3 years ago

thanks for feedback guys. currently setting up a fresh windows 10 to try and reproduce it.

miwarnec commented 3 years ago

alright, managed to reproduce it in a fresh W10 install: 2020-10-03_10-53-36

miwarnec commented 3 years ago

including the libuv.lib file found in windows build folder does not work. I opened a ticket at libuv repo, perhaps they have answers: https://github.com/libuv/help/issues/174

@Aeonwalker how did you find out that ucrtbased.dll is missing? Do you know if any others are missing? We can try to include them in the Unity folder, maybe that fixes it.

Radivarig commented 3 years ago

@Aeonwalker the program "Dependencies" is a tool that you have to open libuv.dll with in order to see what dependencies of the selected DLL are not found on your system, then you can start obtaining each of the missing ones. For me it was the three I've listed, for others it might be something else as well.

Aeonwalker commented 3 years ago

@vis2k I used the dependencies tool that @Radivarig posted. If you download the tool and run the program "dependenciesgui", you can load the "libuv.dll" file that came with DOTSNET/UMMORPG CE. It'll spit out the dependencies and tell you if something is missing. For me, "ucrtbased.dll" was missing while I had the other ones that @Radivarig was missing. I also recently wiped all files on my laptop and did a fresh install of windows 10 pro (version 2004, os build 19041.508).

I did some googling and found out from a forum where people trying to use libuv also had a similar issue with this "ucrtbased.dll" file missing. They would have the "ucrtbase.dll" file existing in the windows system directory, but the "ucrtbased.dll" wasn't there.

miwarnec commented 3 years ago

thanks for sharing the tool @Radivarig . checking :)

miwarnec commented 3 years ago

again, thanks for sharing the Dependencies tool :) turns out we need vcruntime140d.dll and ucrtbased.dll for libuv.dll to run.

miwarnec commented 3 years ago

some more research: https://stackoverflow.com/questions/39010509/vcruntime140-dll-vs-vcruntime140d-dll

vcruntime140.dll is present by default. vcruntime140d.dll is the debug version, which is not present.

ucrtbase.dll is present by default. ucrtbased.dll is the debug version, which is not present.

the solution is to either ship the 'd' versions along libuv.dll, or find out how to build it as release.

miwarnec commented 3 years ago

testing release build now

miwarnec commented 3 years ago

works perfectly: 2020-10-03_12-39-26

thanks everyone for help. will deploy it to DOTSNET again. hopefully the release build isn't detected as virus anymore either :)

Radivarig commented 3 years ago

Great!