There is a fair amount of work involved to port it cleanly to native WIN32. I spent a few afternoons on it to get a feel for it. That said I believe it builds in Cygwin...
I try to complie libh2o using mingw. but gnulib-tool can't support cmake.I failed to import
I just built libh2o via CYGWIN. There is only a minor change required:
$ cmake . -G"Unix Makefiles" -DWITH_BUNDLED_SSL=0 -DWITH_MRUBY=0 -DLIBUV_LIBRARIES=~/git/libuv/.libs/libuv.a -DLIBUV_INCLUDE_DIR=~/git/libuv/include -DLIBUV_VERSION=1.11.0
$ make examples-simple
$ git diff
diff --git a/deps/libyrmcds/yrmcds_portability.h b/deps/libyrmcds/yrmcds_portability.h
index c9fd4d91..b1f151d4 100644
--- a/deps/libyrmcds/yrmcds_portability.h
+++ b/deps/libyrmcds/yrmcds_portability.h
@@ -27,7 +27,7 @@
# define htole64(x) OSSwapHostToLittleInt64(x)
# define be64toh(x) OSSwapBigToHostInt64(x)
# define le64toh(x) OSSwapLittleToHostInt64(x)
-#elif defined(__linux__)
+#elif defined(__linux__) || defined (__CYGWIN__)
# include <endian.h>
#elif defined(sun) // Solaris
# include <sys/byteorder.h>
I tried building the complete server today - it worked. Now I can use h2o on Windows. I think this should be submitted in a pull request.
This thread is now more than 3 years old. h2o has changed since then and the current sources no longer build or work as-is on MingW (if they ever did). I made a patch for h2o while porting Urbit to Windows that the h2o project might be interested in. Its scope is limited to what I needed for Urbit: only the libuv variant is built, and no fastcgi or memcached support. The biggest change by line count is caused by libuv uv_buf_t and h2o h2o_iovec_t declaring the two fields in reverse order: on MingW, libuv uses the WinSock order to avoid extra copying, whereas h2o uses the POSIX order. The patch swaps the fields in h2o_iovec_t if built on MingW.
/cc @kazuho
Most helpful comment
I just built libh2o via CYGWIN. There is only a minor change required: