Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Hacking on windows guidance #170

Open
koivunej opened this issue May 15, 2020 · 7 comments
Open

Hacking on windows guidance #170

koivunej opened this issue May 15, 2020 · 7 comments

Comments

@koivunej
Copy link
Collaborator

I've managed to install a compatible compilation environment for the root crate in Windows by:

  1. install rustup with stable-gnu (stable-msvc linker didn't work, not sure why)
  2. install msys2 by installer per https://github.com/rust-lang/rust#mingw
  3. install git, vim, and gcc with pacman -S
  4. cargo test works

At least clear_on_drop dependency requires the gcc, so installing just the toolchain with rustup is not enough. Following the https://github.com/rust-lang/rust#mingw way of installing gcc through mingw-w64-x86_64-gcc did not work for me.

We should have a guide for "hacking on windows".

Originally posted by @koivunej in #169 (comment)

My above comment doesn't cover compiling the ipfs-http crate.

@koivunej
Copy link
Collaborator Author

koivunej commented May 15, 2020

Any help from people more familiar with rust on windows would be much appreciated! The best possible outcome would be to support running cargo test --workspace which with my original hints fails because openssl fails to find the libraries. On CI we use vcpkg which I have no idea how to install it myself or if it could be installed through msys2 pacman.

Tried to install openssl, pkg-config and openssl-devel through pacman but the cargo test --workspace fails to find the openssl libraries at link time.

The guide could become a file under docs/ and we could link to it from the root README for example.

@akx
Copy link

akx commented May 15, 2020

If the crux of the issue is xplat compilation of openssl, and seeing as openssl is only required for RSA generation according to

# openssl is required for rsa keygen but not used by the rust-ipfs or it's dependencies
openssl = "0.10.28"

how about something like the ring crate instead? https://docs.rs/ring/0.16.13/ring/signature/struct.RsaKeyPair.html

@koivunej
Copy link
Collaborator Author

For the purposes of actually using the key rust-libp2p already uses ring but ring doesn't support keygen, similarly to rsa at least didn't used to support keygen and export into pkcs#1, if I remember correctly if that was needed here. It'd be easiest not to depend on openssl, but the keygen will become more important on /api/v0/key/gen for example even if the peer identity could be in ed25519.

@aphelionz
Copy link
Contributor

aphelionz commented May 15, 2020

Personally, openssl is a high-value target for jettison. @koivunej I know you did a pretty thorough search on this back in March. Maybe the situation has changed? 🤞

It would obviate the need for this as well. I forget recently but there was a Rust talk where a team talked about openssl alternatives for either games or embedded work. I'll try and dig it up.

@Scondo
Copy link
Contributor

Scondo commented Jul 23, 2021

Well... for now
stable-x86_64-pc-windows-msvc (default)
rustc 1.53.0 (53cb7b09b 2021-06-17)
4bce467

It is as simple as rustup-init; git clone; cargo test

So... what exactly should be in this guide? How to do same on msys?

@Scondo
Copy link
Contributor

Scondo commented Jul 23, 2021

Ok. I found problems with OpenSSL when run complete workspace.

Write some doc about installation https://github.com/Scondo/rust-ipfs/blob/master/doc/windows.md
Could also try way with vcpkg as alternative.

@koivunej
Copy link
Collaborator Author

koivunej commented Aug 3, 2021

My initial idea for this was: just getting the workspace up and running. The openssl dependency is a chore. I remember creating this issue back when there was some general trouble of installing rust on windows ... I guess with the msys. I'll try to remember to peek at your doc; thanks for your efforts on this front!

On a vcpkg related note: #469 bumped the versions on CI as the previous revision I had pinned had started to segfault or whatever is the windows code for that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants