簡體   English   中英

使用Electron難以構建節點ibm_db軟件包

[英]Trouble building node ibm_db package with Electron

我正在嘗試構建用於電子應用程序的ibm_db。

使用MSVS 2015的構建環境是Windows 7、64位。

基本節點版本為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文件並使用這些istead進行構建,則不會出現構建錯誤。

該模塊實際上並未真正起作用,但在嘗試使用已知的有效連接字符串成功建立成功連接之前,它將失敗並顯示“ [[Microsoft] [ODBC Driver Manager]功能序列錯誤””。

我想這是預料之中的。

然后,我繼續使用IBM \\ SQLLIB目錄中的我的文件替換所有包含文件,一次替換一個,並一直進行重建,直到可以重現構建錯誤為止。

直到我終於替換掉“ sqlsystem.h”,它仍然保持完全相同的行為,這再次導致生成錯誤。

我嘗試將兩個sqlsystem.h文件進行比較,以查看是否有任何有意義的內容,但是,可惜,我的C ++知識基本上為零,因此,我無所適從地對此進行了解釋。

我終於想通了!

這個軟件包很難在win32上構建-

請參閱以下問題

這是我解決的方法:

注意:在進行操作時,為了獲得最佳效果,請始終對列出的任何目錄使用完全限定的路徑。

  1. 導航至: $projectDir/node_modules/ibm_db
  2. 運行: node-gyp clean
  3. IBM_DB_HOME環境變量設置為$projectDir/node_modules/ibm_db/installer/clidriver
  4. 運行: node-gyp configure --target=0.35.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell --msvs_version=2015 --IS_DOWNLOADED=true
  5. 這將在~./ibm_db/Build/目錄中創建一個.vcxproj xml文件。 您將需要手動編輯此文件以刪除對“ odbc32.lib”的任何引用
  6. 現在,您需要下載linux(是的)64位DB2驅動程序鏈接的頭文件。
  7. 在tar.gz文件中是clidriver/include/目錄。 復制整個“ include”文件夾,並將其粘貼到$projectDir/installer/clidriver/ (因此,您現在有了文件夾$projectDir/installer/clidriver/include
  8. 現在,從$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您的里程可能會有所不同。

  1. - 假設您沒有任何令人討厭的構建錯誤,那么現在您終於完成了構建與Electron一起使用的ibm_db軟件包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM