https://bugs.openldap.org/show_bug.cgi?id=10007
Issue ID: 10007 Summary: lmdb does not work on MSYS2/Cygwin Product: LMDB Version: unspecified Hardware: All OS: Windows Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: liblmdb Assignee: bugs@openldap.org Reporter: facboy@gmail.com Target Milestone: ---
lmdb can be compiled if the correct flags are set on MSYS2/Cygwin, but it does not actually work. `make test` will result in errors.
If `make CPPFLAGS="-DMDB_USE_ROBUST=0"` is used, `mtest` fails with:
mtest.c:50: mdb_env_open(env, "./testdb", MDB_FIXEDMAP , 0664): Invalid argument Aborted (core dumped)
If `make CPPFLAGS="-DMDB_USE_POSIX_SEM=1"` is used, `mtest` fails with:
mtest.c:50: mdb_env_open(env, "./testdb", MDB_FIXEDMAP , 0664): No such file or directory Aborted (core dumped)
https://bugs.openldap.org/show_bug.cgi?id=10007
--- Comment #1 from facboy@gmail.com --- MR at https://git.openldap.org/openldap/openldap/-/merge_requests/603
https://bugs.openldap.org/show_bug.cgi?id=10007
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #2 from Howard Chu hyc@openldap.org --- (In reply to facboy from comment #0)
lmdb can be compiled if the correct flags are set on MSYS2/Cygwin, but it does not actually work. `make test` will result in errors.
If `make CPPFLAGS="-DMDB_USE_ROBUST=0"` is used, `mtest` fails with:
mtest.c:50: mdb_env_open(env, "./testdb", MDB_FIXEDMAP , 0664): Invalid argument Aborted (core dumped)
Obviously: don't do that.
If `make CPPFLAGS="-DMDB_USE_POSIX_SEM=1"` is used, `mtest` fails with:
mtest.c:50: mdb_env_open(env, "./testdb", MDB_FIXEDMAP , 0664): No such file or directory Aborted (core dumped)
Obviously: don't do that. Windows is not a POSIX OS, using any POSIX-specific feature is obviously a mistake. Cygwin tries to add a POSIX-compatibility layer onto Windows - it is not useful here. LMDB on Windows works using native WIN32 APIs. Glue layers like Cygwin or MSYS2 shims do more harm than good here.
https://bugs.openldap.org/show_bug.cgi?id=10007
--- Comment #3 from facboy@gmail.com --- Ok. I'm trying to build another application (knot-resolver) on MSYS, the original problem I ran into was that the knot-resolver uses `mdb_env_get_fd`, which returns a windows file handle from the WIN32-compiled LMDB. knot-resolver expects it to be a POSIX file handle, and it tries to fstat it, which blows up.
https://bugs.openldap.org/show_bug.cgi?id=10007
--- Comment #4 from Howard Chu hyc@openldap.org --- Sounds like you should file a bug with the knot-resolver maintainers. The LMDB docs clearly state:
/** An abstraction for a file handle. * On POSIX systems file handles are small integers. On Windows * they're opaque pointers. */ #ifdef _WIN32 typedef void *mdb_filehandle_t; #else typedef int mdb_filehandle_t; #endif
int mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *fd);
Using a filehandle as a POSIX fd on Windows is obviously wrong.
https://bugs.openldap.org/show_bug.cgi?id=10007
--- Comment #5 from facboy@gmail.com --- Yes...well I guess this is mostly on me. `knot-resolver` is only targeted at POSIX platforms, thus why I'm trying to build it in MSYS. Thanks for the help.
https://bugs.openldap.org/show_bug.cgi?id=10007
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review | Status|RESOLVED |VERIFIED