我创建了一个包含git子模块libxml2
的项目。我想在binding.gyp
中使用此文件,但在运行node-gyp build
时出错。这里的问题是只有xmlversion.h.in
个文件,但需要xmlversion.h
个文件。
当我运行libxml2
autotools
脚本时,首先一切正常,因为xmlversion.h
会在xmlversion.h.in
之外创建xmlversion.h
文件
有没有办法使用node-gyp
创建bindings.gyp
文件?
我当前的{
'targets': [{
'target_name': 'library',
'product_extension': 'node',
'type': 'shared_library',
'include_dirs': [
'libxml2/include',
'libxml2',
"<!(node -e \"require('nan')\")"
],
'cflags': [ '-Wall' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-Wall' ]
},
'sources': [
# src/my_files.cc
# libxml2/libxml2_files.c
]
}]
}
看起来像这样:
==5935== Invalid write of size 1
==5935== at 0x50EAEEF: SetAggressiveDecommit (page_heap.h:197)
==5935== by 0x50EAEEF: SetupAggressiveDecommit (static_vars.cc:120)
==5935== by 0x50EAEEF: google_init_module_tcmalloc_setup_aggressive_decommit (static_vars.cc:122)
==5935== by 0x50EAEEF: GoogleInitializer (googleinit.h:46)
==5935== by 0x50EAEEF: __static_initialization_and_destruction_0 (static_vars.cc:122)
==5935== by 0x50EAEEF: _GLOBAL__sub_I_static_vars.cc (static_vars.cc:124)
==5935== by 0x400F3A2: _dl_init (in /usr/lib64/ld-2.17.so)
==5935== by 0x4001469: ??? (in /usr/lib64/ld-2.17.so)
==5935== Address 0x8309c is not stack'd, malloc'd or (recently) free'd
答案 0 :(得分:0)
解决文件中.h.in
问题的最佳解决方案是使用autotools
构建它并将创建的.h
文件复制到项目的其他目录(So子模块不会受到影响)。此外,您可能必须为多个平台或体系结构构建这些文件。之后,您可以在包含中添加新文件夹。一个非常好的解决方案可以在这里找到: