【发布时间】:2016-04-13 06:23:53
【问题描述】:
我正在尝试使用 MS VS 2015 在 Windows 10 上构建节点模块,但由于某种原因,它无法解析 node-gyp build 上的库符号。这是我的binding.gyp 文件:
{
'variables' : {
'include_path' : 'path/to/include',
'lib_path': '/path/to/lib',
},
'targets': [
{
// name and sources here
'include_dirs': [
'<(include_path)',
],
'libraries': [
'<(lib_path)',
],
},
],
}
由于某种原因,它无法解析库中的任何符号。这是输出的sn-p:
ProjectBuild.obj : error LNK2001: unresolved external symbol __imp__AiMsgSetLogFileFlags [\path\to\build\project_build.vcxproj]
ProjectBuild.obj : error LNK2001: unresolved external symbol __imp__AiRenderInterrupt [\path\to\build\project_build.vcxproj]
此外,这里是该库的目标文件转储中这些符号的反汇编:
Disassembly of section .text:
0000000000000000 <AiMsgSetLogFileFlags>:
0: ff 25 00 00 00 00 jmpq *0x0(%rip) # 6 <AiMsgSetLogFileFlags+0x6>
6: 90 nop
7: 90 nop
ai.dll: file format pei-x86-64
Disassembly of section .text:
0000000000000000 <AiRenderInterrupt>:
0: ff 25 00 00 00 00 jmpq *0x0(%rip) # 6 <AiRenderInterrupt+0x6>
6: 90 nop
7: 90 nop
ai.dll: file format pei-x86-64
我可以 100% 确定 node-gyp 正在查找库文件。有谁知道为什么在链接该文件中的符号时遇到问题?对于它的价值,我能够在 linux 环境中使用完全相同的 binding.gyp 文件构建该模块。
【问题讨论】:
标签: c++ node.js windows linker node-gyp