Closed slav closed 7 years ago
Interesting. This may be considered a bug in lmdb itself, as the presence of Windows should be detected, and the library tries to select available APIs by default. So it may be worth bringing up on the official mailing list.
Can you tell me any more about your build environment? Are you compiling inside cygwin. It has been a while since I got everything building on Windows.
I haven't found any info in the official openldap-technical mailing list. But I found the following in the mdb.c source file.
/** Some platforms define the EOWNERDEAD error code
* even though they don't support Robust Mutexes.
* Compile with -DMDB_USE_ROBUST=0, or use some other
* mechanism like -DMDB_USE_SYSV_SEM instead of
* -DMDB_USE_POSIX_MUTEX. (SysV semaphores are
* also Robust, but some systems don't support them
* either.)
*/
I doubt that MDB_USE_SYSV_SEM is supported on Windows. But MDB_USE_POSIX_MUTEX may work. If all else fails I think defining MDB_USE_ROBUST=0 will work.
I have pushed a branch, bmatsuo/issues/91/windows-robust-sem
, which defines MDB_USE_POSIX_MUTEX. Can you test it out and let me know if the package builds and the tests pass?
Also, please do let me know what your environment is like. I had a previous issue getting compilation to work on Windows. I'm not sure if that was after robust mutex support was added or not.
Yes, trying to build under cygwin. Do you need any other info? I'll try the other branch and will let you know.
Is this file straight out of LMDB? Or have you modified it in some way for go?
Thanks for the info. I presume you have a 64-bit processor as well, though I doubt architecture is significant.
I have not modified the C source. If you try to compile the LMDB project I think you will run into the same errors.
I noticed in my previous comment that the branch name looked strange because of GitHub markup. The name is bmatsuo/issues/91/windows-robust-sem
, if there was any confusion. Thanks. Let me know how it goes.
I'm getting can't load package: package github.com/bmatsuo/lmdb-go/lmdb: D:\Projects\Go\src\github.com\bmatsuo\lmdb-go\lmdb\lmdb.go: invalid #cgo line: #cgo windows -DMDB_USE_POSIX_MUTEX
Fixing flags to #cgo windows CFLAGS: -DMDB_USE_POSIX_MUTEX
results in the same build error with PTHREAD_MUTEX_ROBUST not found
Although #cgo windows CFLAGS: -DMDB_USE_ROBUST=0
seems to have fixed that part, running into other issues:
D:\Projects\Go\src\github.com\bmatsuo\lmdb-go\lmdb>go build
# github.com/bmatsuo/lmdb-go/lmdb
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingwex
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lmingw32
collect2: error: ld returned 1 exit status
I ended up installing http://tdm-gcc.tdragon.net/ instead of cygwin and everything builds there.
Interestingly enough, master branch builds with tdm-gcc too. I guess something is missing in cygwin compiler. The windows flag is not needed. Need right compiler.
That is very interesting. Thanks for your investigation. Sorry about the bad cgo directive (on my branch). But I'm glad you worked past it.
I did have things compiling under cygwin originally. I wonder why that is no longer working.
When trying to build on windows getting the following error. Any suggestion on how to fix?
The main issue is that
PTHREAD_MUTEX_ROBUST
is undefined.