Closed kassane closed 1 year ago
Your title talks about MinGW, but the error message states you are compiling with Clang. Can you clarify please? What standard library do you use? The error message states that "C:\hostedtoolcache\windows\zig\master\x64\lib\libcxx" is used. What kind of library is that?
The title is not wrong! Target is mingw equivalent to llvm-mingw or msys2/clang64 both use libc++
instead of libstdc++
.
zig toolchain is pure-llvm (builtin-tools: clang/++ + libcxx + libunwind + (custom)-libcompiler-rt + lld or zld(macOS only)]) based and currently for windows the default target is mingw (x86
, x86_64
, arm64
).
However LLVM doesn't provide a full mingw support, with no add-on libraries like posix support.
Error happens with this function. https://github.com/andreasbuhr/cppcoro/blob/6863ac6f2e2e421c289460fc7cc88f3dda2d5fc8/lib/socket_helpers.cpp#L50-L83
mingw-w64 - ws2def https://github.com/mingw-w64/mingw-w64/blob/master/mingw-w64-headers/include/ws2def.h and zig-mingw - ws2def https://github.com/ziglang/zig/blob/master/lib/libc/include/any-windows-any/ws2def.h they are both identical!
except: https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/shared/ws2def.h
Thanks for clarifying.
The first error says that std::reference_wrapper is undefined. Does it help to #include <functional>
in cppcoro/lib/socket_helpers.cpp?
Thanks for clarifying.
The first error says that std::reference_wrapper is undefined. Does it help to
#include <functional>
in cppcoro/lib/socket_helpers.cpp?
keep (w/ -DSCOPEID_UNSPECIFIED_INIT=1
):
clang failed with stderr: /home/kassane/Documentos/cppcoro/lib/socket_helpers.cpp:78:33: error: no viable overloaded '='
/home/kassane/zig/0.11.0-dev.3773+438d68091/files/lib/libc/include/any-windows-any/ws2def.h:28:16: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'int' to 'const _SCOPE_ID' for 1st argument
/home/kassane/zig/0.11.0-dev.3773+438d68091/files/lib/libc/include/any-windows-any/ws2def.h:28:16: note: candidate function (the implicit move assignment operator) not viable: no known conversion from 'int' to '_SCOPE_ID' for 1st argument
_SCOPE_ID
from ws2def.h
(gnu).
On windows with msbuild(vc++) it worked. Have you tried running the library with mingw?
--- update
My fork, I have removed -DSCOPEID_UNSPECIFIED_INIT=1
. Because, MinGW no has SCOPEID_UNSPECIFIED_INIT
.
/home/kassane/Documentos/cppcoro/lib/socket_helpers.cpp:77:35: error: use of undeclared identifier 'SCOPEID_UNSPECIFIED_INIT'
/home/kassane/Documentos/cppcoro/lib/socket_helpers.cpp:52:43: warning: unused parameter 'address' [-Wunused-parameter]
I did not try mingw.
in https://github.com/tpn/winsdk-10/blob/9b69fd26ac0c7d0b83d378dba01080e93349c2ed/Include/10.0.10240.0/shared/ws2def.h#L625C1-L625C42 you can see that SCOPEID_UNSPECIFIED_INIT is defined to be "{ 0 }". Could you try that?
I don't know the right escaping, but something like -DSCOPEID_UNSPECIFIED_INIT={0} or -DSCOPEID_UNSPECIFIED_INIT={0} or so
Fine!!
Now...
tests error:
scheduling_operator_tests
file_tests
socket_tests
io_service_tests
static_thread_pool_tests
when_all_ready_tests
error: lld-link: undefined symbol: WaitOnAddress
note: referenced by /home/kassane/Documentos/cppcoro/lib/lightweight_manual_reset_event.cpp:52
note: cppcoro.lib(lightweight_manual_reset_event.obj):(cppcoro::detail::lightweight_manual_reset_event::wait())
error: lld-link: undefined symbol: WakeByAddressAll
note: referenced by /home/kassane/Documentos/cppcoro/lib/lightweight_manual_reset_event.cpp:30
note: cppcoro.lib(lightweight_manual_reset_event.obj):(cppcoro::detail::lightweight_manual_reset_event::set())
synchapi.h
feature.
Could you double-check that you link to synchronization.lib ?
Could you double-check that you link to synchronization.lib ?
No have synchonization.lib
on mingw.
Fixed - add in config.hpp
: https://github.com/kassane/cppcoro/commit/fc8597bb1b0702a5b652a39fb8b522d67178e764
#ifdef __MINGW32__
#define _WIN32_WINNT 0x0601
#endif
My fork build log: https://github.com/kassane/cppcoro/actions/runs/5326844101