tier1
tier1

Reputation: 6433

Compiling NodeJs Module against V8

I know this has been asked a couple of times recently, however I'm getting a linker error when trying to compile the simplest module example on Ubuntu 13.04

Inspired by the v8 developer website, I downloaded, compiled and installed nodejs and v8 from source.

I then proceeded to attempt to compile a simple v8 example:

g++ hello_world.cc -o hello_world -Iinclude out/native/obj.target/tools/gyp/libv8_snapshot.a -lpthread

The linker errors that I am getting are:

undefined reference to `v8::HandleScope::~HandleScope()'

along with others within the v8 namespace.

Does anybody have any clue as to what library I am missing? I have the node.h and v8.h header files included in my path. Thanks in advance for your help.

Upvotes: 2

Views: 1146

Answers (1)

vinayr
vinayr

Reputation: 11234

You should use node-gyp tool to build native addons.

npm install -g node-gyp

Add a binding.gyp file in addon's root directory. Check here for an example https://github.com/TooTallNate/node-gyp#the-bindinggyp-file

And then -

node-gyp configure

node-gyp build

Upvotes: 3

Related Questions