简体   繁体   English

在Windows构建上解析node-gyp外部库符号

[英]node-gyp resolving external library symbols on windows build

I'm trying to build a node module on Windows 10 with MS VS 2015 and for some reason it's unable to resolve library symbols on node-gyp build . 我正在尝试在Windows 10上使用MS VS 2015构建节点模块,由于某种原因,它无法解析node-gyp build上的库符号。 Here is my binding.gyp file: 这是我的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)',
            ],
        },
    ],
}

For some reason, it's unable to resolve any symbols in the library. 由于某种原因,它无法解析库中的任何符号。 Here is a snippet of the output: 这是输出的代码段:

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]

In addition, here is the disassembly of those symbols in the object file dump for that library: 此外,这是该库的目标文件转储中的那些符号的反汇编:

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

I can confirm with 100% certainty that node-gyp is finding the library file. 我可以100%确定地确认node-gyp正在查找库文件。 Does anyone know why it's having trouble linking the symbols in that file? 有谁知道为什么在链接该文件中的符号时遇到麻烦? For what it's worth, I'm able to build the module just fine in a linux environment with the exact same binding.gyp file. 对于它的价值,我能够使用完全相同的binding.gyp文件在Linux环境中构建该模块。

You need to look into making sure that the symbols you want to export have this. 您需要研究确保要导出的符号具有此符号。 https://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=vs.140%29.aspx https://msdn.microsoft.com/zh-CN/library/3y1sfaz2%28v=vs.140%29.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM