unknownskl/greenlight

Error trying to run the code on windows

Closed this issue · 1 comments

Following the readme instructions for cloning, after getting dependencies with yarn I get the following error when running yarn dev:

$ yarn dev
yarn run v1.22.21
$ yarn run build-deps && DEBUG=greenlight:* nextron
$ ls xal-node/dist/xal-node.node || npm run rebuild-deps
ls: cannot access 'xal-node/dist/xal-node.node': No such file or directory

> greenlight@2.0.0-beta14 rebuild-deps
> cd xal-node && npm ci


> xal-node@0.1.1 install
> npm run build-release


> xal-node@0.1.1 build-release
> ( bash -c 'uname -a | grep -q -i Darwin' && npm run build-release-osx ) || npm run build -- --release


> xal-node@0.1.1 build
> rm -rf dist/ && tsc && chmod +x dist/bin/auth.js && cargo-cp-artifact -nc dist/xal-node.node -- cargo build --message-format=json-render-diagnostics --release

   Compiling openssl-sys v0.9.80
error: failed to run custom build command for `openssl-sys v0.9.80`

Caused by:
  process didn't exit successfully: `C:\Users\futplus\Downloads\greenlight\xal-node\target\release\build\openssl-sys-73b0d91677602af5\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rustc-cfg=openssl
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  running "perl" "./Configure" "--prefix=C:\\Users\\futplus\\Downloads\\greenlight\\xal-node\\target\\release\\build\\openssl-sys-e9ea9503ecd234f1\\out\\openssl-build\\install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-asm" "VC-WIN64A"
  Configuring OpenSSL version 1.1.1t (0x1010114fL) for VC-WIN64A
  Using os-specific seed configuration

  --- stderr

  ******************************************************************************
  This perl implementation doesn't produce Windows like paths (with backward
  slash directory separators).  Please use an implementation that matches your
  building platform.

  This Perl version: 5.36.1 for x86_64-msys-thread-multi
  ******************************************************************************
  thread 'main' panicked at C:\Users\futplus\.cargo\registry\src\index.crates.io-6f17d22bba15001f\openssl-src-111.25.0+1.1.1t\src\lib.rs:499:13:



  Error configuring OpenSSL build:
      Command: "perl" "./Configure" "--prefix=C:\\Users\\futplus\\Downloads\\greenlight\\xal-node\\target\\release\\build\\openssl-sys-e9ea9503ecd234f1\\out\\openssl-build\\install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "no-asm" "VC-WIN64A"
      Exit status: exit code: 127



  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Did not copy "cdylib:xal-node"
npm ERR! code 101
npm ERR! path C:\Users\futplus\Downloads\greenlight\xal-node
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npm run build-release

npm ERR! A complete log of this run can be found in: C:\Users\futplus\AppData\Local\npm-cache\_logs\2023-11-24T10_00_26_262Z-debug-0.log
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 101.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I run this in git bash inside windows 10. Installed rust using its official installation exe file. And have nodejs 20 installed according to official doc. installed yarn using the instruction on their site which was installing using npm :)

The error seems to be about openssl library not being installed in windows. I tried to install it following the instruction in rust readme here but didn't succeed: https://github.com/sfackler/rust-openssl/tree/5948898e54882c0bedd12d87569eb4dbee5bbca7#windows-msvc

I think it'll be nice to add the instruction of how to setup and run the code inside windows in the README of this project.

Any idea how can I fix this error and run the code in windows? I've made some modifications and need to run it to make sure it works.

Fix this issue by installing windows version of perl (Strawberry perl) and changing PATH of git bash to not use its own perl implementation.

So to for building in windows I had to do this:

  1. Install git (https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/Git-2.43.0-64-bit.exe)
  2. Install nodejs (https://nodejs.org/dist/v20.10.0/node-v20.10.0-x64.msi)
  3. Install yarn with npm (npm i --global yarn)
  4. Install rust (https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe)
  5. Install openssl (https://slproweb.com/products/Win32OpenSSL.html)
  6. Install perl (Strawberry perl)
  7. Change git bash PATH env to use perl implementation installed in step 6)

Good luck to all :)