Ntohll incorrectly linked for NPM installations on MacOS X


#1

When installing from 2.0.x versions NPM on I’m having issues with htonll/ntohll failing to link correctly on MacOS 10.9.5.

The builderror.log from the npm install produces the following warnings

../deps/lcb/src/operations/counter.c:58:31: warning: implicit declaration of function 'ntohll' is invalid in C99 [-Wimplicit-function-declaration]
    acmd.message.body.delta = ntohll((lcb_uint64_t)cmd->delta);
                              ^
1 warning generated.
../deps/lcb/src/handler.c:368:22: warning: implicit declaration of function 'ntohll' is invalid in C99 [-Wimplicit-function-declaration]
        resp.value = ntohll(resp.value);
                     ^
1 warning generated.
../deps/lcb/src/http/http_io.c:199:19: warning: unused variable 'settings' [-Wunused-variable]
    lcb_settings *settings = req->instance->settings;
                  ^
1 warning generated.

As a result when I attempt to use the atomic counter mechanism I receive the following errors from couchnode.

dyld: lazy symbol binding failed: Symbol not found: _ntohll
  Referenced from: ../node_modules/couchbase/build/Release/couchbase_impl.node
  Expected in: dynamic lookup

dyld: Symbol not found: _ntohll
  Referenced from: ../node_modules/couchbase/build/Release/couchbase_impl.node
  Expected in: dynamic lookup

I have been able to reproduce the same behaviour consistently and it has been successfully reproduced under the following documented environments:

Environment 1

  • MacOS X - 10.9.5
  • node-gyp - v1.0.2
  • node - 0.10.26 darwin x64
  • llvm - Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn), x86_64-apple-darwin13.4.0

Environment 2

  • MacOS X - 10.9.5
  • node-gyp - v1.0.2
  • node - 0.10.29 darwin x64
  • llvm - Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn), x86_64-apple-darwin13.4.0

Does anybody have any knowledge which could assist in getting this functionality building from NPM? I’m currently dropping in a working build over the top of the npm-installed …/deps/lcb folder to enable the required functionality. I’ve also been able to build manually in one of the affected environments and have this work correctly so my guess is the issue is related to the environment configuration through node-gyp.


#2

The issue is probably here: https://github.com/couchbase/couchnode/blob/master/deps/lcb/gyp_config/mac/x64/config.h#L85, and likely are missing an include. Note you can also install an existing version of libcouchbase, and then specify --couchbase-root=/usr/local/ (for example) to npm install


#3

Thanks Mark.

I was unaware that you could provide a path to an existing libcouchbase install to npm. I’ve installed the latest version of libcouchbase via brew and provided the path via the couchbase-root param to npm install and everything appears to be working.

Would be great to have this fixed, but the workaround is simple enough.

Thanks again,
Tristan


#4

I believe @brett19 has update of the embedded libcouchbase planned for the next maintenance release. We do maintenance releases on the first Tuesday of each month so it should be built in solved by Jan 6.