staltz / sodium-native-nodejs-mobile

Low level bindings for libsodium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`configure` and `configure-mobile` don't work on Windows 10

soapdog opened this issue · comments

I don't know if this is in scope but the configure scripts used:

  • configure
  • configure-mobile

Are both UNIX shell scripts that can't be spawned on windows. This causes the installation to fail on Windows during the execution of preinstall.

A solution would it to fetch prebuilts or use a JS build system for those configure scripts.

Hey @soapdog! Thanks for passing by. :) I'm afraid this issue is difficult, let's go into the details.

First, why can't windows spawn those scripts? I was under the impression that Windows has some kind of bash compatibility layer nowadays. Not pretending I understand it all too well, though.

A solution would it to fetch prebuilts

Yes, but I haven't figured out how to do prebuilds of cross-compiled ARM stuff. I wish someone who really understands this stuff would help out here.

or use a JS build system for those configure scripts.

configure just calls autogen.sh from libsodium, and I'm pretty sure there's a ton of other bash scripts deep in libsodium (look at folder libsodium/dist-build/) that would make Windows cry.

See also Windows-related scripts in sodium-friends/sodium-native: https://github.com/sodium-friends/sodium-native/issues?utf8=%E2%9C%93&q=is%3Aissue+windows

@staltz windows has WSL, you can think of it as a VM running Linux, you can from Windows shell call into that but whatever you build with it is actually a Linux ELF binary because you're into Linux not Windows unless you're treating it as a Linux cross-compiling into something else.

There is git-bash, mingw64, cygwin, unxtools, and lots of other products that provide some kind of POSIX working layer for windows but none of those is guaranteed to be present. I know that libsodium is able to build on windows because I've seen node-gyp doing it but how it does it I don't know, I don't think it goes through any bash script though.

Maybe it might be the case of detecting windows and aborting with message at the moment...

i found out that modifying preinstall to use https://www.npmjs.com/package/cross-spawn to spawn processes there is some progress