couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joan Touzet <>
Subject Windows build blocked by khash NIF
Date Sun, 12 Jul 2015 00:14:58 GMT
Hello everyone,

Progress on the Windows build was surprisingly smooth, thanks to native
MSVC build chain support in rebar, and improved in the version I am
running locally (2.6.0).

Unfortunately, we have a release blocker on Windows in the khash NIF.
This NIF expects to call an Erlang BEAM VM internal function,
make_hash2(). This function is *not* exported in erl_interface, and only
works on *NIX platforms because the khash .so NIF is loaded into a
calling binary that has make_hash2 defined internally.

It is very naughty that we do this, and I'm disappointed this code made
it into the tree in its current state. But such is life ^_^;

On Windows, the BEAM VM is self-contained in a dll (beam.smp.dll) which
is called by a nearly stub-sized Erlang executable (erl.exe).  The
beam.smp.dll exports only 3 functions, none of which are make_hash2().

Further complicating things, on Windows any DLL that calls an
external requires that external function to be declared in a .lib
or .def file sourced from the original. I attempted faking a 
beam.smp.def/beam.smp.lib of the form:


and linking, but to no avail - again because make_hash2 is optimized
away inside of the beam.smp.dll, not externally referenceable.

In short, we have three options:

  1) Build a custom beam.smp.dll on Windows that exports make_hash2

  2) Revert to the old-style ets approach on Windows, conditionally
     using khash only on *NIX.

  3) Ship CouchDB 2.0 without a Windows build.

My research about this time last year indicated that Windows downloads
of CouchDB actual exceeded downloads of couchdb.tar.gz from, on the order of ~10000 DLs per month total
(between 500-2000 per month more than the tarball.) My guess is that a
lot of developers use it for local developing or prototyping purposes.
Either way, it seems the Windows build is popular, and we drop support
for it in 2.0 at our peril.


View raw message