2013-08-27 1 views
3

nodejs 용 C addon을 작성 중이므로 문제없이 node-waf로 모듈을 컴파일하고 작성할 수 있습니다. 하지만 노드 활력을 사용할 필요가 나는 (성공적으로 node-gyp configure 마감) node-gyp build 나는 다음과 같은 오류가 사용하여 모듈을 빌드 할 때 :node-waf wscript를 node-gyp binding.gif로 변환하는 방법

gyp info it worked if it ends with ok 
gyp info using [email protected] 
gyp info using [email protected] | linux | ia32 
make: Entering directory `/root/src/...' 
gyp info spawn make 
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] 
    CXX(target) Release/obj.target/mymodule/mymodule.o 
../mymodule.cc:4:21: warning: MymoduleAPI.hh: No such file or directory 
../mymodule.cc:11: error: expected initializer before '*' token 
../mymodule.cc: In function 'v8::Handle<v8::Value> get_L2TPSettings(const v8::Arguments&)': 
../mymodule.cc:23: error: 'api' was not declared in this scope 
../mymodule.cc: In function 'v8::Handle<v8::Value> set_L2TPSettings(const v8::Arguments&)': 
../mymodule.cc:39: error: 'api' was not declared in this scope 
../mymodule.cc: In function 'void init(v8::Handle<v8::Object>)': 
../mymodule.cc:79: error: 'MymoduleAPI' was not declared in this scope 
../mymodule.cc:79: error: 'create' was not declared in this scope 
../mymodule.cc:80: error: expected primary-expression before ')' token 
../mymodule.cc:83: error: expected primary-expression before ')' token 
../mymodule.cc:83: error: expected `;' before 'dlsym' 
../mymodule.cc:85: error: expected primary-expression before 'void' 
../mymodule.cc:85: error: expected `)' before 'void' 
../mymodule.cc:88: error: 'api' was not declared in this scope 
../mymodule.cc:76: warning: unused variable 'handle' 
make: *** [Release/obj.target/mymodule/mymodule.o] Error 1 
make: Leaving directory `/root/src/...' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:99:17) 
gyp ERR! stack  at Process._handle.onexit (child_process.js:680:10) 
gyp ERR! System Linux 2.6.11-1.1369_FC4 
gyp ERR! command "node" "/usr/local/bin/node-gyp" "build" 
gyp ERR! cwd /root/src/... 
gyp ERR! node -v v0.8.23 
gyp ERR! node-gyp -v v0.9.5 
gyp ERR! not ok 

내 문제는 내 wscript의 차이에 의해 발생 될 수 있음을 추측 및 binding.gyp. 누구든지 wscriptbinding.gyp으로 변환하는 방법을 알고 있습니까?

import Options 
from os import unlink, symlink, popen 
from os.path import exists 

srcdir = "." 
blddir = "build" 
VERSION = "0.0.1" 

def set_options(opt): 
    opt.tool_options("compiler_cxx") 

def configure(conf): 
    conf.check_tool("compiler_cxx") 
    conf.check_tool("node_addon") 
    conf.env.append_value('LINKFLAGS', 
    []) 

def build(bld): 
    obj = bld.new_task_gen("cxx", "shlib", "node_addon") 
    obj.target = "mymodule" 
    obj.source = "mymodule.cc" 
    obj.cxxflags = ["-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", 
     "-I/root/src/../api"] 
    obj.lib = [] 

def shutdown(): 
    if Options.commands['clean']: 
    if exists('mymodule.node'): unlink('mymodule.node') 
    else: 
    if exists('build/Release/mymodule.node') and not exists('mymodule.node'): 
     symlink('build/Release/mymodule.node', 'mymodule.node') 

내 현재 binding.gyp은 다음과 같습니다

{ 
    "targets": [ 
    { 
     "target_name": "mymodule", 
     "sources": [ "mymodule.cc" ], 
    } 
    ] 
} 

당신은 문제가 (config 파일 이외의) 다른 무언가에 의해 발생되는 것을 생각한다면, 당신의 생각은 환영합니다.

답변

2

대답은 :

{ 
    "targets": [ 
    { 
     "target_name": "mymodule", 
     "include_dirs": "/root/src/../api", 
     "sources": [ "mymodule.cc" ], 
    } 
    ] 
}