猿问

使用 swig 为 C++ 到 javascript 创建包装器时构建错误

我正在 swig 中为 javascript 构建一个 C++ 包装器。创建的 example.i 文件编译并创建了 example_wrap.cxx 文件,然后在使用 node-gyp 编译时它给出了构建错误。


错误 :


make: Entering directory '/home/snehabhapkar/Videos/swig/example1/build'

make: *** No rule to make target 'Release/obj.target/example/example.o', needed by 'Release/obj.target/example.node'.  Stop.

make: Leaving directory '/home/snehabhapkar/Videos/swig/example1/build'

gyp ERR! build error 

gyp ERR! stack Error: `make` failed with exit code: 2

gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:196:23)

gyp ERR! stack     at ChildProcess.emit (events.js:198:13)

gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

gyp ERR! System Linux 5.0.9-301.fc30.x86_64

gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "configure" "build"

gyp ERR! cwd /home/snehabhapkar/Videos/swig/example1

gyp ERR! node -v v10.16.0

gyp ERR! node-gyp -v v5.0.3

gyp ERR! not ok

请帮忙 !谢谢 :)


例子.i

%module example


%inline %{

extern int gcd(int x, int y);

extern double Foo;

%}

运行以下命令会生成 example_wrap.cxx 文件。

swig -javascript -node -c++ example.i

绑定.gyp

{

  "targets": [

    {

      "target_name": "example",

      "sources": [ "example.cxx", "example_wrap.cxx" ]

    }

  ]

}

建筑给出了上述错误。

node-gyp configure build


九州编程
浏览 284回答 1
1回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答