Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Fix OS compatibility issues with building Clap on Windows so the build succeeds #59

Open
jamesray1 opened this issue May 5, 2018 · 5 comments

Comments

@jamesray1
Copy link
Member

jamesray1 commented May 5, 2018

Describe the bug

error[E0433]: failed to resolve. Could not findunixinos--> C:\Users\ChosunOne\.cargo\registry\src\github.com-1ecc6299db9ec823\clap-2.31.2\src\app\parser.rs:7:14 | 7 | use std::os::unix::ffi::OsStrExt; | ^^^^ Could not findunixinos``

From https://gitter.im/Drops-of-Diamond/Development?at=5aed4e101eddba3d04d3ddb2.

To Reproduce
Steps to reproduce the behavior:

  1. Run cargo make build on a Windows OS

Expected behavior
The project should build.

Desktop (please complete the following information):

  • OS: Windows 10 64-bit
@ChosunOne
Copy link
Collaborator

A workaround is to change the parser.rs file line 7 to:
use std::os::windows::ffi::OsStrExt;
and add the line:
use osstringext::OsStrExt3;
after it. This will fix the build errors but will leave you with a nonstandard version of clap.

@jamesray1
Copy link
Member Author

So that we don't have to configure this manually, try:

#[cfg(not(target_os = "windows"))]
use std::os::unix::ffi::OsStrExt;
#[cfg(target_os = "windows")]
use osstringext::OsStrExt3;

From https://github.com/kbknapp/clap-rs/pull/1190/files#diff-3519f1369b63436798d9d7841c7940e2R672.

@jamesray1
Copy link
Member Author

Alternatively we could use https://github.com/kbknapp/clap-rs#optional-dependencies--features:

[dependencies.clap]
version = "2.31"
default-features = false

# Cherry-pick the features you'd like to use
features = [ "suggestions", "vec_map" ]

@ChosunOne
Copy link
Collaborator

The alternative method still doesn't build, but reintroducing the target checks in parser.rs of clap fixes the issue. We should raise an issue with clap about this.

stevepentland added a commit to stevepentland/clap-rs that referenced this issue May 6, 2018
This seems to be something missed some time ago as the original
annotation for this 'use' was only feature debug. However this
broke builds using that feature on Windows.

This change uses guards both for the feature and also wasm/windows
specific targets/environments.

closes clap-rs#1270 and is done in response to Drops-of-Diamond/diamond_drops#59
@stevepentland
Copy link

Thanks for pointing this one out! It seems a case that has been both missed during my changes and before that time also. I have fixed the issue and tested using a copy of your specific project also and can report success. Once the PR merges you should be good to update and go.

@jamesray1 jamesray1 removed the M4: core Core client code / Rust. label May 14, 2018
@jamesray1 jamesray1 reopened this May 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants