Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-java v0.12.2 fails with electron-rebuild (fatal error LNK1120) #541

Open
DManstrator opened this issue Nov 12, 2021 · 11 comments
Open

Comments

@DManstrator
Copy link

DManstrator commented Nov 12, 2021

Hello.

When using version 0.12.1 , building and running the electron app works, but not with using version 0.12.2.

When I try to use the code below, it fails on 0.12.2 since electronbrowser\src\main\electron\node_modules\java\build\Release\nodejavabridge_bindings.node does not exist. However on 0.12.1 this does exist (see screenshots below). This reflects also what the logs show.

Execution:

electron-rebuild -f -w java && electron-packager . %electron_application% --overwrite --out %out% --extra-resource=%extra_resource_viewer% --extra-resource=%extra_resource_app% --icon=%electron_icon% --prune

I would be very glad to get some help on this, spend a day trying to resolve it but without any success. When you need more information, please notify me.

Versions:

Software

software version
Visual Studio Community 2019 16.11.6
Workload
Desktop development with C++
yes
Python 3.10.0

Dependencies

dependency version
node 16.5.0
electron 12.2.2
electron-packager 15.4.0
electron-rebuild 3.2.5
node-java 0.12.2

Logs / Stacktrace (partially in German)

[INFO] --- frontend-maven-plugin:1.12.0:npm (npm package electron app) @ electronbrowser ---
[INFO] Running 'npm run build-electron' in C:\Users\[...]\electronbrowser\src\main\electron
[INFO]
[INFO] > [email protected] build-electron
[INFO] > npm run rebuild && npm run package-electron
[INFO]
[INFO]
[INFO] > [email protected] rebuild
[INFO] > electron-rebuild -f -w java
[INFO]
[INFO] - Searching dependency tree
[INFO] Die Projekte in dieser Projektmappe werden nacheinander erstellt. Um eine parallele Erstellung zu erm?glichen, m?ssen Sie den Schalter "-m" hinzuf?gen.
[INFO]   java.cpp
[INFO] C:\Users\myUserName\.electron-gyp\12.2.2\include\node\v8.h(1650,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO]   javaObject.cpp
[INFO] C:\Users\myUserName\.electron-gyp\12.2.2\include\node\v8.h(1650,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO]   javaScope.cpp
[INFO]   methodCallBaton.cpp
[INFO] C:\Users\myUserName\.electron-gyp\12.2.2\include\node\v8.h(1650,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO]   nodeJavaBridge.cpp
[INFO] C:\Users\myUserName\.electron-gyp\12.2.2\include\node\v8.h(1650,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO]   utils.cpp
[INFO] C:\Users\myUserName\.electron-gyp\12.2.2\include\node\v8.h(1650,55): warning C4996: 'v8::Module::ResolveCallback': Use ResolveModuleCallback [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO]   win_delay_load_hook.cc
[INFO]      Bibliothek "C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\Release\nodejavabridge_bindings.lib" und Objekt "C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\Release\nodejavabridge_bindings.exp" werden erstellt.
[INFO] utils.obj : error LNK2001: Nicht aufgel?stes externes Symbol ""__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ)". [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO] C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\Release\nodejavabridge_bindings.node : fatal error LNK1120: 1 nicht aufgel?ste Externe [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]
[INFO] C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\Release\nodejavabridge_bindings.node : fatal error LNK1120: 1 nicht aufgel?ste Externe [C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java\build\nodejavabridge_bindings.vcxproj]Ã? Rebuild Failed
[INFO]
[INFO] An unhandled error occurred inside electron-rebuild
[INFO] node-gyp failed to rebuild 'C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java'.
[INFO] For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
[INFO]
[INFO] Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
[INFO]
[INFO]
[INFO]
[INFO] Error: node-gyp failed to rebuild 'C:\Users\[...]\electronbrowser\src\main\electron\node_modules\java'.
[INFO] For more information, rerun with the DEBUG environment variable set to "electron-rebuild".
[INFO]
[INFO] Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
[INFO]
[INFO]
[INFO]     at NodeGyp.rebuildModule (C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\module-type\node-gyp.js:117:19)
[INFO]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[INFO]     at async ModuleRebuilder.rebuildNodeGypModule (C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\module-rebuilder.js:94:9)
[INFO]     at async ModuleRebuilder.rebuild (C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\module-rebuilder.js:124:14)
[INFO]     at async Rebuilder.rebuildModuleAt (C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\rebuild.js:145:13)
[INFO]     at async Rebuilder.rebuild (C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\rebuild.js:108:17)
[INFO]     at async C:\Users\[...]\electronbrowser\src\main\electron\node_modules\electron-rebuild\lib\src\cli.js:154:9

Folder comparison

Using 0.12.1 Using 0.12.2
image image

Edit 1

Changed setup to make it at least completely runnable on version 0.12.1. This made the issue also less confusing. By now I'm pretty sure that is a bug with node-java.

@DoMyBestFor
Copy link

How did you solve this problem?

@DManstrator
Copy link
Author

How did you solve this problem?

I didn't find a solution for this problem as of now, I'm still hoping for an answer.

@jianchang69
Copy link

jianchang69 commented Mar 22, 2022

0.12.1

Hi,
Would you please give me the node-java v0.12.1 can rebuild in Electron project or Procedure ?
I can't success to rebuild node-java with electron...
So many thanks...

my email: [email protected]

@DManstrator
Copy link
Author

@jianchang69 You should use npm to get the dependencies. Just pin the version to 0.12.1 in your package.json.

@jianchang69
Copy link

thank DManstrator,
I can rebuild v.0.12.1 and electron v.12.2.2. But hopefully still can rebuild with newest electron version ...
The electron latest version is v.17 with can't rebuild with node-java v.0.12.1..even electron v.14 rebuild fail.

@DManstrator
Copy link
Author

Yeah, that's exactly the same issue I currently face hence why I opened this issue. I still need to find a new approach to this since this library seems unmaintained. In worst case, I have to re-implement everything in a different language. But for now, it's pretty low on my ToDo list.

@Arvin-J
Copy link

Arvin-J commented Mar 24, 2022

The same problem

@ddrigass
Copy link

The same...

@ddrigass
Copy link

For me solved here: lygstate/node-java #532
Thank you!

@jianchang69
Copy link

hi, ddrigass
we can rebuild node-java 0.12.2 with electron v18
thank a lot your information..
but when java code return byte array type to javascript, it happend error...><

I doubte here is problem:
Nan::MaybeLocalv8::Value ab = Nan::Get(v8Buf, Nan::Newv8::String("cause").ToLocalChecked());
Do you have any idea?
the "cause" this word should be modified to ?

@youlinaa
Copy link

For me solved here: lygstate/node-java #532 Thank you!

Thanks, it works at electron 24.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants