On 23/01/15 18:10, hyc@symas.com wrote:
LMDB should not be pulled separately from OpenLDAP. I.e., only the bundled version of LMDB should be used with a given version of OpenLDAP.
I've already had this conversation with the gentoo maintainers; they refuse to listen to reason. It's all their problem now.
Still, memalign() is a problem. mdb.c defines HAVE_MEMALIGN, but it may be wrong for the user to -D"HAVE_MEMALIGN" since that may omit whatever #include file declares it. <malloc/malloc.h> (some Apple stuff I think), <malloc.h> dunno what else.
We could drop memalign. malloc(desired space + 1 OS page), then adjust for alignment. On machines with a sane linear address space where we can tell alignment from the address, anyway.
On weirder hosts, you care about them, omit alignment altogether if posix_memalign is missing. And omit O_DIRECT/F_NOCACHE in mdb_env_copy2(). I gather those are why we need alignment.
Branch "mdb/memalign" in git://git.uio.no/u/hbf/openldap.git has draft code.
Daniel: You can try that branch, and configure with CPPFLAGS="-DMDB_MEMALIGN_METHOD=2".
I guess the preprocessor test should be "defined(a test for Darwin: __APPLE__, _MACOSX_ or..?)" and not __PPC__. PowerPC is an architecture, while features like posix_memalign are defined by compilers/operating systems. The macports issue disables mdb for Darwin. Or maybe not, I don't know Mac, Darwin, PPC or Gentoo, or if you just said this has been resolved, so I'll stay out of of that issue.