Hi,
I've just tried compiling the sources on a windows host using mingw-w64. Specifically:
- my host and target are 64-bit
- I used the x64-4.8.1-release-win32-seh-rev5 binaries (structured exception handling with native windows threads)
- autoreconf was from the msys binaries
I basically ran "autoreconf -i" followed by "./configure" in the c++ folder. Then during "make" the build stopped at:
libtool: compile: g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR=\"/usr/local/include\" -mthreads -O2 -DNDEBUG -mthreads -MT src/kj/exception.lo -MD -MP -MF src/kj/.deps/exception.Tpo -c src/kj/exception.c++ -DDLL_EXPORT -DPIC -o src/kj/.libs/exception.o
src/kj/exception.c++:31:22: fatal error: sys/mman.h: No such file or directory
#include <sys/mman.h>
^
I was wondering if it is at all possible to build with mingw under windows. This missing header seems to indicate mingw does not support some memory mapping/protection API? Anyway, I just commented out the include to see what happens and the build failed at:
libtool: compile: g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I./src -I./src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DC
APNP_INCLUDE_DIR=\"/usr/local/include\" -mthreads -O2 -DNDEBUG -mthreads -MT src/kj/exception.lo -MD -MP -MF src/kj/.dep
s/exception.Tpo -c src/kj/exception.c++ -DDLL_EXPORT -DPIC -o src/kj/.libs/exception.o
src/kj/exception.c++:152:30: error: 'siginfo_t' has not been declared
void crashHandler(int signo, siginfo_t* info, void* context) {
Not sure if that header was related to signal processing, but looking at the code I saw that it was just a constructing a message with information about the signal received, and it was actually only using signo and not touching the siginfo_t info pointer. So I thought I'd persist and changed the declaration to (siginfo_t* to void*):
void crashHandler(int signo, void* info, void* context) {
I also changed the call to strsignal to a fixed message since I can live without it, like this:
auto message = kj::str("*** Received signal #", signo, ": ", "strsignal(signo) n/a in mingw",
...and compilation proceeded to "sort of succeed". It failed at:
echo capnp.exe capnpc-c++.exe src/capnp/test.capnp src/capnp/test-import.capnp src/capnp/test-import2.capnp | (read CAPN
P CAPNPC_CXX SOURCES && ./$CAPNP compile --src-prefix=./src -o./$CAPNPC_CXX:src -I./src $SOURCES)
plugin:./.libs/lt-capnpc-c++.c:239: FATAL: couldn't find plugin.
*** Uncaught exception ***
kj/io.c++:276: disconnected: miniposix::write(fd, pos, size): Broken pipe; fd = 4
Makefile:2897: recipe for target `test_capnpc_middleman' failed
make: *** [test_capnpc_middleman] Error 1
As far as I can tell:
- I managed to build capnp.exe. It exists and I can run it.
- For some reason when the build tried to use capnp.exe to process a test.capnp it failed due to some plugin missing
Now, I've never used capnp, it's my first experience with it. I also normally steer away from windows in my work so I only installed MinGW in order to do this build (I use it for nothing else, it's just that I feel much more comfortable with a gcc compiler than visual studio so it would be easier for me). As you might expect my questions are quite basic as I'm a absolute newbie:
1) Is anyone compiling capnp with mingw on windows? Is it supposed to work?
2) Why does my build fail to run that capnp command? What plugin is missing? Is it something that ./configure caused to be left out? I didn't specify any options when configuring, just the defaults.
3) The changes needed to produce the binary seem quite minimal. Would you be interested in a more appropriate patch to get it to work out of the box?
Thanks!