signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.63k stars 420 forks source link

Bulding issue on Windows 10, Node due to py vs python3 #456

Open osztenkurden opened 2 years ago

osztenkurden commented 2 years ago

OS: Windows 10, 64-bit Node: v12.18.3, after nvm use

cargo test goes fine, but after running yarn install --verbose this is the result:

verbose 0.4098951 Checking for configuration file "F:\\Repositories\\libsignal-client\\node\\.npmrc".
verbose 0.4100575 Checking for configuration file "C:\\Users\\Hubert\\.npmrc".
verbose 0.410158 Found configuration file "C:\\Users\\Hubert\\.npmrc".
verbose 0.4103759 Checking for configuration file "C:\\Users\\Hubert\\.nvm\\versions\\node\\v12.18.3\\bin\\etc\\npmrc".
verbose 0.410501099 Checking for configuration file "F:\\Repositories\\libsignal-client\\node\\.npmrc".
verbose 0.410599499 Checking for configuration file "F:\\Repositories\\libsignal-client\\.npmrc".
verbose 0.4106844 Checking for configuration file "F:\\Repositories\\.npmrc".
verbose 0.412107 Checking for configuration file "F:\\Repositories\\libsignal-client\\node\\.yarnrc".
verbose 0.4122061 Checking for configuration file "C:\\Users\\Hubert\\.yarnrc".
verbose 0.4122956 Checking for configuration file "C:\\Users\\Hubert\\.nvm\\versions\\node\\v12.18.3\\bin\\etc\\yarnrc".
verbose 0.4123904 Checking for configuration file "F:\\Repositories\\libsignal-client\\node\\.yarnrc".
verbose 0.4124677 Checking for configuration file "F:\\Repositories\\libsignal-client\\.yarnrc".
verbose 0.412537399 Checking for configuration file "F:\\Repositories\\.yarnrc".
verbose 0.4209395 current time: 2022-03-25T11:11:08.144Z
[1/4] Resolving packages...
success Already up-to-date.
$ node-gyp-build
F:\Repositories\libsignal-client\node\node_modules\node-gyp-build\index.js:59
  throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
  ^

Error: No native build was found for platform=win32 arch=x64 runtime=node abi=72 uv=1 libc=glibc node=12.18.3
    loaded from: F:\Repositories\libsignal-client\node

    at Function.load.path (F:\Repositories\libsignal-client\node\node_modules\node-gyp-build\index.js:59:9)
    at load (F:\Repositories\libsignal-client\node\node_modules\node-gyp-build\index.js:21:30)
    at Object.<anonymous> (F:\Repositories\libsignal-client\node\node_modules\node-gyp-build\build-test.js:19:19)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@12.18.3 | win32 | x64
gyp info find Python using Python version 3.10.1 found at "C:\Users\Hubert\AppData\Local\Programs\Python\Python310\python.exe"
gyp http GET https://nodejs.org/download/release/v12.18.3/node-v12.18.3-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v12.18.3/node-v12.18.3-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v12.18.3/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v12.18.3/win-x64/node.lib
gyp http GET https://nodejs.org/download/release/v12.18.3/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v12.18.3/win-arm64/node.lib
gyp http 200 https://nodejs.org/download/release/v12.18.3/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v12.18.3/win-x86/node.lib
gyp http 404 https://nodejs.org/download/release/v12.18.3/win-arm64/node.lib
gyp http 200 https://nodejs.org/download/release/v12.18.3/win-x64/node.lib
gyp info find VS using VS2017 (15.9.28307.1745) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Users\Hubert\AppData\Local\Programs\Python\Python310\python.exe
gyp info spawn args [
gyp info spawn args   'F:\\Repositories\\libsignal-client\\node\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'F:\\Repositories\\libsignal-client\\node\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'F:\\Repositories\\libsignal-client\\node\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Hubert\\AppData\\Local\\node-gyp\\Cache\\12.18.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Hubert\\AppData\\Local\\node-gyp\\Cache\\12.18.3',
gyp info spawn args   '-Dnode_gyp_dir=F:\\Repositories\\libsignal-client\\node\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Hubert\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.18.3\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=F:\\Repositories\\libsignal-client\\node',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'F:\\Repositories\\libsignal-client\\node\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Projekty w tym rozwiązaniu są tworzone po kolei. Aby umożliwić tworzenie równoległe, dodaj przełącznik „/m”.
  build_node_bridge.py

After that it hangs, doesn't do anything

jrose-signal commented 2 years ago

At this point it should be invoking the Rust build (lazily), like in the run here: https://github.com/signalapp/libsignal/runs/5684959926?check_suite_focus=true

If you look at your system monitor, are there any Rust processes running? You did say that cargo test works fine, which implies that Rust at least knows what it's doing. You can try cargo check --workspace to make sure there's not a problem downloading other dependencies, too.

osztenkurden commented 2 years ago

I'll verify that asap, but in the meantime I'd also want to make sure if the No native build was found for platform=win32 arch=x64 runtime=node abi=72 uv=1 libc=glibc node=12.18.3 is expected at this point?

jrose-signal commented 2 years ago

I think so, but I'll go file a bug with node-gyp-build to ask them to change it to "No native prebuild" instead of just "No native build". (The fact that it then went on to run the build makes me think it's behaving correctly, even if I haven't looked at this log output myself lately.)

osztenkurden commented 2 years ago

Currently I went through the flow without an issue on secondary laptop - the only difference was I used py -3 instead of py (needed to change from python3 as it wasn't detected as Windows command). I will re-verify the issue in 2 days when I'll get back and have access to my workstation.

jrose-signal commented 2 years ago

Ah, yeah, that could absolutely do it, we only test with Python 3.

osztenkurden commented 2 years ago

Yep, that was it, 24th line of binding.gyp had to be changed to 'py -3',, which I think might be useful to add to Windows part of documentation

jrose-signal commented 2 years ago

I'm surprised you had to do py -3. https://docs.python.org/3/using/windows.html#shebang-lines implies that it should have been autodetected. Is it just the "missing" space after "#!"? I'll spin up my Windows machine later and see if I can figure it out.

I don't necessarily want to change the script when python3 does work in some cases (including CI and my local setup), and the py launcher is optional, so yeah, the docs might be the way to go. Hopefully we'll be able to figure out the -3 thing, though.

jrose-signal commented 2 years ago

I couldn't reproduce the behavior of py picking python2 (using Python 3.10's py). Is there a chance you have some configuration to prefer python2? (cf https://docs.python.org/3/using/windows.html#customizing-default-python-versions)

osztenkurden commented 2 years ago

I believe this line is crucial If no relevant options are set, the commands python and python2 will use the latest Python 2.x version installed and the command python3 will use the latest Python 3.x installed., as I have no options / configuration for using any python version. But I believe that might be a quirk of my current workspaces, and after small note in the docs we could close the issue.