Open matsprea opened 8 years ago
Hey Matteo - haven't had a chance to test libpostal on Windows. Can you post the compilation errors you're seeing?
I'll look into setting up a build on Appveyor, which seems to be the preferred method for Windows CI among Github projects.
I've been playing with trying to get libpostal to compile on windows under mingw64 via MSYS2 and made some progress. The first trick is to get the snappy dependency built. Thankfully most of the work has been done. You just need to make it run the tests properly by adding this to the build() section of PKGBUILD.
cd ${srcdir}
cp -ar "${_realname}-${pkgver}/testdata" "build-${MINGW_CHOST}"
After the snappy package is installed configure will work for libpostal on the mingw64 console, but fail on sparky due to the sys/mman.h
include as mman.h
isn't a windows thing. There is a wrapper, but I haven't been able to get it to work.
hashwriter.c:23:22: fatal error: sys/mman.h: No such file or directory
compilation terminated.
You can just remove the sys/mman.h
include from hashwriter.c
, but then you get a bunch of
hashwriter.c:104:23: error: ISO C does not support the 'I64' ms_printf length modifier [-Werror=format=]
because of the -pedantic
flag.
If you remove the -pedantic
flag you get a bit further and it fails on logreader.c
from the sys/mman.h
:
logreader.c:22:22: fatal error: sys/mman.h: No such file or directory
Unfortunately, removing the sys/mman.h
include here won't get you any further:
logreader.c: In function 'sparkey_logreader_open_noalloc':
logreader.c:78:15: error: implicit declaration of function 'mmap' [-Werror=implicit-function-declaration]
log->data = mmap(NULL, log->data_len, PROT_READ, MAP_SHARED, fd, 0);
And that's as far as I got today as I can't seem to figure out where the -Wimplicit-function-declaration
is coming from. I haven't worked deeply in C/C++ on linux for years (these days I mostly make pinvoke wrappers for .NET or use C++/CLI), so I'm trying to hack my way through it, but it's slow going.
Ideally it would be nice to have a VC++ build, but from what I understand the C99 requirement is a stumbling block.
About mman.h - there's a win32 version: https://github.com/witwall/mman-win32 - it worked for me but I got other errors trying to compile for windows
In libpostal 1.0 the dependency on snappy and mmap have been eliminated, so it should be easier at least to compile on Windows.
I would like to help in writing the .Net bindings for the library, but first I'll need some help to build the library on windows.