не удалось запустить электронное восстановление с помощью ffi в windows 10 (src \ ffi.cc (228): ошибка C2065: «дескриптор»: необъявленный идентификатор) - PullRequest
0 голосов
/ 03 июля 2019

Мне нужно использовать модуль "FFI" в проекте узла электронов.Я могу использовать "gyp", чтобы перестроить его и использовать библиотеку в узле, но я не могу перестроить его, используя "электронное перестроение", и использовать его в электроне.

Я выполнил:

cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../

Это дает мне следующую ошибку.(Я удалил некоторые предупреждения, так как он превышает ограничение на количество символов в переполнении стека. Весь журнал находится в: https://github.com/electron/electron-rebuild/issues/308)

> cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../

× Rebuild Failed

An unhandled error occurred inside electron-rebuild
�ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ�����ӡ�/m�����ء�
  Building assembly file ..\..\..\deps\libffi\src\x86\win64.asm
   Assembling: ..\..\..\deps\libffi\src\x86\win64.asm
  prep_cif.c
  types.c
  raw_api.c
  java_raw_api.c
  closures.c
  ffi.c
  win_delay_load_hook.cc
  ffi.vcxproj -> D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\Release\\libffi.lib
  ffi.cc
  callback_info.cc
  threaded_callback_invokation.cc
  win32-dlfcn.cc
  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2389): note: see declaration of 'v8::Value::ToBoolean' (compiling source file ..\src\callback_info.cc)c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2389): note: see declaration of 'v8::Value::ToBoolean' (compiling source file ..\src\threaded_callback_invokation.cc)

  win_delay_load_hook.cc
..\src\callback_info.cc(208): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  d:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'
..\src\callback_info.cc(208): error C2275: 'v8::Object': illegal use of this type as an expression..\src\ffi.cc(63): warning C4996: 'Nan::ForceSet': was declared deprecated [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]

  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(3257): note: see declaration of 'v8::Object'd:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'

..\src\callback_info.cc(208): error C2065: 'target': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(64): warning C4996: 'Nan::ForceSet': was declared deprecated..\src\callback_info.cc(208): error C2761: 'void CallbackInfo::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)': member function redeclaration not allowed [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]

  d:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'
..\src\callback_info.cc(208): error C2448: 'CallbackInfo::Initialize': function-style initializer appears to be a function definition [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(184): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(184): error C2275: 'v8::Value': illegal use of this type as an expression [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2104): note: see declaration of 'v8::Value'
..\src\ffi.cc(184): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(185): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(189): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(189): error C2228: left of '.As' must have class/struct/union [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  ..\src\ffi.cc(189): note: type is 'unknown-type'
..\src\ffi.cc(189): error C2059: syntax error: ')' [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(228): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(228): error C2275: 'v8::Value': illegal use of this type as an expression [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2104): note: see declaration of 'v8::Value'
..\src\ffi.cc(228): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(229): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(233): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(233): error C2228: left of '.As' must have class/struct/union [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  ..\src\ffi.cc(233): note: type is 'unknown-type'
..\src\ffi.cc(233): error C2059: syntax error: ')' [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
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 (D:\study\RoboTerra\desktop\frontend\electron\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "D:\\ToolsF\\nodeJS\\node.exe" "D:\\study\\RoboTerra\\desktop\\frontend\\electron\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=5.0.6" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--build-from-source" "--msvs_version=2015"
gyp ERR! cwd D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok

Failed with exit code: 1

Error: �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ�����ӡ�/m�����ء�
  Building assembly file ..\..\..\deps\libffi\src\x86\win64.asm
   Assembling: ..\..\..\deps\libffi\src\x86\win64.asm
  prep_cif.c
  types.c
  raw_api.c
  java_raw_api.c
  closures.c
  ffi.c
  win_delay_load_hook.cc
  ffi.vcxproj -> D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\Release\\libffi.lib
  ffi.cc
  callback_info.cc
  threaded_callback_invokation.cc
  win32-dlfcn.cc

  win_delay_load_hook.cc
..\src\callback_info.cc(208): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  d:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'
..\src\callback_info.cc(208): error C2275: 'v8::Object': illegal use of this type as an expression..\src\ffi.cc(63): warning C4996: 'Nan::ForceSet': was declared deprecated [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]

  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(3257): note: see declaration of 'v8::Object'd:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'

..\src\callback_info.cc(208): error C2065: 'target': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(64): warning C4996: 'Nan::ForceSet': was declared deprecated..\src\callback_info.cc(208): error C2761: 'void CallbackInfo::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)': member function redeclaration not allowed [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]

  d:\study\roboterra\desktop\frontend\electron\node_modules\nan\nan_maybe_43_inl.h(117): note: see declaration of 'Nan::ForceSet'
..\src\callback_info.cc(208): error C2448: 'CallbackInfo::Initialize': function-style initializer appears to be a function definition [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(184): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(184): error C2275: 'v8::Value': illegal use of this type as an expression [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2104): note: see declaration of 'v8::Value'
..\src\ffi.cc(184): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(185): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(189): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(189): error C2228: left of '.As' must have class/struct/union [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  ..\src\ffi.cc(189): note: type is 'unknown-type'
..\src\ffi.cc(189): error C2059: syntax error: ')' [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(228): error C2065: 'Handle': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(228): error C2275: 'v8::Value': illegal use of this type as an expression [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  c:\users\tinynight\.electron-gyp\5.0.6\include\node\v8.h(2104): note: see declaration of 'v8::Value'
..\src\ffi.cc(228): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(229): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(233): error C2065: 'cif_buf': undeclared identifier [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
..\src\ffi.cc(233): error C2228: left of '.As' must have class/struct/union [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
  ..\src\ffi.cc(233): note: type is 'unknown-type'
..\src\ffi.cc(233): error C2059: syntax error: ')' [D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi\build\ffi_bindings.vcxproj]
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 (D:\study\RoboTerra\desktop\frontend\electron\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "D:\\ToolsF\\nodeJS\\node.exe" "D:\\study\\RoboTerra\\desktop\\frontend\\electron\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=5.0.6" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--build-from-source" "--msvs_version=2015"
gyp ERR! cwd D:\study\RoboTerra\desktop\frontend\electron\node_modules\ffi
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\spawn-rx\lib\src\index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:156:26)
    at Subscriber._error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:92:26)
    at Subscriber.error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:72:18)
    at SafeSubscriber._next (D:\study\RoboTerra\desktop\frontend\electron\node_modules\spawn-rx\lib\src\index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (D:\study\RoboTerra\desktop\frontend\electron\node_modules\rxjs\internal\Subscriber.js:143:22)
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! test@1.0.0 rebuild: `cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the test@1.0.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\TinyNight\AppData\Roaming\npm-cache\_logs\2019-07-03T10_13_29_447Z-debug.log

И файл журнала в последней строке:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\ToolsF\\nodeJS\\node.exe',
1 verbose cli   'D:\\ToolsF\\nodeJS\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'rebuild' ]
2 info using npm@5.6.0
3 info using node@v8.10.0
4 verbose run-script [ 'prerebuild', 'rebuild', 'postrebuild' ]
5 info lifecycle test@1.0.0~prerebuild: test@1.0.0
6 info lifecycle test@1.0.0~rebuild: test@1.0.0
7 verbose lifecycle test@1.0.0~rebuild: unsafe-perm in lifecycle true
8 verbose lifecycle test@1.0.0~rebuild: PATH: D:\ToolsF\nodeJS\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\study\RoboTerra\desktop\frontend\electron\node_modules\.bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\ia32\compiler;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Haskell\bin;D:\study\Courses\CS 456\Haskell8.2.2\8.2.2\lib\extralibs\bin;D:\study\Courses\CS 456\Haskell8.2.2\8.2.2\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files (x86)\GtkSharp\2.12\bin;D:\study\Courses\CS 456\Haskell8.2.2\8.2.2\mingw\bin;D:\ToolsF\nodeJS\;C:\Users\TinyNight\.windows-build-tools\python27\;C:\Users\TinyNight\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin;C:\Users\TinyNight\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\TinyNight\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\TinyNight\AppData\Roaming\cabal\bin;D:\study\Courses\CS 456\Haskell8.2.2\stack\bin;C:\Users\TinyNight\AppData\Local\Microsoft\WindowsApps;D:\code\compiler\python3;D:\code\compiler\python2;C:\Users\TinyNight\AppData\Roaming\npm
9 verbose lifecycle test@1.0.0~rebuild: CWD: D:\study\RoboTerra\desktop\frontend\electron
10 silly lifecycle test@1.0.0~rebuild: Args: [ '/d /s /c',
10 silly lifecycle   'cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../' ]
11 silly lifecycle test@1.0.0~rebuild: Returned: code: 4294967295  signal: null
12 info lifecycle test@1.0.0~rebuild: Failed to exec rebuild script
13 verbose stack Error: test@1.0.0 rebuild: `cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../`
13 verbose stack Exit status 4294967295
13 verbose stack     at EventEmitter.<anonymous> (D:\ToolsF\nodeJS\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (D:\ToolsF\nodeJS\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid test@1.0.0
15 verbose cwd D:\study\RoboTerra\desktop\frontend\electron
16 verbose Windows_NT 10.0.15063
17 verbose argv "D:\\ToolsF\\nodeJS\\node.exe" "D:\\ToolsF\\nodeJS\\node_modules\\npm\\bin\\npm-cli.js" "run" "rebuild"
18 verbose node v8.10.0
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 4294967295
22 error test@1.0.0 rebuild: `cd ./node_modules/.bin && electron-rebuild --force --module-dir=../../`
22 error Exit status 4294967295
23 error Failed at the test@1.0.0 rebuild script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 4294967295, true ]

У меня есть узел v8.10.0, а

"dependencies": {
    "electron": "^5.0.6",
    "ffi": "^2.3.0",
    "ref": "^1.3.5",
    "ref-struct": "^1.1.0",
    "windows-build-tools": "^4.0.0"
  },
  "devDependencies": {
    "electron-rebuild": "^1.8.5"
  }

1 Ответ

1 голос
/ 10 июля 2019

Это из-за того, что официальная версия FFI не поддерживает электрон 5. Я спросил на Github и получил ответ: https://github.com/electron/electron-rebuild/issues/308

Я использовал старую версию электрона и добился успеха.

...