skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.82k stars 207 forks source link

Build issues #305

Closed R2Sam closed 10 months ago

R2Sam commented 11 months ago

Seems that when I build the project on my windows machine using cmake and mingw I get this string of errors after about halfway through the build. I have checked and a libuvw.a file is outputted but unsupringly it doesn't link to anything I can through at it.

[ 31%] Built target uv_a [ 50%] Built target uvw [ 51%] Built target fake [ 52%] Built target gtest [ 54%] Built target gtest_main [ 55%] Building CXX object test/CMakeFiles/main.dir/main.cpp.obj c++.exe: warning: /EHsc: linker input file unused because linking not done c++.exe: error: /EHsc: linker input file not found: No such file or directory mingw32-make[2]: *** [test\CMakeFiles\main.dir\build.make:76: test/CMakeFiles/main.dir/main.cpp.obj] Error 1 mingw32-make[2]: *** Deleting file 'test/CMakeFiles/main.dir/main.cpp.obj' mingw32-make[1]: *** [CMakeFiles\Makefile2:1129: test/CMakeFiles/main.dir/all] Error 2 mingw32-make: *** [Makefile:145: all] Error 2

This is the error msg that I get from cmake, I'm quite new to all this sort of things but I can't seem to find what I'm doing wrong

skypjack commented 11 months ago

No idea, I'm sorry. I don't even know if mingw is fully supported since it's not on the CI nor there is a plan to address it. At first glance, it looks like a linking issue and therefore the error is probably in your cmake file but 🤷‍♂️ it's hard to say from a non-formatted wall of messages as returned by the compiler. Try to provide a little more information if possible. Otherwise, I think there is no way to help you, sorry.

R2Sam commented 11 months ago

Thanks for answering so quickly. Not sure what more info is needed, builds well using MSVC obviusly, but I was hoping to use the library in a project I have going on using mingw, you think there's any way to do this?

fiorentino-at-adesso commented 11 months ago

Best way is to share a common environment to have a look. Can you try to setup such an environment with PR ?

adamdusty commented 10 months ago

I got it to work with mingw by building/installing libuv separately. With libuv installed you can link:
target_link_libraries(myproj libuv::uv uvw::uvw)

Then when you configure your project define -DFIND_LIBUV=ON

I'm sure there's a better way to do it, but that's the quickest workaround I could come up with.

fiorentino-at-adesso commented 10 months ago

FIND_LIBUV prevents the libuv to be fetched by CMake (if it can be found somewhere on the HOST building machine). I'm going to close this, if you are willing to deep dive into more details, feel free to reopen it.