I am trying to build some example addons for Node on Linux Mint 17. I keep getting errors. I have tried to change the compiler to clang and also tried using [NAN][1] but I am still getting errors
the clang compiler generates less errors than g++, but I still get
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.30 | linux | x64
gyp info spawn python
gyp info spawn args [ '/home/someuser/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/someuser/workspace/nonameproject/anothertest/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/someuser/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/someuser/.node-gyp/0.10.30/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/someuser/.node-gyp/0.10.30',
gyp info spawn args '-Dmodule_root_dir=/home/someuser/workspace/nonameproject/anothertest',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/home/someuser/workspace/nonameproject/anothertest/build'
CXX(target) Release/obj.target/addon/addon.o
clang: error: unknown argument: '-fno-tree-vrp'
make: *** [Release/obj.target/addon/addon.o] Error 1
make: Leaving directory `/home/someuser/workspace/nonameproject/anothertest/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/someuser/local/lib/node_modules/node- gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "node" "/home/someuser/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/someuser/workspace/nonameproject/anothertest
gyp ERR! node -v v0.10.30
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
If I use the G++ compiler with NAN I get:
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory /home/someuser/workspace/nonameproject/anothertest/build'
CXX(target) Release/obj.target/addon/addon.o
In file included from ../addon.cc:11:0:
.././sync.h:2:8: error: expected constructor, destructor, or type conversion before ‘-’ token
* NAN - Native Abstractions for Node.js
^
../addon.cc: In function ‘void InitAll(v8::Handle<v8::Object>)’:
../addon.cc:23:30: error: ‘CalculateSync’ was not declared in this scope
NanNew<FunctionTemplate>(CalculateSync)->GetFunction());
^
make: *** [Release/obj.target/addon/addon.o] Error 1
make: Leaving directory
/home/someuser/workspace/nonameproject/anothertest/build'
If I use G++ without NAN, I get:
make: Entering directory `/home/someuser/workspace/nonameproject/mytest/build'
CXX(target) Release/obj.target/binding/binding.o
../binding.cc:6:19: error: ‘FunctionCallbackInfo’ in namespace ‘v8’ does not name a type
void Method(const v8::FunctionCallbackInfo<Value>& args) {
^
../binding.cc:6:23: error: ISO C++ forbids declaration of ‘parameter’ with no type [- fpermissive]
void Method(const v8::FunctionCallbackInfo<Value>& args) {
^
../binding.cc:6:43: error: expected ‘,’ or ‘...’ before ‘<’ token
void Method(const v8::FunctionCallbackInfo<Value>& args) {
^
../binding.cc: In function ‘void Method(int)’:
../binding.cc:8:28: error: no matching function for call to ‘v8::HandleScope::HandleScope(v8::Isolate*&)’
HandleScope scope(isolate);
and so on ....
Can someone please explain what the issue is, and how I might fix my environment to compile a basic Node addon example ? Is it to do with C++11 or something broken in V8 ??