-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Library not loaded: Electron with graphene #92
Comments
@netmiller I use graphene with electron. This is error from https://github.com/PeculiarVentures/pkcs11js/blob/master/src/pkcs11/pkcs11.cpp#L131 Do you use .npmrc
|
No, I have not. I will try that next, thanks. 👍 |
You need create |
No luck, same errors.
I have Electron 1.7.9 installed.
I tried I suppose you have no Yubikey, but is this purely Electron specific error or related Yubikey library? |
I use const path = require("path");
const lib = path.join(__dirname, "..", "lib", "libykcs11.dylib");
const mod = Module.load(lib, "libName"); P.S. I'll try to create simple electron app to test it (~10 minutes) |
@microshine OK, thanks. I have to take break now, but I will try again this evening (takes 5~6 hours local time). Have to go shopping :) But I will try path etc. before that. |
Do you use graphene from main.js or from HTML window? |
It's in main process. Nothing in renderer; I like to use ipc for communicating with UI. |
This is quite strange:
and lib in in its right place :
Here's my current code:
Can it have some effects because my module (calling graphene) is also in lib subdir, and I will call it from main.js with require :
and main.js is in project root (also .npmrc)
|
index.jsconst electron = require("electron");
const graphene = require("graphene-pk11");
const { BrowserWindow } = electron;
const mod = graphene.Module.load("/usr/local/lib/softhsm/libsofthsm2.so", "SoftHSM");
mod.initialize();
const slots = mod.getSlots(true);
console.log(slots);
mod.finalize();
electron.app.on("ready", () => {
let win = new BrowserWindow({ width: 800, height: 600 })
win.on('closed', () => {
win = null
})
// Load a remote URL
win.loadURL('https://github.com');
// Or load a local HTML file
win.loadURL(`file://${__dirname}/index.html`)
}) .npmrc
|
@microshine OK, many thanks. I will try this evening with SoftHSM, and try again with yubikey-lib. |
There can be another problem with Yubico. I've got it on Windows. Their pkcs11 lib depends of libeay32 and piv libs. I fixed it by coping those libs to electron executable file |
try to use maybe you need to have other yubico libs near the pkcs11 lib |
OK, but same code is working well with bare Node-env. And I have no extra libs but libykcs11.dylib. And I'm developing in Mac (as you can see). But anyway with running node-command it's working without problem. |
Here is otool output :
|
Must be something to do cause i use require submodule (and require graphene etc is there) and it will return callback to main.js . You have graphene straight in your main.js. I will try your way. |
@microshine Some progress; now it is working well when I use absolute path from /usr/local/lib/libykcs11.dylib". And when using my local version from subdir ./lib it throws errors ! Code that works 👍
Even when using abs.path to my local lib, it throws errors. Obviously something to do with libs?? Have you idea what is missing and what extra libs should I have locally. I can develop my project using I will try to package my testapp with some of many Electron's packagers, so we will see what happens. Have you any favourite? (for Win/win10 env) Here is otool output from these two libs (which I thought being same level, but now I'm not sure where I have copied this local lib-version ??
Thanks anyway, now the problem is focused so I can continue developing, and try to solve this dynlib problem. I'm not very familiar wirh dynamic libs; so any help is wellcome . |
Have you tried to add dep lib to the same folder where pkcs11 lib is? |
Do you mean ./node_modules/pkcs11js or something else. No I have not.
|
Should I have libcrypto.1.0.0.dylib somewhere? I don't know what lib it is:
|
Seems to be some openssl lib. Now I copied libcrypto.1.0.0.dylib to my local electron-lib (./lib in my project root). And it works now without linking to /usr/local/lib. Closer... closer ... I have to continue next week, and I will try to make installer/executable, and let's see how it behaves. @microshine Thank you. |
@microshine I an playing now with Win10, and can't get graphene installed.
Then tried to add option ignore-engines and hoping I can rebuild it after, but throws :
Some err.messages are localized, because my Win10 is local language. But have you any idea what is missing? .NET\Framework ??? or something else? My Win10 is quite normal without extra installations; except I have to install python because otherwise it can't install at all ??
Debug log is too long.... but I can put it somewhere if needed. Any workaround for this? |
Graphene uses only one native plugin -
You can send your log file to [email protected] |
OK, tried but throws errors while
and you can find debug.log from gist: |
Maybe nothing differs, but I'm running my Win10 under Parallels VM in my iMac. |
@netmiller Did it help with |
Working on it... first it throws "must run with administrative PowerShell", and now finally found "Administrative" version, it's trying just now.... lets see. Seems to take a long time .....
|
OK, pkcs11js will now install :
I will try graphene under adminPowerShell. |
And graphene also install now :
Thanks a lot, I will try forward with electron+graphene (under Win10). Maybe it all is this "AdministrativePowerShell" problem?? I did not remember that. |
At least my graphene-test-progs are working well under Tomorrow I will try electron and electron installer :) This was quite tricky env but hope it starts working better after that. Thanks @microshine . |
I have some errors with library loader/path when using my Yubikey 4 with Electron (main process).
and here is the code :
I have tried variations of relative path, and also absolute path (as you can see).
Same code works fine with bare Node env, but Electron changes the game :(
I guess this is related how Electron handle native-node-modules, but does anyone have any workaround to try??
I have to use electron-rebuild after installing graphene module, otherwise it throws error about different Node-versions, and electron-rebuild works for that.
I found also some documentation :
https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md
but didn't tried yet.
Is there anyone who has same kind of errors, or any workaround for that. Otherwise I am happy with graphene, it works very well with Yubikey PIV.
Btw. I'm running my testapp in dev-mode, and have not tried to use any packager or installers yet. Just run . electron.
The text was updated successfully, but these errors were encountered: