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

Support Windows #17

Closed
bltavares opened this issue Oct 9, 2018 · 3 comments · Fixed by #21
Closed

Support Windows #17

bltavares opened this issue Oct 9, 2018 · 3 comments · Fixed by #21

Comments

@bltavares
Copy link
Contributor

Feature Request

Summary

It would be nice to be able to create a new Rust project and setup cross-compilation on the Windows environment

Motivation

Similar to #2, Rust provides a very nice support for Windows executables. When working from a Windows setup, creating the scripts to support building to other platforms would be at pair to developing on *nix platforms

Expected Behavior

When running cargo install crossgen I would be able to have a new crossgen executable on the PATH, and which would allow us to create the scripts and templates for cross-platform generation.

Current `cargo install crossgen` errors
   Compiling privdrop v0.2.1                                                                                                                                                                                                                                                   error[E0432]: unresolved import `nix::unistd`                                                                                                                                                                                                                                   --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:3:5                                                                                                                                                                           |                                                                                                                                                                                                                                                                            3 | use nix::unistd;                                                                                                                                                                                                                                                             |     ^^^^^^^^^^^ no `unistd` in the root                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   error[E0412]: cannot find type `Error` in module `nix`                                                                                                                                                                                                                           --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\errors.rs:12:18                                                                                                                                                                           |                                                                                                                                                                                                                                                                           12 |     FromNix(nix::Error),                                                                                                                                                                                                                                                     |                  ^^^^^ not found in `nix`                                                                                                                                                                                                                                 help: possible candidates are found in other modules, you can import them into scope   Compiling parking_lot_core v0.3.1                                                                                                                                                          |                                                                                                                                                                                                                                                                           1  | use std::error::Error;                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                           1  | use std::fmt::Error;                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                           1  | use std::io::Error;                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          error[E0412]: cannot find type `Error` in module `nix`                                                                                                                                                                                                                           --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\errors.rs:46:16                                                                                                                                                                           |                                                                                                                                                                                                                                                                           46 | impl From<nix::Error> for PrivDropError {                                                                                                                                                                                                                                    |                ^^^^^ not found in `nix`                                                                                                                                                                                                                                   help: possible candidates are found in other modules, you can import them into scope                                                                                                                                                                                              |                                                                                                                                                                                                                                                                           1  | use std::error::Error;                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                           1  | use std::fmt::Error;                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                           1  | use std::io::Error;                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          error[E0412]: cannot find type `Error` in module `nix`                                                                                                                                                                                                                           --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\errors.rs:47:21                                                                                                                                                                           |                                                                                                                                                                                                                                                                           47 |     fn from(e: nix::Error) -> PrivDropError {                                                                                                                                                                                                                                |                     ^^^^^ not found in `nix`                                                                                                                                                                                                                              help: possible candidates are found in other modules, you can import them into scope                                                                                                                                                                                              |                                                                                                                                                                                                                                                                           1  | use std::error::Error;                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                                                           1  | use std::fmt::Error;                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                                           1  | use std::io::Error;                                                                                                                                                                                                                                                          |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          error[E0412]: cannot find type `uid_t` in module `libc`                                                                                                                                                                                                                          --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:40:23                                                                                                                                                                         |                                                                                                                                                                                                                                                                           40 |     uid: Option<libc::uid_t>,                                                                                                                                                                                                                                                |                       ^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          error[E0412]: cannot find type `gid_t` in module `libc`                                                                                                                                                                                                                          --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:41:23                                                                                                                                                                         |                                                                                                                                                                                                                                                                           41 |     gid: Option<libc::gid_t>,                                                                                                                                                                                                                                                |                       ^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          error[E0425]: cannot find function `getpwnam` in module `libc`                                                                                                                                                                                                                   --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:54:19                                                                                                                                                                         |                                                                                                                                                                                                                                                                           54 |             libc::getpwnam(                                                                                                                                                                                                                                                  |                   ^^^^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           error[E0425]: cannot find function `getgrnam` in module `libc`                                                                                                                                                                                                                   --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:76:23                                                                                                                                                                         |                                                                                                                                                                                                                                                                           76 |                 libc::getgrnam(                                                                                                                                                                                                                                              |                       ^^^^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       error[E0425]: cannot find function `time` in module `libc`                                                                                                                                                                                                                        --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:111:19                                                                                                                                                                        |                                                                                                                                                                                                                                                                          111 |             libc::time(&mut now);                                                                                                                                                                                                                                            |                   ^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              error[E0425]: cannot find function `localtime` in module `libc`                                                                                                                                                                                                                   --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:112:19                                                                                                                                                                        |                                                                                                                                                                                                                                                                          112 |             libc::localtime(&now);                                                                                                                                                                                                                                           |                   ^^^^^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         error[E0425]: cannot find function `setgroups` in module `libc`                                                                                                                                                                                                                   --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\privdrop.rs:141:31                                                                                                                                                                        |                                                                                                                                                                                                                                                                          141 |             if unsafe { libc::setgroups(1, &gid) } != 0 {                                                                                                                                                                                                                    |                               ^^^^^^^^^ not found in `libc`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             error[E0119]: conflicting implementations of trait `std::convert::From<[type error]>` for type `errors::PrivDropError`:                                                                                                                                                          --> C:\Users\bltav\.cargo\registry\src\jackfan.us.kg-1ecc6299db9ec823\privdrop-0.2.1\src\errors.rs:54:1                                                                                                                                                                            |                                                                                                                                                                                                                                                                           46 | impl From<nix::Error> for PrivDropError {                                                                                                                                                                                                                                    | --------------------------------------- first implementation here                                                                                                                                                                                                         ...                                                                                                                                                                                                                                                                            54 | impl From<(ErrorKind, &'static str)> for PrivDropError {                                                                                                                                                                                                                     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `errors::PrivDropError`                                                                                                                                                                                                                                                                                                                                                                                                                                            error: aborting due to 12 previous errors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Some errors occurred: E0119, E0412, E0425, E0432.                                                                                                                                                                                                                              For more information about an error, try `rustc --explain E0119`.                                                                                                                                                                                                              error: Could not compile `privdrop`.                                                                                                                                                                                                                                           warning: build failed, waiting for other jobs to finish...                                                                                                                                                                                                                     error: failed to compile `crossgen v0.5.0`, intermediate artifacts can be found at `C:\Users\bltav\AppData\Local\Temp\cargo-install07AS4g`                                                                                                                                                                                                                                                                                                                                                                                                                    Caused by:                                                                                                                                                                                                                                                                       build failed                 

Drawbacks

There might be many dependencies which depends on libc and unix crates which currently don't support Windows and there are no other alternatives

Rationale and alternatives

  • Not doing this would restrict the crossgen out of Windows-only environment. Modern Windows environment have WSL available, which already builds fine and it is usable from the platform, but adds another layer of tooling to it.

Unresolved Questions

Not sure

@yoshuawuyts
Copy link
Owner

Fully agreed! I think this is as much as updating to a newer version of clap-flags, where we've removed privdrop.

@bltavares
Copy link
Contributor Author

Updating clap_flags to 0.3.0 helped with the build process.

Now there are issues with openssl (Why does openssl always is an issue on every language?!)
Maybe ring would be an alternative, on pure rust.

There is a comment regarding RSA on their page tho:

The primary ring developer is less interested in RSA than ECC and other things, and it would be great to have somebody jump in and "own" the RSA work. ring has inherited the fastest open source RSA implementation (as far as we know) from BoringSSL/OpenSSL, and we've already done a lot of cleanup. But, there's a lot more work to do.

@yoshuawuyts
Copy link
Owner

@bltavares yeah that'd be fantastic! See also #7 for an issue on this topic. Would be great if we could remove OpenSSL out of the equation.

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

Successfully merging a pull request may close this issue.

2 participants