basho / eleveldb

Erlang LevelDB API
263 stars 176 forks source link

Windows 10: problems compiling eleveldb [JIRA: RIAK-3130] #233

Closed walter-weinmann closed 7 years ago

walter-weinmann commented 7 years ago

I'm running Windows 10 x64 with Cygwin x64.

make is.

$ make -v
GNU Make 4.2.1
Built for x86_64-unknown-cygwin

gcc is:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-5.4.0-1.x86_64/src/gcc-5.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible
Thread model: posix
gcc version 5.4.0 (GCC)

Running make inside the eleveldb directory (from Cygwin shell) gives:

walte@jfww-notebook ~/eleveldb_idea/eleveldb
$ make
./rebar get-deps
==> eleveldb (get-deps)
./rebar compile
==> eleveldb (compile)
Compiling d:/SoftDevelopment/Projects/eleveldb_idea/eleveldb/c_src/eleveldb.cc
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
cl : Command line warning D9002 : ignoring unknown option '-O3'
eleveldb.cc
d:/SoftDevelopment/Projects/eleveldb_idea/eleveldb/c_src/eleveldb.cc(23) : fatal error C1083: Cannot open include file: 'syslog.h': No such file or directory
ERROR: compile failed while processing D:/SoftDevelopment/Projects/eleveldb_idea/eleveldb: rebar_abort
make: *** [Makefile:15: compile] Error 1

How can I fix it?

matthewvon commented 7 years ago

Basho compiles and tests 16 different unix versions. Windows cygwin is not one of those versions. I have not seen a Windows comment / issue in my five years working with Basho. Hence we have no sensitivity or experience to potential issues there.

That said, everything "syslog" within eleveldb is optional. You can remove or comment out all things "syslog" without issue. Basho's leveldb has some syslog usage also. It too would need to be removed. syslog is only used for information and error reporting that falls outside leveldb's typical LOG scenarios.

I am guessing that cygwin actually supports syslog. This problem might be better addressed by researching the location of the syslog.h file within the cygwin environment, then manually adding that path to the include file search list.

walter-weinmann commented 7 years ago

Thank you very much for the response.

I'm very flexible with the development environment on Windows - what would you recommend instead of Cygwin?

matthewvon commented 7 years ago

It has been 10 years since I did any Windows work, longer since using cygwin. My best suggestion is to use search terms of "cygwin" and "syslog" via Google or such. One result was:

http://kb.kaminskiengineering.com/node/382

My opinion is that you would be better off getting cygwin happy with syslog than trying a different solution. But keep in mind I am guessing, not speaking from experience.

The leveldb code heavily uses Unix pthread, posix_fadvise, and memory mapped files. You need a robust library such as cygwin. Writing a Unix/Windows conversion library yourself is possible (been there, done that), but will require a ton of work. Hence you are better off finding existing solutions via the search engines.

matthewvon commented 7 years ago

Another alternative would be to create your own "syslog.h" file. It would need to contain an inline function or #define for the syslog() function ... that does nothing.

matthewvon commented 7 years ago

There may be others in the Riak community that have experience with Windows builds. You should repost your problem and goals to the riak mailing list. Here are the instructions:

http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com