我正在尝试构建ibm_db以用于电子应用程序。
构建环境是Windows 7,64位,使用MSVS 2015。
基本节点版本是4.2.6,电子版本0.35.4(ibm_db不适用于Windows 7上的节点5.x,这是使用4.x的最新elctron版本。)
我已经为ibm数据服务器客户端v 10.5安装了CLI驱动程序
使用node-gyp构建会给出以下错误输出:
C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db>node-gyp rebuild --target=0.35.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell --msvs_version=2015
gyp info it worked if it ends with ok
gyp info using node-gyp@3.2.1
gyp info using node@4.2.6 | win32 | x64
gyp info spawn C:\Users\my-user\AppData\Local\Continuum\Anaconda\python.EXE
gyp info spawn args [ 'C:\\Users\\my-user\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=2015',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\my-user\\Node\\sql_gui_test\\node_modules\\ibm_db\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\my-user\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\my-user\\.node-gyp\\0.35.4\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\my-user\\.node-gyp\\0.35.4',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\my-user\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\my-user\\Node\\sql_gui_test\\node_modules\\ibm_db',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\my-user\\Node\\sql_gui_test\\node_modules\\ibm_db\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
odbc.cpp
odbc_connection.cpp
..\src\odbc.cpp(835): warning C4244: 'argument': conversion from 'SQLINTEGER' to 'SQLSMALLINT', possible loss of data [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
odbc_statement.cpp
..\src\odbc_connection.cpp(115): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHENV' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_connection.cpp(115): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
..\src\odbc_connection.cpp(116): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHDBC' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_connection.cpp(116): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
odbc_result.cpp
..\src\odbc_statement.cpp(122): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHENV' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_statement.cpp(122): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
..\src\odbc_statement.cpp(123): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHDBC' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_statement.cpp(123): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
..\src\odbc_statement.cpp(124): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHSTMT' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_statement.cpp(124): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
dynodbc.cpp
..\src\odbc_result.cpp(101): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHENV' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_result.cpp(101): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
..\src\odbc_result.cpp(102): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHDBC' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_result.cpp(102): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
..\src\odbc_result.cpp(103): error C2440: 'static_cast': cannot convert from 'intptr_t' to 'SQLHSTMT' [C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db\build\odbc_bindings.vcxproj]
..\src\odbc_result.cpp(103): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\my-user\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\my-user\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=0.35.4" "--arch=x64" "--dist-url=https://atom.io/download/atom-shell" "" "--msvs_version=2015"
gyp ERR! cwd C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
C:\Users\my-user\Node\sql_gui_test\node_modules\ibm_db>
有什么想法吗?
- 编辑 -
其他信息 -
我发现如果我窃取OSX clidriver文件,并使用这些文件进行构建,我就不会遇到构建错误。
模块实际上并没有起作用,但在尝试连接已知的有效连接字符串成功建立之前,它失败了“[Microsoft] [ODBC驱动程序管理器]函数序列错误”。
我猜这有点期待。
然后我继续使用我的IBM \ SQLLIB目录中的那些文件替换所有包含文件,一次一个并继续重建,直到我可以重现构建错误。
它一直保持完全相同的行为,直到我终于替换“sqlsystem.h”,这导致构建错误再次发布。
我尝试将两个sqlsystem.h文件区分开来,看看是否有任何有意义的东西,但是,唉,我的C ++知识基本上都是零,所以,我不知道如何解释这些。
答案 0 :(得分:1)
我终于明白了!
这个软件包很难在win32上构建 -
请参阅以下issue。
以下是我解决它的方法:
注意:在前面的说明中,为了获得最佳效果,请始终使用列出的任何目录的完全限定路径。
$projectDir/node_modules/ibm_db
node-gyp clean
IBM_DB_HOME
环境变量设置为$projectDir/node_modules/ibm_db/installer/clidriver
node-gyp configure --target=0.35.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell --msvs_version=2015 --IS_DOWNLOADED=true
~./ibm_db/Build/
目录中生成.vcxproj xml文件。您需要手动编辑此文件以删除对“odbc32.lib”clidriver/include/
目录。复制整个“包含”文件夹,然后将其粘贴到$projectDir/installer/clidriver/
(现在您拥有文件夹$projectDir/installer/clidriver/include
)$projectDir/node_modules/ibm_db
目录中,运行:msbuild build/binding.sln /nologo /p:Configuration=Release;Platform=x64
注意:无论出于何种原因,msbuild在我的机器上没有正确的别名,所以我实际运行的命令是:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" build/binding.sln /nologo /p:Configuration=Release;Platform=x64
- 您的里程可能会有所不同。