Link node.js addon to static library

466 views
Skip to first unread message

Rohit Harchandani

unread,
Jan 10, 2017, 8:35:33 AM1/10/17
to nod...@googlegroups.com
Hi,

I have a static library built on my 64-bit Mac OSX (libcryptopp.a). I use this to create a node.js addon which works fine on my machine. However, when I build the same module on a colleagues machine (again a 64-bit Max OS X), using the same static library built on my machine, the node module does not work. On loading the module, the following error is thrown:

module.js:583

  return process.dlopen(module, path._makeLong(filename));

                 ^


Error: dlopen(/Users/rharchandani/node_modules/seif-crypto-node/build/Release/seif-crypto-node.node, 1): Symbol not found: __ZN8CryptoPP10RandomPool18IncorporateEntropyEPKhm

  Referenced from: /Users/rharchandani/node_modules/seif-crypto-node/build/Release/seif-crypto-node.node

  Expected in: flat namespace

 in /Users/rharchandani/node_modules/seif-crypto-node/build/Release/seif-crypto-node.node

    at Error (native)

    at Object.Module._extensions..node (module.js:583:18)

    at Module.load (module.js:473:32)

    at tryModuleLoad (module.js:432:12)

    at Function.Module._load (module.js:424:3)

    at Module.require (module.js:483:17)

    at require (internal/module.js:20:19)

    at Object.<anonymous> (/Users/rharchandani/node_modules/seif-crypto-node/index.js:1:75)

    at Module._compile (module.js:556:32)

    at Object.Module._extensions..js (module.js:565:10)


The above symbol is from the static library. Any other C++ program built using the same static library, works on both the machines. Any help is appreciated.


Thanks,

Rohit

Ryan Schmidt

unread,
Jan 13, 2017, 10:19:16 PM1/13/17
to nod...@googlegroups.com
Difficult to say without further information.

What versions of macOS are you using? Is it possible there is a C++ library mismatch? Apple switched the default C++ library from libstdc++ in OS X 10.8 and earlier to libc++ in OS X 10.9 and later.

On macOS, it has always been preferable to use dynamic libraries anyway; maybe you should try that.

vincent...@yahoo.com

unread,
Jan 14, 2017, 2:49:50 PM1/14/17
to nod...@googlegroups.com

--------------------------------------------
On Fri, 1/13/17, Ryan Schmidt <googl...@ryandesign.com> wrote:

Subject: Re: [nodejs] Link node.js addon to static library
To: nod...@googlegroups.com
Date: Friday, January 13, 2017, 4:24 AM
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the
Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails
from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/B087F474-6B53-4ACC-A729-1921A21F3E92%40ryandesign.com.
For more options, visit
https://groups.google.com/d/optout.orientari in cadrul economiei. Domina inca productia intreprinderilor mici si
Reply all
Reply to author
Forward
0 new messages