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

Current repo fails to build on Windows+nightly due to multiple causes #6

Open
CaseyBaileyPDX opened this issue May 7, 2023 · 1 comment

Comments

@CaseyBaileyPDX
Copy link

CaseyBaileyPDX commented May 7, 2023

This is largely documentation for others encountering these issues, but I'm happy to provide a PR addressing them if that is preferred?

  1. The Windows NTAPI crate has a current bug that impacts at least the final Ch11 code - discussion here Edit - this seems to exist not only in nightly, but also stable
  • This can be fixed pretty simply by bumping the version of Tokio to current "1.28.0". This leaves the supporting crates (tracing/tracing-sub) behind, but updating them requires more extensive changes to the code. Leaving them as-is seems to work just fine.
  1. Vendored OpenSSL fails to build - this happens because the current vendor build script uses Perl which doesn't produce Windows-compatible paths.
  • This can be fixed by drop-in replacing openssl with rustls in Cargo.toml I think. I haven't encountered bugs yet, but I've also not extensively tested.
@a-bakos
Copy link

a-bakos commented May 8, 2023

@CaseyBaileyPDX - This is also for documentation purposes. For your second point, here's another solution or a different approach, although slightly more effort.

Like you said, this error is coming from the openssl-sys crate (for reference, see the full error message at the end of my comment). "The build is failing because the Perl implementation being used does not produce Windows-like paths".

What does that mean exactly?

In my case, my Git Bash (which I'm using inside IntelliJ) is using a newer version of Perl (v5.36) that is not, at the time, compatible with the current openssl-sys crate. What worked for me was to install Strawberry Perl (a Windows distro of Perl) that currently comes with v5.32. Then I had to repoint my Git Bash to use this version instead of v5.36. And I also had to add a crate to my main Cargo.toml file and here's why:
openssl = { version = "0.10", features = ["vendored"] }

To update Git paths to use a different Perl version:

  • Note down the path to the Perl installation, the one you just installed, e.g. C:\Strawberry\perl\bin
  • Type echo $PATH in git bash to see the current path variables
  • Type export PATH="PATH_TO_PERL;$PATH" where PATH_TO_PERL is the path to your new (Strawberry) Perl installation (quotes needed)
  • Double-check echo $PATH to see your new path has been added

And for reference, the full error message that started popping up during compilation while working through chapter 9:

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

Caused by:
  process didn't exit successfully: `C:\Git\rustwebdev\target\debug\build\openssl-sys-d492c4714352904f\build-script-main` (exit code: 101)
  --- stdout
  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:\\Git\\rustwebdev\\target\\debug\\build\\openssl-sys-c54c8971777a8736\\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.0 for x86_64-msys-thread-multi
  ******************************************************************************
  thread 'main' panicked at '


  Error configuring OpenSSL build:
      Command: "perl" "./Configure" "--prefix=C:\\Git\\rustwebdev\\target\\debug\\build\\openssl-sys-c54c8971777a8736\\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

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