libuv / help

Need help with libuv? Post your question here.
28 stars 7 forks source link

Build libuv for Windows using GitHub Actions #180

Open kroggen opened 3 years ago

kroggen commented 3 years ago

I am trying to build libuv for Windows using GItHub Actions, so it can be shared and anyone can use the workflow (and the binaries).

I was able to make it work but the DLL is depending on:

VCRUNTIME140.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll

This can be avoided by compiling with /MT when using MSVC. I tried to do this with CMake but no much success. There are some notes here:

https://stackoverflow.com/questions/14172856/compile-with-mt-instead-of-md-using-cmake

Also, the build for Windows 32-bit failed with:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(358,5):
error MSB8013: This project doesn't contain the Configuration and Platform combination of Debug|Win32. 

If you have interest on this, the repo is here on branch cmake. There is also a build branch for a build attempt without cmake.

kroggen commented 3 years ago

By the way, why is it so hard to get binaries for Windows?

You do not have an idea of how many hours (spanning many days!!!) we waste trying to just get a f**ing updated libuv DLL for Windows without those trash dependencies

kroggen commented 3 years ago

OK, I was able to fix the dependencies using this block before the add_library on CMakeLists.txt:

if(MSVC)
  add_compile_options(
      $<$<CONFIG:>:/MT>
      $<$<CONFIG:Debug>:/MTd>
      $<$<CONFIG:Release>:/MT>
  )
endif()

Now just lacking a method to compile libuv for Windows 32-bit (not high priority though)