Open mslipper opened 4 years ago
I can't seem to reproduce this with pkg. What bcrypto version are you using? Is there any chance of creating an isolated test case which reproduces the issue?
@chjj since this is for Bob, I think I can answer with reasonable confidence.
Here's our package-lock.json for Bob 4.0:
"hsd": {
"version": "https://github.com/kyokan/hsd/tarball/296f36c996d9e1561fd0718d9887402181d57c85",
"integrity": "sha512-wrLgzlMnL/1vI5lwzR+FEfF9PUPXhuxPkxosFiekuDFHmkB2tvJQeETcS0w+mxLYBS8CFnQFfDyklczO74RCnw==",
"requires": {
"bcfg": "~0.1.6",
"bcrypto": "bcrypto@git+https://github.com/bcoin-org/bcrypto.git#5c3e2b8b3f79d13e1b5c26be197708d0b9e5bcf9",
"bdb": "~1.2.1",
"bdns": "~0.1.5",
"bevent": "~0.1.5",
"bfile": "~0.2.2",
"bfilter": "~1.0.5",
"bheep": "~0.1.5",
"binet": "~0.3.5",
"blgr": "~0.1.7",
"blru": "~0.1.6",
"blst": "~0.1.5",
"bmutex": "~0.1.6",
"bns": "~0.11.0",
"bsert": "~0.0.10",
"bsock": "~0.1.9",
"bsocks": "~0.2.5",
"btcp": "~0.1.5",
"buffer-map": "~0.0.7",
"bufio": "~1.0.6",
"bupnp": "~0.2.6",
"bval": "~0.1.6",
"bweb": "~0.1.10",
"goosig": "git+https://github.com/kyokan/goosig.git#29cd9dce78abb296400104ab8fea62ee515cefc4",
"hs-client": "~0.0.8",
"n64": "~0.2.10",
"urkel": "~0.6.3"
},
This commit, from May 26th, is somewhere between 5.1 (may 19th) and 5.2 (jun 13th).
@chjj @mslipper I am able to get Bob to build and run in dev mode on Windows by reverting this commit: https://github.com/bcoin-org/bcrypto/commit/f8f5cb73cf44e21ae8ef3df36c832ef313cb7fcb or in other words, using cmake instead of node-gyp as you're already planning on doing I think.
I'm not sure but reading up on this issue I think the problem is because electron doesn't contain nodejs, it runs a fork, and so there are these extra tools like electron-builder
and electron-rebuild
that have to compile the native addons for the correct javascript engine.
What I did just now is clone master branch of Bob, restore the hsd
dependency to its master branch from handshake-org, remove the process.env.NODE_BACKEND = 'js'
line and install. Then I removed node_modules/bcrypto
and replaced it with the master branch of bcrypto, reverting that commit and rebuilding with cmake.
Bob seems to running fine on Windows now in dev mode, and synced the HNS blockchain in about 45 minutes.
@pinheadmz very interesting that it works with cmake. node-gyp adds a ton of unnecessary flags to each build (most of which are intended for building node.js itself, not addons). I would guess something here is borking the build on windows.
Maybe this justifies switching to cmake for everything, though it is an extra dependency for users depending on how you look at it.
Oh to be clear - hsd and bcrypto build fine on windows as-is master branches and latest releases. But there is something wrong with building for Electron on windows.
Hi there,
When I run software under Electron or PKG that runs bcrypto with native bindings on Windows, I get a "DLL Initialization Routine Failed" error. The error looks like this:
I've already verified that the Node ABI version in use is correct. After attaching WinDBG to the PKG-generated process, I see the following error:
(Note: The exception is not handled, since WinDBG goes into a loop after stepping over the exception.)
The error is the same when I debug Bob in the same way. Error code
c0000005
isn't a missing DLL error, it implies a runtime bug withinbcrypto
itself that is triggering a memory access violation. Any chance you could take a look and see what is going on? Being able to bundle HSD via PKG would dramatically simplify Bob development, and allow people to make standalone HSD binaries in the future.The issue is not present when HSD is run from my system Nodejs interpreter. The error disappears when I set
process.env.NODE_BACKEND
tojs
.