jbaldwin/libcoro

Builiding error on Msys2(mingw64)

AstroAir opened this issue · 3 comments

I tried to build libcoro in the Msys2 environment, but encountered an error. The main issue was using a library unique to Linux. I hope this error can be fixed. Thank you!

[1/138] Building CXX object CMakeFiles/libcoro.dir/src/net/ip_address.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/net/ip_address.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/net/ip_address.cpp.obj -MF CMakeFiles\libcoro.dir\src\net\ip_address.cpp.obj.d -o CMakeFiles/libcoro.dir/src/net/ip_address.cpp.obj -c C:/Users/libcoro-main/src/net/ip_address.cpp
In file included from C:/Users/libcoro-main/src/net/ip_address.cpp:1:
C:/Users/libcoro-main/include/coro/net/ip_address.hpp:3:10: fatal error: arpa/inet.h: No such file or directory
    3 | #include <arpa/inet.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[2/138] Building CXX object CMakeFiles/libcoro.dir/src/net/socket.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/net/socket.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/net/socket.cpp.obj -MF CMakeFiles\libcoro.dir\src\net\socket.cpp.obj.d -o CMakeFiles/libcoro.dir/src/net/socket.cpp.obj -c C:/Users/libcoro-main/src/net/socket.cpp
In file included from C:/Users/libcoro-main/include/coro/net/socket.hpp:3,
                 from C:/Users/libcoro-main/src/net/socket.cpp:1:
C:/Users/libcoro-main/include/coro/net/ip_address.hpp:3:10: fatal error: arpa/inet.h: No such file or directory
    3 | #include <arpa/inet.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[3/138] Building CXX object CMakeFiles/libcoro.dir/src/poll.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/poll.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/poll.cpp.obj -MF CMakeFiles\libcoro.dir\src\poll.cpp.obj.d -o CMakeFiles/libcoro.dir/src/poll.cpp.obj -c C:/Users/libcoro-main/src/poll.cpp
In file included from C:/Users/libcoro-main/src/poll.cpp:1:
C:/Users/libcoro-main/include/coro/poll.hpp:4:10: fatal error: sys/epoll.h: No such file or directory
    4 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[4/138] Building CXX object CMakeFiles/libcoro.dir/src/io_scheduler.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/io_scheduler.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/io_scheduler.cpp.obj -MF CMakeFiles\libcoro.dir\src\io_scheduler.cpp.obj.d -o CMakeFiles/libcoro.dir/src/io_scheduler.cpp.obj -c C:/Users/libcoro-main/src/io_scheduler.cpp
In file included from C:/Users/libcoro-main/include/coro/detail/poll_info.hpp:4,
                 from C:/Users/libcoro-main/include/coro/io_scheduler.hpp:3,
                 from C:/Users/libcoro-main/src/io_scheduler.cpp:1:
C:/Users/libcoro-main/include/coro/poll.hpp:4:10: fatal error: sys/epoll.h: No such file or directory
    4 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[5/138] Building CXX object CMakeFiles/libcoro.dir/src/net/dns/resolver.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/net/dns/resolver.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/net/dns/resolver.cpp.obj -MF CMakeFiles\libcoro.dir\src\net\dns\resolver.cpp.obj.d -o CMakeFiles/libcoro.dir/src/net/dns/resolver.cpp.obj -c C:/Users/libcoro-main/src/net/dns/resolver.cpp
In file included from C:/Users/libcoro-main/include/coro/detail/poll_info.hpp:4,
                 from C:/Users/libcoro-main/include/coro/io_scheduler.hpp:3,
                 from C:/Users/libcoro-main/include/coro/net/dns/resolver.hpp:4,
                 from C:/Users/libcoro-main/src/net/dns/resolver.cpp:1:
C:/Users/libcoro-main/include/coro/poll.hpp:4:10: fatal error: sys/epoll.h: No such file or directory
    4 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
[6/138] Building CXX object CMakeFiles/libcoro.dir/src/net/tcp/client.cpp.obj
FAILED: CMakeFiles/libcoro.dir/src/net/tcp/client.cpp.obj
E:\msys64\mingw64\bin\c++.exe -DCARES_STATICLIB -DLIBCORO_FEATURE_NETWORKING -DLIBCORO_FEATURE_PLATFORM -DLIBCORO_FEATURE_TLS -IC:/Users/libcoro-main/include -IC:/Users/libcoro-main/build/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares -IC:/Users/libcoro-main/vendor/c-ares/c-ares/include -std=gnu++20 -std=c++20 -fcoroutines -fconcepts -fexceptions -Wall -Wextra -pipe -MD -MT CMakeFiles/libcoro.dir/src/net/tcp/client.cpp.obj -MF CMakeFiles\libcoro.dir\src\net\tcp\client.cpp.obj.d -o CMakeFiles/libcoro.dir/src/net/tcp/client.cpp.obj -c C:/Users/libcoro-main/src/net/tcp/client.cpp
In file included from C:/Users/libcoro-main/include/coro/detail/poll_info.hpp:4,
                 from C:/Users/libcoro-main/include/coro/io_scheduler.hpp:3,
                 from C:/Users/libcoro-main/include/coro/net/tcp/client.hpp:4,
                 from C:/Users/libcoro-main/src/net/tcp/client.cpp:1:
C:/Users/libcoro-main/include/coro/poll.hpp:4:10: fatal error: sys/epoll.h: No such file or directory
    4 | #include <sys/epoll.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

Can you try compiling with LIBCORO_FEATURE_PLATFORM=OFF and let me know how it goes? There are some linux specific features that are built with this flag on and on windows it will fail as you found out. Unfortunately windows doesn't support everything yet in the library.

It didn't work.

-- Building for: Ninja
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: E:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
libcoro C:/Users/Qrm/Downloads/libcoro-main -> git config --local core.hooksPath .githooks
fatal: --local can only be used inside a git repository
libcoro LIBCORO_EXTERNAL_DEPENDENCIES = OFF
libcoro LIBCORO_BUILD_TESTS           = ON
libcoro LIBCORO_CODE_COVERAGE         = OFF
libcoro LIBCORO_BUILD_EXAMPLES        = ON
libcoro LIBCORO_FEATURE_PLATFORM      = OFF
libcoro LIBCORO_FEATURE_NETWORKING    = ON
libcoro LIBCORO_FEATURE_TLS           = ON
CMake Deprecation Warning at vendor/c-ares/c-ares/CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: E:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for res_servicename
-- Looking for res_servicename - not found
-- Looking for res_servicename in resolv
-- Looking for res_servicename in resolv - not found
-- Looking for gethostbyname
-- Looking for gethostbyname - not found
-- Looking for gethostbyname in nsl
-- Looking for gethostbyname in nsl - not found
-- Looking for gethostbyname in socket
-- Looking for gethostbyname in socket - not found
-- Looking for socket
-- Looking for socket - not found
-- Looking for socket in socket
-- Looking for socket in socket - not found
-- Looking for clock_gettime
-- Looking for clock_gettime - found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for include file sys/socket.h
-- Looking for include file sys/socket.h - not found
-- Looking for include file arpa/inet.h
-- Looking for include file arpa/inet.h - not found
-- Looking for include file arpa/nameser_compat.h
-- Looking for include file arpa/nameser_compat.h - not found
-- Looking for include file arpa/nameser.h
-- Looking for include file arpa/nameser.h - not found
-- Looking for include file assert.h
-- Looking for include file assert.h - found
-- Looking for include file errno.h
-- Looking for include file errno.h - found
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file limits.h
-- Looking for include file limits.h - found
-- Looking for include file malloc.h
-- Looking for include file malloc.h - found
-- Looking for include file memory.h
-- Looking for include file memory.h - found
-- Looking for include file netdb.h
-- Looking for include file netdb.h - not found
-- Looking for include file netinet/in.h
-- Looking for include file netinet/in.h - not found
-- Looking for include file netinet/tcp.h
-- Looking for include file netinet/tcp.h - not found
-- Looking for include file net/if.h
-- Looking for include file net/if.h - not found
-- Looking for include file signal.h
-- Looking for include file signal.h - found
-- Looking for include file socket.h
-- Looking for include file socket.h - not found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file strings.h
-- Looking for include file strings.h - found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file stropts.h
-- Looking for include file stropts.h - not found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - not found
-- Looking for include file sys/param.h
-- Looking for include file sys/param.h - found
-- Looking for include file sys/select.h
-- Looking for include file sys/select.h - not found
-- Looking for include file sys/stat.h
-- Looking for include file sys/stat.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file sys/uio.h
-- Looking for include file sys/uio.h - not found
-- Looking for include file time.h
-- Looking for include file time.h - found
-- Looking for include file dlfcn.h
-- Looking for include file dlfcn.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include files winsock2.h, windows.h
-- Looking for include files winsock2.h, windows.h - found
-- Looking for 3 include files winsock2.h, ..., windows.h
-- Looking for 3 include files winsock2.h, ..., windows.h - found
-- Looking for include files winsock.h, windows.h
-- Looking for include files winsock.h, windows.h - found
-- Looking for include file windows.h
-- Looking for include file windows.h - found
-- Performing Test HAVE_SOCKLEN_T
-- Performing Test HAVE_SOCKLEN_T - Success
-- Performing Test HAVE_TYPE_SOCKET
-- Performing Test HAVE_TYPE_SOCKET - Success
-- Performing Test HAVE_BOOL_T
-- Performing Test HAVE_BOOL_T - Success
-- Performing Test HAVE_SSIZE_T
-- Performing Test HAVE_SSIZE_T - Success
-- Performing Test HAVE_LONGLONG
-- Performing Test HAVE_LONGLONG - Success
-- Performing Test HAVE_SIG_ATOMIC_T
-- Performing Test HAVE_SIG_ATOMIC_T - Success
-- Performing Test HAVE_STRUCT_ADDRINFO
-- Performing Test HAVE_STRUCT_ADDRINFO - Success
-- Performing Test HAVE_STRUCT_IN6_ADDR
-- Performing Test HAVE_STRUCT_IN6_ADDR - Success
-- Performing Test HAVE_STRUCT_SOCKADDR_IN6
-- Performing Test HAVE_STRUCT_SOCKADDR_IN6 - Success
-- Performing Test HAVE_STRUCT_SOCKADDR_STORAGE
-- Performing Test HAVE_STRUCT_SOCKADDR_STORAGE - Success
-- Performing Test HAVE_STRUCT_TIMEVAL
-- Performing Test HAVE_STRUCT_TIMEVAL - Success
-- Looking for AF_INET6
-- Looking for AF_INET6 - found
-- Looking for O_NONBLOCK
-- Looking for O_NONBLOCK - not found
-- Looking for FIONBIO
-- Looking for FIONBIO - found
-- Looking for SIOCGIFADDR
-- Looking for SIOCGIFADDR - not found
-- Looking for MSG_NOSIGNAL
-- Looking for MSG_NOSIGNAL - not found
-- Looking for PF_INET6
-- Looking for PF_INET6 - found
-- Looking for SO_NONBLOCK
-- Looking for SO_NONBLOCK - not found
-- Looking for CLOCK_MONOTONIC
-- Looking for CLOCK_MONOTONIC - found
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
-- Performing Test HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID - Success
-- Performing Test HAVE_LL
-- Performing Test HAVE_LL - Success
-- Looking for bitncmp
-- Looking for bitncmp - not found
-- Looking for closesocket
-- Looking for closesocket - found
-- Looking for CloseSocket
-- Looking for CloseSocket - not found
-- Looking for connect
-- Looking for connect - found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for freeaddrinfo
-- Looking for freeaddrinfo - found
-- Looking for getaddrinfo
-- Looking for getaddrinfo - found
-- Looking for getenv
-- Looking for getenv - found
-- Looking for gethostbyaddr
-- Looking for gethostbyaddr - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for gethostname
-- Looking for gethostname - found
-- Looking for getnameinfo
-- Looking for getnameinfo - found
-- Looking for getservbyport_r
-- Looking for getservbyport_r - not found
-- Looking for getservbyname_r
-- Looking for getservbyname_r - not found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for if_indextoname
-- Looking for if_indextoname - not found
-- Looking for inet_net_pton
-- Looking for inet_net_pton - not found
-- Looking for ioctl
-- Looking for ioctl - not found
-- Looking for ioctlsocket
-- Looking for ioctlsocket - found
-- Looking for IoctlSocket
-- Looking for IoctlSocket - not found
-- Looking for recv
-- Looking for recv - found
-- Looking for recvfrom
-- Looking for send
-- Looking for send - found
-- Looking for setsockopt
-- Looking for setsockopt - found
-- Looking for socket
-- Looking for socket - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strcmpi
-- Looking for strcmpi - found
-- Looking for strdup
-- Looking for strdup - found
-- Looking for stricmp
-- Looking for stricmp - found
-- Looking for strncasecmp
-- Looking for strncasecmp - found
-- Looking for strncmpi
-- Looking for strncmpi - not found
-- Looking for strnicmp
-- Looking for strnicmp - found
-- Looking for writev
-- Looking for writev - not found
-- Looking for __system_property_get
-- Looking for __system_property_get - not found
-- Found OpenSSL: E:/msys64/mingw64/lib/libcrypto.dll.a (found version "3.2.0")
-- Configuring done (123.2s)
-- Generating done (0.4s)
-- Build files have been written to: C:/libcoro-main/build
-- Configuring done (123.2s)
-- Generating done (0.4s)
-- Build files have been written to: C:/libcoro-main/build

Did you even read the output? I'm sorry but I don't have time to teach you how to use cmake, please spend some time actually reading and understanding whats going on instead of just pasting blobs and expecting me to do things for you. I kindly showed you the feature flag you needed to disable for windows which is already documented in the readme, and so is how to build the project.