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

error running cargo install c2rust on Windows 11 #971

Closed
MurraySobol opened this issue Jun 28, 2023 · 2 comments
Closed

error running cargo install c2rust on Windows 11 #971

MurraySobol opened this issue Jun 28, 2023 · 2 comments

Comments

@MurraySobol
Copy link

When I run "cargo install c2rust" on my Windows 11 64-bit laptop I get the following errors:
Compiling c2rust-build-paths v0.18.0
err

or[E0433]: failed to resolve: could not find unix in os
--> C:\Users\murra.cargo\registry\src\index.crates.io-6f17d22bba15001f\c2rust-build-paths-0.18.0\src\lib.rs:35:26
|
35 | use std::os::unix::ffi::OsStrExt;
| ^^^^ could not find unix in os

Compiling env_logger v0.10.0
error[E0599]: no function or associated item named from_bytes found for struct OsStr in the current scope
--> C:\Users\murra.cargo\registry\src\index.crates.io-6f17d22bba15001f\c2rust-build-paths-0.18.0\src\lib.rs:37:20
|
37 | OsStr::from_bytes(path)
| ^^^^^^^^^^ function or associated item not found in OsStr

Can someone PLEASE fix these errors, I KNOW that running on Windows is not you first or highest priorities but these errors (to me) are SO ELEMENTARY that the SHOULD be fixed, regardless of the O/S clients are running on.
I don't believe that the "fix" for this issue is that convoluted or complex, I just don't think any appreciation is being given to this problem.
IMO, it is simply BAD FORM to reference specific O/S's (such as 'unix') when functions ALREADY EXIST to identify the O/S and take the appropriate action.
In MY case, I have a proposed task to rewrite some Windows DLLs into rust code, for the obvious reasons of improved safety and the other benefits that rust provides.

Thanks for listening to my coments.

Murray

@thedataking
Copy link
Contributor

Hi Murray, thanks for the report.

The issues you ran into may seem elementary but they would in all likelihood surface many more issues that would need to be resolved in order to support Windows natively. For instance, we'd need a way to generate compile commands on Windows, we'd need to make sure we handle MSVC-specific extensions, and many more issues that I'm not even aware of.

You write that you're running Windows 11 on a 64-bit laptop so in all likelihood you'll be able to successfully compile c2rust if you enable Windows Subsystem for Linux (WSL). Of course that will not let you transpile C code written for Windows – so I realize that WSL might not be a viable workaround for your situation.

@kkysen
Copy link
Contributor

kkysen commented Nov 3, 2023

Hi @MurraySobol, that above error (#708) was just fixed by #1036, though there are still much deeper issues with Windows. Just wanted to let you know that that trivial error has at least been fixed now.

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

3 participants