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

bcrypto 5.0.0 fails to install on Windows #40

Closed
alexsmith540 opened this issue Jan 30, 2020 · 5 comments
Closed

bcrypto 5.0.0 fails to install on Windows #40

alexsmith540 opened this issue Jan 30, 2020 · 5 comments

Comments

@alexsmith540
Copy link

Latest 5.0.0 build fails to compile on windows during npm install and blocks hsd from installing. Seems to be related to libtorsion.

`

node-gyp rebuild

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
aead.c
chacha20.c
drbg.c
dsa.c
ecc.c
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p192_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p192_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p521_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p521_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p448_32.h(14): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
c:\users\someuser\hsd\node_modules\bcrypto\src\torsion\src\fields\p448_32.h(15): error C4235: nonstandard extension used: '__int128' keyword not supported on this architecture [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
..\src\torsion\src\ecc.c(9640): warning C4098: 'torsion_schnorr_scratch_destroy': 'void' function returning a value [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.vcxproj]
..\src\torsion\src\ecc.c(9682): warning C4098: 'torsion_schnorr_privkey_generate': 'void' function returning a value [C:\Users\someuser\hsd\node_modules\bcrypto\build\bcrypto.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 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\someuser\hsd\node_modules\bcrypto
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypto@5.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypto@5.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
`

@chjj
Copy link
Member

chjj commented Jan 30, 2020

Very strange. The 64 bit field element backends should not be built on windows: https://github.com/bcoin-org/bcrypto/blob/master/binding.gyp#L86

I wonder if the node-gyp OS variable is being set to something other than win?

@chjj
Copy link
Member

chjj commented Jan 30, 2020

Oh, it's not building the 64 bit backends. Strange that the 32 bit fiat backends require __int128. Hmm.

@chjj
Copy link
Member

chjj commented Jan 30, 2020

Okay, it seems like only unsaturated solinas primes require an __int128 type for 32 bit. I think we could maybe compile those backends using montgomery reduction instead to make them work on windows.

@chjj
Copy link
Member

chjj commented Jan 30, 2020

Strangely enough, p25519 32 bit doesn't require __int128. Investigating more.

chjj added a commit that referenced this issue Jan 31, 2020
chjj added a commit to bcoin-org/libtorsion that referenced this issue Jan 31, 2020
chjj added a commit to bcoin-org/libtorsion that referenced this issue Jan 31, 2020
@chjj
Copy link
Member

chjj commented Jan 31, 2020

It seems as though the shape of the prime and the number of limbs determines whether __int128 is used for 32 bit. I've tweaked the fiat build script and increased the number of limbs for those backends to avoid using __int128.

@chjj chjj closed this as completed Jan 31, 2020
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

2 participants